solving the rest of C90 issues in defining local variables in middle of code and comparing uncompatible types

dev
Ahmed Abdellah 2019-10-23 20:22:07 +01:00
parent 9a454e9724
commit 8cbe42fcb0
2 changed files with 4 additions and 5 deletions

View File

@ -283,7 +283,7 @@ UTIL_createFileNamesTable_fromFileName(const char* inputFileName) {
UTIL_DISPLAY("[TRACE] migration done\n"); 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){ if(pos > inputFileSize){
UTIL_freeFileNamesTable(filesTable); UTIL_freeFileNamesTable(filesTable);
if(buf) free(buf); if(buf) free(buf);
@ -330,7 +330,7 @@ UTIL_concatenateTwoTables(FileNamesTable* table1, FileNamesTable* table2) {
} }
size_t newTotalTableSize = getTotalTableSize(table1) + getTotalTableSize(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)); char* buf = (char*) malloc(newTotalTableSize * sizeof(char));
if(!buf) { if(!buf) {

View File

@ -808,9 +808,8 @@ int main(int argCount, const char* argv[])
if (longCommandWArg(&argument, "--file=")) { if (longCommandWArg(&argument, "--file=")) {
DISPLAYLEVEL(4, "[TRACE] argument catched\n"); DISPLAYLEVEL(4, "[TRACE] argument catched\n");
const char* fileName = argument;
DISPLAYLEVEL(4, "[TRACE] fileName: %s\n", 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); DISPLAYLEVEL(1, "[ERROR] wrong fileName: %s\n", argument);
CLEAN_RETURN(badusage(programName)); 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] call read function is finished\n");
DISPLAYLEVEL(4, "[TRACE] extendedFileNamesTable:\n"); DISPLAYLEVEL(4, "[TRACE] extendedFileNamesTable:\n");
unsigned i = 0; unsigned i;
for(i = 0; i < extendedTable->tableSize; ++i) for(i = 0; i < extendedTable->tableSize; ++i)
printf("%s\n",extendedTable->fileNames[i]); printf("%s\n",extendedTable->fileNames[i]);