@@ -89,7 +89,7 @@ typedef unsigned short WORD;
8989#define _tcsicmp stricmp
9090#define _tcsncpy strncpy
9191#define _tcsstr strstr
92- #define _sntprintf _snprintf
92+ #define _sntprintf snprintf
9393#define INVALID_HANDLE_VALUE nullptr
9494#define INVALID_SET_FILE_POINTER 0xFFFFFFFFUL
9595#ifndef _T
@@ -119,7 +119,6 @@ typedef unsigned short WORD;
119119enum ZipMode { ZIP_HANDLE = 1 , ZIP_FILENAME = 2 , ZIP_MEMORY = 3 };
120120
121121#define zmalloc (len ) malloc(len)
122-
123122#define zfree (p ) free(p)
124123
125124namespace {
@@ -1635,7 +1634,7 @@ int huft_build(uInt *b, // code lengths in bits (all assumed <= BMAX)
16351634#define C2 C0 C0 C0 C0
16361635#define C4 C2 C2 C2 C2
16371636 C4;
1638- p; // clear c[]--assume BMAX+1 is 16
1637+ // clear c[]--assume BMAX+1 is 16
16391638 p = b;
16401639 i = n;
16411640 do {
@@ -2398,7 +2397,6 @@ int inflate(z_streamp z, int f) {
23982397 z->state ->mode = IM_DICT1;
23992398 case IM_DICT1:
24002399 IM_NEEDBYTE;
2401- r;
24022400 z->state ->sub .check .need += (uLong)IM_NEXTBYTE;
24032401 z->adler = z->state ->sub .check .need ;
24042402 z->state ->mode = IM_DICT0;
@@ -2850,7 +2848,7 @@ uLong unzlocal_SearchCentralDir(LUFILE *fin) {
28502848 long uMaxBack{0xFFFF }; // maximum size of global comment
28512849 if (uMaxBack > uSizeFile) uMaxBack = uSizeFile;
28522850
2853- constexpr size_t bufSize{BUFREADCOMMENT + 4 };
2851+ constexpr long bufSize{BUFREADCOMMENT + 4 };
28542852 auto buf = std::make_unique<unsigned char []>(bufSize);
28552853 if (!buf) return 0xFFFFFFFF ;
28562854
@@ -3043,11 +3041,13 @@ int unzlocal_GetCurrentFileInfoInternal(
30433041 err = UNZ_ERRNO;
30443042
30453043 // we check the magic
3046- if (err == UNZ_OK)
3047- if (unzlocal_getLong (s->file , &uMagic) != UNZ_OK)
3044+ if (err == UNZ_OK) {
3045+ if (unzlocal_getLong (s->file , &uMagic) != UNZ_OK) {
30483046 err = UNZ_ERRNO;
3049- else if (uMagic != 0x02014b50 )
3047+ } else if (uMagic != 0x02014b50 ) {
30503048 err = UNZ_BADZIPFILE;
3049+ }
3050+ }
30513051
30523052 if (unzlocal_getShort (s->file , &file_info.version ) != UNZ_OK) err = UNZ_ERRNO;
30533053
@@ -3115,11 +3115,13 @@ int unzlocal_GetCurrentFileInfoInternal(
31153115 else
31163116 uSizeRead = extraFieldBufferSize;
31173117
3118- if (lSeek != 0 )
3119- if (lufseek (s->file , lSeek, SEEK_CUR) == 0 )
3118+ if (lSeek != 0 ) {
3119+ if (lufseek (s->file , lSeek, SEEK_CUR) == 0 ) {
31203120 lSeek = 0 ;
3121- else
3121+ } else {
31223122 err = UNZ_ERRNO;
3123+ }
3124+ }
31233125
31243126 if ((file_info.size_file_extra > 0 ) && (extraFieldBufferSize > 0 ))
31253127 if (lufread (extraField, (uInt)uSizeRead, 1 , s->file ) != 1 )
@@ -3138,10 +3140,9 @@ int unzlocal_GetCurrentFileInfoInternal(
31383140 uSizeRead = commentBufferSize;
31393141
31403142 if (lSeek != 0 )
3141- if (lufseek (s->file , lSeek, SEEK_CUR) == 0 ) {
3142- } // unused lSeek=0;
3143- else
3143+ if (lufseek (s->file , lSeek, SEEK_CUR) != 0 ) {
31443144 err = UNZ_ERRNO;
3145+ }
31453146
31463147 if ((file_info.size_file_comment > 0 ) && (commentBufferSize > 0 ))
31473148 if (lufread (szComment, (uInt)uSizeRead, 1 , s->file ) != 1 ) err = UNZ_ERRNO;
@@ -3439,7 +3440,7 @@ int unzReadCurrentFile(unzFile file, voidp buf, unsigned len,
34393440
34403441 file_in_zip_read_info_s *pfile_in_zip_read_info = s->pfile_in_zip_read ;
34413442 if (pfile_in_zip_read_info == nullptr ) return UNZ_PARAMERROR;
3442- if (( pfile_in_zip_read_info->read_buffer == nullptr ) ) {
3443+ if (pfile_in_zip_read_info->read_buffer == nullptr ) {
34433444 return UNZ_END_OF_LIST_OF_FILE;
34443445 }
34453446
@@ -3910,7 +3911,7 @@ ZRESULT TUnzip::Get(int index, ZIPENTRY *ze) {
39103911 bool readonly = (a & 0x00800000 ) == 0 ;
39113912 // bool readable= (a&0x01000000)!=0; // unused
39123913 // bool executable=(a&0x00400000)!=0; // unused
3913- bool hidden = false , system = false , archive = true ;
3914+ [[maybe_unused]] bool hidden = false , system = false , archive = true ;
39143915 // but in normal hostmodes these are overridden by the lower half...
39153916 int host = ufi.version >> 8 ;
39163917 if (host == 0 || host == 7 || host == 11 || host == 14 ) {
@@ -3920,11 +3921,6 @@ ZRESULT TUnzip::Get(int index, ZIPENTRY *ze) {
39203921 isdir = (a & 0x00000010 ) != 0 ;
39213922 archive = (a & 0x00000020 ) != 0 ;
39223923 }
3923- readonly;
3924- hidden;
3925- system;
3926- isdir;
3927- archive;
39283924 ze->attr = 0 ;
39293925
39303926#ifdef ZIP_STD
@@ -4087,16 +4083,13 @@ ZRESULT EnsureDirectory(const TCHAR *rootdir, const TCHAR *dir) {
40874083 c++;
40884084 }
40894085
4090- const TCHAR *name{lastslash};
40914086 if (lastslash != dir) {
40924087 TCHAR tmp[MAX_PATH];
40934088 memcpy (tmp, dir, sizeof (TCHAR) * (lastslash - dir));
40944089 tmp[lastslash - dir] = 0 ;
40954090
40964091 ZRESULT rc = EnsureDirectory (rootdir, tmp);
40974092 if (rc != ZR_OK) return rc;
4098-
4099- name++;
41004093 }
41014094
41024095 TCHAR cd[MAX_PATH];
@@ -4488,6 +4481,9 @@ size_t FormatZipMessageU(ZRESULT code, TCHAR *buf, size_t len) {
44884481 case ZR_FLATE:
44894482 msg = _T (" Zip-bug: an internal error during flation" );
44904483 break ;
4484+ default :
4485+ // Use default one.
4486+ break ;
44914487 }
44924488
44934489 const size_t mlen{_tcslen (msg)};
0 commit comments