@@ -160,30 +160,29 @@ static int GetFileList(unzFile UnZipHandle, WORKSPACE *ws) {
160
160
if (unzGetGlobalInfo64 (UnZipHandle , & GlobalInfo ) != UNZ_OK )
161
161
return TZ_ERR ;
162
162
163
- if (!(ws -> FileNameArray =
164
- DynamicStringArrayGrow (ws -> FileNameArray , & ws -> iElements ,
165
- GlobalInfo .number_entry + 1 )))
163
+ if (!(ws -> FileNameArray = DynamicStringArrayGrow (
164
+ ws -> FileNameArray , & ws -> iElements , GlobalInfo .number_entry + 1 )))
166
165
return TZ_CRITICAL ;
167
166
168
167
if (GlobalInfo .number_entry != 0 )
169
168
rc = unzGoToFirstFile (UnZipHandle );
170
169
171
- for (iCount = 0 ;
172
- rc == UNZ_OK && iCount < GlobalInfo .number_entry ;
170
+ for (iCount = 0 ; rc == UNZ_OK && iCount < GlobalInfo .number_entry ;
173
171
iCount ++ , rc = unzGoToNextFile (UnZipHandle )) {
174
172
unz_file_info64 ZipInfo ;
175
173
176
174
rc = unzGetCurrentFileInfo64 (UnZipHandle , & ZipInfo ,
177
- ws -> FileNameArray [iCount ], MAX_PATH ,
178
- NULL , 0 , NULL , 0 );
175
+ ws -> FileNameArray [iCount ], MAX_PATH , NULL , 0 ,
176
+ NULL , 0 );
179
177
if (rc != UNZ_OK || ZipInfo .size_filename >= MAX_PATH ||
180
178
ZipInfo .size_filename == 0 )
181
179
break ;
182
180
}
183
181
ws -> FileNameArray [iCount ][0 ] = 0 ;
184
182
185
183
return rc == UNZ_END_OF_LIST_OF_FILE && iCount == GlobalInfo .number_entry
186
- ? TZ_OK : TZ_ERR ;
184
+ ? TZ_OK
185
+ : TZ_ERR ;
187
186
}
188
187
189
188
int CheckZipStatus (unz64_s * UnzipStream , WORKSPACE * ws ) {
@@ -383,9 +382,11 @@ int MigrateZip(const char *zip_path, const char *pDir, WORKSPACE *ws,
383
382
rc = GetFileList (UnZipHandle , ws );
384
383
if (rc != TZ_OK ) {
385
384
logprint3 (stderr , mig -> fProcessLog , ErrorLog (ws ),
386
- rc == TZ_CRITICAL ? "Error allocating memory!\n" :
387
- "Could not list contents of \"%s\". File is corrupted or "
388
- "contains entries with bad names.\n" , szZipFileName );
385
+ rc == TZ_CRITICAL
386
+ ? "Error allocating memory!\n"
387
+ : "Could not list contents of \"%s\". File is corrupted or "
388
+ "contains entries with bad names.\n" ,
389
+ szZipFileName );
389
390
unzClose (UnZipHandle );
390
391
return rc ;
391
392
}
@@ -432,10 +433,9 @@ int MigrateZip(const char *zip_path, const char *pDir, WORKSPACE *ws,
432
433
433
434
tmpfd = mkstemp (szTmpZipFileName );
434
435
if (tmpfd < 0 ) {
435
- logprint3 (
436
- stderr , mig -> fProcessLog , ErrorLog (ws ),
437
- "!!!! Couldn't create a unique temporary file. %s. !!!!\n" ,
438
- strerror (errno ));
436
+ logprint3 (stderr , mig -> fProcessLog , ErrorLog (ws ),
437
+ "!!!! Couldn't create a unique temporary file. %s. !!!!\n" ,
438
+ strerror (errno ));
439
439
unzClose (UnZipHandle );
440
440
return TZ_CRITICAL ;
441
441
}
@@ -445,10 +445,9 @@ int MigrateZip(const char *zip_path, const char *pDir, WORKSPACE *ws,
445
445
close (tmpfd );
446
446
447
447
if ((ZipHandle = zipOpen64 (szTmpZipFileName , 0 )) == NULL ) {
448
- logprint3 (
449
- stderr , mig -> fProcessLog , ErrorLog (ws ),
450
- "Error opening temporary zip file %s. Unable to process \"%s\"\n" ,
451
- szTmpZipFileName , szZipFileName );
448
+ logprint3 (stderr , mig -> fProcessLog , ErrorLog (ws ),
449
+ "Error opening temporary zip file %s. Unable to process \"%s\"\n" ,
450
+ szTmpZipFileName , szZipFileName );
452
451
unzClose (UnZipHandle );
453
452
remove (szTmpZipFileName );
454
453
return TZ_ERR ;
@@ -663,8 +662,8 @@ static char **GetDirFileList(DIR *dirp, int *piElements) {
663
662
664
663
while ((direntp = readdir (dirp ))) {
665
664
if (!(FileNameArray =
666
- DynamicStringArrayGrow (FileNameArray , piElements , iCount + 1 )))
667
- return NULL ;
665
+ DynamicStringArrayGrow (FileNameArray , piElements , iCount + 1 )))
666
+ return NULL ;
668
667
669
668
snprintf (FileNameArray [iCount ], MAX_PATH + 1 , "%s" , direntp -> d_name );
670
669
iCount ++ ;
@@ -926,26 +925,27 @@ int main(int argc, char **argv) {
926
925
if (argv [iCount ][0 ] == '-' ) {
927
926
iOptionsFound ++ ;
928
927
929
- switch (tolower (argv [iCount ][1 ])) {
928
+ switch (tolower (( unsigned char ) argv [iCount ][1 ])) {
930
929
case '?' :
931
930
case 'h' :
932
- fprintf (stdout , "%s" ,
933
- "TorrentZip v" TZ_VERSION "\n\n"
934
- "Copyright (C) 2005 - 2024 TorrentZip Team:\n"
935
- "\tStatMat, shindakun, Ultrasubmarine, r3nh03k, goosecreature, "
936
- "gordonj,\n\t0-wiz-0, A.Miller\n"
937
- "Homepage: https://github.com/0-wiz-0/trrntzip\n\n"
938
- "Usage: trrntzip [-dfghqsv] [-eFILE] [-lDIR] [PATH/ZIP FILE]\n\n"
939
- "Options:\n"
940
- "\t-h\t: show this help\n"
941
- "\t-d\t: strip sub-directories from zips\n"
942
- "\t-eFILE\t: write error log to FILE\n"
943
- "\t-f\t: force re-zip\n"
944
- "\t-g\t: skip interactive prompts\n"
945
- "\t-lDIR\t: write log files in DIR (empty to disable)\n"
946
- "\t-q\t: quiet mode\n"
947
- "\t-s\t: prevent sub-directory recursion\n"
948
- "\t-v\t: show version\n" );
931
+ fprintf (
932
+ stdout , "%s" ,
933
+ "TorrentZip v" TZ_VERSION "\n\n"
934
+ "Copyright (C) 2005 - 2024 TorrentZip Team:\n"
935
+ "\tStatMat, shindakun, Ultrasubmarine, r3nh03k, goosecreature, "
936
+ "gordonj,\n\t0-wiz-0, A.Miller\n"
937
+ "Homepage: https://github.com/0-wiz-0/trrntzip\n\n"
938
+ "Usage: trrntzip [-dfghqsv] [-eFILE] [-lDIR] [PATH/ZIP FILE]\n\n"
939
+ "Options:\n"
940
+ "\t-h\t: show this help\n"
941
+ "\t-d\t: strip sub-directories from zips\n"
942
+ "\t-eFILE\t: write error log to FILE\n"
943
+ "\t-f\t: force re-zip\n"
944
+ "\t-g\t: skip interactive prompts\n"
945
+ "\t-lDIR\t: write log files in DIR (empty to disable)\n"
946
+ "\t-q\t: quiet mode\n"
947
+ "\t-s\t: prevent sub-directory recursion\n"
948
+ "\t-v\t: show version\n" );
949
949
return EXIT_SUCCESS ;
950
950
951
951
case 'd' :
@@ -996,7 +996,8 @@ int main(int argc, char **argv) {
996
996
997
997
if (argc < 2 || iOptionsFound == (argc - 1 )) {
998
998
fprintf (stderr , "trrntzip: missing path\n" );
999
- fprintf (stderr , "Usage: trrntzip [-dfghqsv] [-eFILE] [-lDIR] [PATH/ZIP FILE]\n" );
999
+ fprintf (stderr ,
1000
+ "Usage: trrntzip [-dfghqsv] [-eFILE] [-lDIR] [PATH/ZIP FILE]\n" );
1000
1001
#ifdef WIN32
1001
1002
// Prevent the command window from disappearing immediately when
1002
1003
// the user just clicks on the exe.
0 commit comments