Fix reading more than a block but less than the rest of the file

This commit is contained in:
Jeffrey Pfau 2014-07-17 02:51:38 -07:00
parent 793a89d091
commit 74fcdf54e0
1 changed files with 2 additions and 2 deletions

View File

@ -134,8 +134,8 @@ ssize_t _vfzRead(struct VFile* vf, void* buffer, size_t size) {
if (vfz->offset < vfz->readSize) {
size_t diff = vfz->readSize - vfz->offset;
void* start = &((uint8_t*) vfz->buffer)[vfz->offset];
if (diff > size) {
diff = size;
if (diff > size - bytesRead) {
diff = size - bytesRead;
}
if (buffer) {
void* bufferOffset = &((uint8_t*) buffer)[bytesRead];