Guard Z_BZIP2ED with #ifdef HAVE_BZIP2 in miniunz.c, unzip.c

This commit is contained in:
Nebuleon Fumika 2014-01-29 21:41:59 +00:00 committed by Piotr Paweł Stefaniak
parent 76207f9586
commit 5fbc17672a
2 changed files with 10 additions and 10 deletions

View File

@ -271,11 +271,13 @@ static int do_list(unzFile uf) {
else if ((iLevel==2) || (iLevel==3)) else if ((iLevel==2) || (iLevel==3))
string_method="Defl:F"; /* 2:fast , 3 : extra fast*/ string_method="Defl:F"; /* 2:fast , 3 : extra fast*/
} }
#ifdef HAVE_BZIP2
else else
if (file_info.compression_method==Z_BZIP2ED) if (file_info.compression_method==Z_BZIP2ED)
{ {
string_method="BZip2 "; string_method="BZip2 ";
} }
#endif
else else
string_method="Unkn. "; string_method="Unkn. ";

View File

@ -1290,9 +1290,9 @@ local int unz64local_CheckCurrentFileCoherencyHeader(unz64_s* s, uInt* piSizeVar
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) && if ((err==UNZ_OK) && (s->cur_file_info.compression_method!=0) &&
/* #ifdef HAVE_BZIP2 */ #ifdef HAVE_BZIP2
(s->cur_file_info.compression_method!=Z_BZIP2ED) && (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
/* #endif */ #endif
(s->cur_file_info.compression_method!=Z_DEFLATED)) (s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -1396,9 +1396,9 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
} }
if ((s->cur_file_info.compression_method!=0) && if ((s->cur_file_info.compression_method!=0) &&
/* #ifdef HAVE_BZIP2 */ #ifdef HAVE_BZIP2
(s->cur_file_info.compression_method!=Z_BZIP2ED) && (s->cur_file_info.compression_method!=Z_BZIP2ED) &&
/* #endif */ #endif
(s->cur_file_info.compression_method!=Z_DEFLATED)) (s->cur_file_info.compression_method!=Z_DEFLATED))
err=UNZ_BADZIPFILE; err=UNZ_BADZIPFILE;
@ -1413,10 +1413,10 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
pfile_in_zip_read_info->stream.total_out = 0; pfile_in_zip_read_info->stream.total_out = 0;
#ifdef HAVE_BZIP2
if ((s->cur_file_info.compression_method==Z_BZIP2ED) && if ((s->cur_file_info.compression_method==Z_BZIP2ED) &&
(!raw)) (!raw))
{ {
#ifdef HAVE_BZIP2
pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0; pfile_in_zip_read_info->bstream.bzalloc = (void *(*) (void *, int, int))0;
pfile_in_zip_read_info->bstream.bzfree = (free_func)0; pfile_in_zip_read_info->bstream.bzfree = (free_func)0;
pfile_in_zip_read_info->bstream.opaque = (voidpf)0; pfile_in_zip_read_info->bstream.opaque = (voidpf)0;
@ -1437,11 +1437,9 @@ extern int ZEXPORT unzOpenCurrentFile3(unzFile file, int* method,
free(pfile_in_zip_read_info); free(pfile_in_zip_read_info);
return err; return err;
} }
#else
pfile_in_zip_read_info->raw=1;
#endif
} }
else else
#endif
if ((s->cur_file_info.compression_method==Z_DEFLATED) && if ((s->cur_file_info.compression_method==Z_DEFLATED) &&
(!raw)) (!raw))
{ {
@ -1658,10 +1656,10 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
pfile_in_zip_read_info->stream.total_out += uDoCopy; pfile_in_zip_read_info->stream.total_out += uDoCopy;
iRead += uDoCopy; iRead += uDoCopy;
} }
#ifdef HAVE_BZIP2
else else
if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED) if (pfile_in_zip_read_info->compression_method==Z_BZIP2ED)
{ {
#ifdef HAVE_BZIP2
uLong uTotalOutBefore,uTotalOutAfter; uLong uTotalOutBefore,uTotalOutAfter;
const Bytef *bufBefore; const Bytef *bufBefore;
uLong uOutThis; uLong uOutThis;
@ -1700,8 +1698,8 @@ extern int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len) {
return (iRead==0) ? UNZ_EOF : iRead; return (iRead==0) ? UNZ_EOF : iRead;
if (err!=BZ_OK) if (err!=BZ_OK)
break; break;
#endif
} }
#endif
else else
{ {
ZPOS64_T uTotalOutBefore,uTotalOutAfter; ZPOS64_T uTotalOutBefore,uTotalOutAfter;