Removed useless pattern file size limitation

This commit is contained in:
WerWolv 2020-11-13 13:50:59 +01:00
parent 0cdacc4b9f
commit 7a30072fcb
2 changed files with 7 additions and 8 deletions

View File

@ -26,7 +26,7 @@ namespace hex {
void createView() override;
private:
char *m_buffer;
char *m_buffer = nullptr;
std::vector<Highlight> &m_highlights;
prv::Provider* &m_dataProvider;

View File

@ -7,11 +7,10 @@ namespace hex {
ViewPattern::ViewPattern(prv::Provider* &dataProvider, std::vector<Highlight> &highlights)
: View(), m_dataProvider(dataProvider), m_highlights(highlights) {
this->m_buffer = new char[0xFFFFFF];
std::memset(this->m_buffer, 0x00, 0xFFFFFF);
}
ViewPattern::~ViewPattern() {
delete[] this->m_buffer;
if (this->m_buffer != nullptr)
delete[] this->m_buffer;
}
void ViewPattern::createMenu() {
@ -66,10 +65,10 @@ namespace hex {
size_t size = ftell(file);
rewind(file);
if (size > 0xFF'FFFF) {
fclose(file);
return;
}
if (this->m_buffer != nullptr)
delete[] this->m_buffer;
this->m_buffer = new char[size + 1];
std::memset(this->m_buffer, 0x00, size + 1);
fread(this->m_buffer, size, 1, file);