From 8cbe42fcb029e0b8c8e1c169be219f4c19be29d8 Mon Sep 17 00:00:00 2001 From: Ahmed Abdellah Date: Wed, 23 Oct 2019 20:22:07 +0100 Subject: [PATCH] solving the rest of C90 issues in defining local variables in middle of code and comparing uncompatible types --- programs/util.c | 4 ++-- programs/zstdcli.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/programs/util.c b/programs/util.c index cb2e6410..e28e4a96 100644 --- a/programs/util.c +++ b/programs/util.c @@ -283,7 +283,7 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName) { UTIL_DISPLAY("[TRACE] migration done\n"); - UTIL_DISPLAY("[TRACE] pos %zu inputFileSize %lu\n", pos, inputFileSize); + UTIL_DISPLAY("[TRACE] pos %zu inputFileSize %llu\n", pos, inputFileSize); if(pos > inputFileSize){ UTIL_freeFileNamesTable(filesTable); if(buf) free(buf); @@ -330,7 +330,7 @@ UTIL_concatenateTwoTables(FileNamesTable* table1, FileNamesTable* table2) { } size_t newTotalTableSize = getTotalTableSize(table1) + getTotalTableSize(table2); - UTIL_DISPLAY("[TRACE] buf total size is: %d\n", newTotalTableSize); + UTIL_DISPLAY("[TRACE] buf total size is: %zu\n", newTotalTableSize); char* buf = (char*) malloc(newTotalTableSize * sizeof(char)); if(!buf) { diff --git a/programs/zstdcli.c b/programs/zstdcli.c index ade7ca00..9a05cf72 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -808,9 +808,8 @@ int main(int argCount, const char* argv[]) if (longCommandWArg(&argument, "--file=")) { DISPLAYLEVEL(4, "[TRACE] argument catched\n"); - const char* fileName = argument; DISPLAYLEVEL(4, "[TRACE] fileName: %s\n", argument); - if(!UTIL_fileExist(fileName) || !UTIL_isRegularFile(argument)){ + if(!UTIL_fileExist(argument) || !UTIL_isRegularFile(argument)){ DISPLAYLEVEL(1, "[ERROR] wrong fileName: %s\n", argument); CLEAN_RETURN(badusage(programName)); } @@ -824,7 +823,7 @@ int main(int argCount, const char* argv[]) DISPLAYLEVEL(4, "[TRACE] call read function is finished\n"); DISPLAYLEVEL(4, "[TRACE] extendedFileNamesTable:\n"); - unsigned i = 0; + unsigned i; for(i = 0; i < extendedTable->tableSize; ++i) printf("%s\n",extendedTable->fileNames[i]);