@ -1255,7 +1255,7 @@ static bool InitWriteZlib()
if ( deflateInit ( & _z , 6 ) ! = Z_OK ) return false ;
if ( deflateInit ( & _z , 6 ) ! = Z_OK ) return false ;
_sl . bufsize = 4096 ;
_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 ;
return true ;
}
}
@ -1269,7 +1269,16 @@ static void WriteZlibLoop(z_streamp z, byte *p, size_t len, int mode)
do {
do {
z - > next_out = buf ;
z - > next_out = buf ;
z - > avail_out = sizeof ( 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 ) ;
r = deflate ( z , mode ) ;
/* bytes were emitted? */
/* bytes were emitted? */
if ( ( n = sizeof ( buf ) - z - > avail_out ) ! = 0 ) {
if ( ( n = sizeof ( buf ) - z - > avail_out ) ! = 0 ) {
if ( fwrite ( buf , n , 1 , _sl . fh ) ! = 1 ) SlError ( STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE ) ;
if ( fwrite ( buf , n , 1 , _sl . fh ) ! = 1 ) SlError ( STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE ) ;