mirror of https://github.com/mgba-emu/mgba.git
Fix reading more than a block but less than the rest of the file
This commit is contained in:
parent
793a89d091
commit
74fcdf54e0
|
@ -134,8 +134,8 @@ ssize_t _vfzRead(struct VFile* vf, void* buffer, size_t size) {
|
||||||
if (vfz->offset < vfz->readSize) {
|
if (vfz->offset < vfz->readSize) {
|
||||||
size_t diff = vfz->readSize - vfz->offset;
|
size_t diff = vfz->readSize - vfz->offset;
|
||||||
void* start = &((uint8_t*) vfz->buffer)[vfz->offset];
|
void* start = &((uint8_t*) vfz->buffer)[vfz->offset];
|
||||||
if (diff > size) {
|
if (diff > size - bytesRead) {
|
||||||
diff = size;
|
diff = size - bytesRead;
|
||||||
}
|
}
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
void* bufferOffset = &((uint8_t*) buffer)[bytesRead];
|
void* bufferOffset = &((uint8_t*) buffer)[bytesRead];
|
||||||
|
|
Loading…
Reference in New Issue