diff --git a/sources/compress.c b/sources/compress.c index 0bf8485d..6aff515c 100644 --- a/sources/compress.c +++ b/sources/compress.c @@ -116,6 +116,7 @@ int SetupOutputGZIP(FILEHANDLE *f) /* 6: Initiate the deflation */ + if ( deflateInit(f->zsp,AR.gzipCompress) != Z_OK ) { MLOCK(ErrorMessageLock); MesPrint("Error from zlib: %s",f->zsp->msg); diff --git a/sources/setfile.c b/sources/setfile.c index 5c67df11..05ef8364 100644 --- a/sources/setfile.c +++ b/sources/setfile.c @@ -947,6 +947,7 @@ SORTING *AllocSort(LONG LargeSize, LONG SmallSize, LONG SmallEsize, LONG TermsIn #ifdef WITHZLIB /* sort->file.ziosize = IOsize; */ sort->file.ziosize = IObuffersize*sizeof(WORD); + sort->file.ziobuffer = 0; #endif if ( AM.S0 != 0 ) { sort->file.name = (char *)(sort->file.PObuffer + IObuffersize); diff --git a/sources/sort.c b/sources/sort.c index fd669ada..8cf08612 100644 --- a/sources/sort.c +++ b/sources/sort.c @@ -785,7 +785,6 @@ LONG EndSort(PHEAD WORD *buffer, int par) #ifdef WITHZLIB { int oldgzipCompress = AR.gzipCompress; AR.gzipCompress = 0; - /* SetupOutputGZIP(fout); */ #endif if ( tover > 0 ) { ss = S->sPointer; @@ -1414,9 +1413,12 @@ WORD PutOut(PHEAD WORD *term, POSITION *position, FILEHANDLE *fi, WORD ncomp) fi->handle = (WORD)RetCode; PUTZERO(fi->filesize); PUTZERO(fi->POposition); +/* + Should not be here anymore? #ifdef WITHZLIB fi->ziobuffer = 0; #endif +*/ } else { MLOCK(ErrorMessageLock); @@ -1628,9 +1630,12 @@ WORD PutOut(PHEAD WORD *term, POSITION *position, FILEHANDLE *fi, WORD ncomp) fi->handle = (WORD)RetCode; PUTZERO(fi->filesize); PUTZERO(fi->POposition); +/* + Should not be here? #ifdef WITHZLIB fi->ziobuffer = 0; #endif +*/ } else { MLOCK(ErrorMessageLock); @@ -1762,9 +1767,12 @@ WORD FlushOut(POSITION *position, FILEHANDLE *fi, int compr) PUTZERO(fi->filesize); PUTZERO(fi->POposition); fi->handle = (WORD)RetCode; +/* + Should not be here? #ifdef WITHZLIB fi->ziobuffer = 0; #endif +*/ } else { MLOCK(ErrorMessageLock); @@ -3548,9 +3556,12 @@ WORD MergePatches(WORD par) fout->handle = fhandle; PUTZERO(fout->filesize); PUTZERO(fout->POposition); +/* + Should not be here? #ifdef WITHZLIB fout->ziobuffer = 0; #endif +*/ #ifdef ALLLOCK LOCK(fout->pthreadslock); #endif @@ -3736,7 +3747,6 @@ WORD MergePatches(WORD par) #define FRONTSIZE (2*AM.MaxTer) WORD *copybuf = (WORD *)(((UBYTE *)(S->sBuffer)) + FRONTSIZE); WORD *copytop; - SetupOutputGZIP(fout); SetupAllInputGZIP(S); m1 = m2 = copybuf; position2 = S->iPatches[0]; diff --git a/sources/startup.c b/sources/startup.c index 8450f916..d492f5ad 100644 --- a/sources/startup.c +++ b/sources/startup.c @@ -1295,6 +1295,8 @@ WORD IniVars() AM.gOutNumberType = RATIONALMODE; #ifdef WITHZLIB AR.gzipCompress = GZIPDEFAULT; + AR.FoStage4[0].ziobuffer = 0; + AR.FoStage4[1].ziobuffer = 0; #endif AR.BracketOn = 0; AC.bracketindexflag = 0; diff --git a/sources/threads.c b/sources/threads.c index f1c8b8e4..cdeff1de 100644 --- a/sources/threads.c +++ b/sources/threads.c @@ -542,6 +542,8 @@ ALLPRIVATES *InitializeOneThread(int identity) #ifdef WITHZLIB AR.FoStage4[0].ziosize = IOsize; AR.FoStage4[1].ziosize = IOsize; + AR.FoStage4[0].ziobuffer = 0; + AR.FoStage4[1].ziobuffer = 0; #endif AR.FoStage4[0].POsize = ((IOsize+sizeof(WORD)-1)/sizeof(WORD))*sizeof(WORD); AR.FoStage4[1].POsize = ((IOsize+sizeof(WORD)-1)/sizeof(WORD))*sizeof(WORD);