mirror of https://github.com/WerWolv/ImHex.git
fix: BufferedReader messing up the second to last byte
This commit is contained in:
parent
44a90f5c7d
commit
bf00503d1f
|
@ -24,6 +24,9 @@ namespace hex::prv {
|
|||
}
|
||||
|
||||
void setEndAddress(u64 address) {
|
||||
if (address >= this->m_provider->getActualSize())
|
||||
address = this->m_provider->getActualSize() - 1;
|
||||
|
||||
this->m_endAddress = address;
|
||||
}
|
||||
|
||||
|
@ -256,7 +259,7 @@ namespace hex::prv {
|
|||
private:
|
||||
void updateBuffer(u64 address, size_t size) {
|
||||
if (!this->m_bufferValid || address < this->m_bufferAddress || address + size > (this->m_bufferAddress + this->m_buffer.size())) {
|
||||
const auto remainingBytes = (this->m_endAddress - address) - 1;
|
||||
const auto remainingBytes = (this->m_endAddress - address) + 1;
|
||||
if (remainingBytes < this->m_maxBufferSize)
|
||||
this->m_buffer.resize(remainingBytes);
|
||||
else
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace hex::plugin::builtin {
|
|||
|
||||
auto reader = prv::BufferedReader(provider);
|
||||
reader.seek(offset);
|
||||
reader.setEndAddress(offset + size);
|
||||
reader.setEndAddress(offset + size - 1);
|
||||
|
||||
u64 index = 0x00;
|
||||
for (u8 byte : reader) {
|
||||
|
@ -160,7 +160,7 @@ namespace hex::plugin::builtin {
|
|||
|
||||
auto reader = prv::BufferedReader(provider);
|
||||
reader.seek(offset);
|
||||
reader.setEndAddress(offset + size);
|
||||
reader.setEndAddress((offset + size) - 1);
|
||||
|
||||
u64 address = offset & ~u64(0x0F);
|
||||
std::string asciiRow;
|
||||
|
|
Loading…
Reference in New Issue