Mercurial > hg > dmlib
changeset 561:cf39f51d4e74
Fix a rather silly buffer reallocation + use after modify case. Urgh.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 04 Dec 2012 20:55:17 +0200 |
parents | 7e73d733b96f |
children | 6a830bcd7eb9 |
files | lib64gfx.c |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/lib64gfx.c Tue Nov 27 19:57:48 2012 +0200 +++ b/lib64gfx.c Tue Dec 04 20:55:17 2012 +0200 @@ -825,8 +825,8 @@ { FILE *f; int res = DMERR_OK; - Uint8 *dataBuf = NULL, *dataPtr; - size_t readSize, dataSize, dataRead; + Uint8 *dataBuf = NULL; + size_t readSize, dataSize, dataRead, dataPos; if (inFile != NULL) f = inFile; @@ -854,13 +854,13 @@ goto error; } - dataPtr = dataBuf; + dataPos = 0; dataRead = 0; while (!feof(f) && !ferror(f)) { - size_t read = fread(dataPtr, 1, readSize, f); - dataPtr += read; + size_t read = fread(dataBuf + dataPos, 1, readSize, f); + dataPos += read; dataRead += read; if (dataRead >= dataSize)