fixed inaccurate buffer read

master
Avril 4 years ago
parent a8ad26ec5e
commit 0fbd1ea230
Signed by: flanchan
GPG Key ID: 966FE03CC0E0B199

@ -25,7 +25,7 @@ static int fwrite_all(const void* _buf, size_t sz, size_t num, FILE* out)
{ {
register size_t w, done=0; register size_t w, done=0;
register const unsigned char* buf = _buf; register const unsigned char* buf = _buf;
while( (w = fwrite(buf+done, sz, num-done, out)) > 0 && done < num) done+=w; while( (w = fwrite(buf+(sz*done), sz, num-done, out)) > 0 && done < num) done+=w;
if (done!=num) return 0; if (done!=num) return 0;
else return 1; else return 1;
} }

Loading…
Cancel
Save