mirror of https://github.com/OpenTTD/OpenTTD
(svn r15287) -Cleanup: some code style, remove erroneous comment.
-Document: the fact that zlib reads uninitialised data (valgrind notices this) and that it won't be fixed in zlib and that we can't do anything about it except ignoring it.release/0.7
parent
7dbd0582b6
commit
7d64441008
|
@ -1255,7 +1255,7 @@ static bool InitWriteZlib()
|
|||
if (deflateInit(&_z, 6) != Z_OK) return false;
|
||||
|
||||
_sl.bufsize = 4096;
|
||||
_sl.buf = _sl.buf_ori = MallocT<byte>(4096); // also contains fread buffer
|
||||
_sl.buf = _sl.buf_ori = MallocT<byte>(4096);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1269,7 +1269,16 @@ static void WriteZlibLoop(z_streamp z, byte *p, size_t len, int mode)
|
|||
do {
|
||||
z->next_out = buf;
|
||||
z->avail_out = sizeof(buf);
|
||||
|
||||
/**
|
||||
* For the poor next soul who sees many valgrind warnings of the
|
||||
* "Conditional jump or move depends on uninitialised value(s)" kind:
|
||||
* According to the author of zlib it is not a bug and it won't be fixed.
|
||||
* http://groups.google.com/group/comp.compression/browse_thread/thread/b154b8def8c2a3ef/cdf9b8729ce17ee2
|
||||
* [Mark Adler, Feb 24 2004, 'zlib-1.2.1 valgrind warnings' in the newgroup comp.compression]
|
||||
**/
|
||||
r = deflate(z, mode);
|
||||
|
||||
/* bytes were emitted? */
|
||||
if ((n = sizeof(buf) - z->avail_out) != 0) {
|
||||
if (fwrite(buf, n, 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
|
||||
|
|
Loading…
Reference in New Issue