From: Yannick Brosseau Date: Tue, 25 Jan 2011 15:27:41 +0000 (-0500) Subject: Fix warnings int the lttv/sync directory X-Git-Tag: v0.12.37~13 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=df64b31664467d7217fa08fcdee423577856b38a;p=lttv.git Fix warnings int the lttv/sync directory Mostly wrong usages of g_error Edit: Add comment around init to NULL for gcc. Signed-off-by: Yannick Brosseau Signed-off-by: Mathieu Desnoyers --- diff --git a/lttv/lttv/sync/event_analysis_chull.c b/lttv/lttv/sync/event_analysis_chull.c index 21f28893..d36022c9 100644 --- a/lttv/lttv/sync/event_analysis_chull.c +++ b/lttv/lttv/sync/event_analysis_chull.c @@ -240,7 +240,7 @@ static void openGraphFiles(SyncState* const syncState) if ((analysisData->graphsData->hullPoints[i][j]= fopen(name, "w")) == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } @@ -249,7 +249,7 @@ static void openGraphFiles(SyncState* const syncState) retval= chdir(cwd); if (retval == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } free(cwd); } @@ -329,7 +329,7 @@ static void closeGraphFiles(SyncState* const syncState) retval= fclose(analysisData->graphsData->hullPoints[i][j]); if (retval != 0) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } diff --git a/lttv/lttv/sync/event_analysis_eval.c b/lttv/lttv/sync/event_analysis_eval.c index 8632b6a6..8dbf5bb6 100644 --- a/lttv/lttv/sync/event_analysis_eval.c +++ b/lttv/lttv/sync/event_analysis_eval.c @@ -161,7 +161,7 @@ static void initAnalysisEval(SyncState* const syncState) rttStream= fopen(optionEvalRttFile.arg, "r"); if (rttStream == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } readRttInfo(analysisData->rttInfo, rttStream); @@ -169,7 +169,7 @@ static void initAnalysisEval(SyncState* const syncState) retval= fclose(rttStream); if (retval == EOF) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } @@ -274,14 +274,14 @@ static AnalysisHistogramEval* constructAnalysisHistogramEval(const char* const if ((*(FILE**)((void*) histogram + loopValues[i].pointsOffset)= fopen(name, "w")) == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } retval= chdir(cwd); if (retval == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } free(cwd); @@ -314,7 +314,7 @@ static void destroyAnalysisHistogramEval(AnalysisHistogramEval* const retval= fclose(*(FILE**)((void*) histogram + loopValues[i].pointsOffset)); if (retval != 0) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } @@ -463,11 +463,11 @@ static void writeHistogram(FILE* graphsStream, const struct RttKey* rttKey, // Remove the ",\\\n" from the last graph plot line if (ftruncate(fileno(graphsStream), ftell(graphsStream) - 3) == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } if (fseek(graphsStream, 0, SEEK_END) == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } fprintf(graphsStream, "\n"); } @@ -550,7 +550,7 @@ static void analyzeMessageEval(SyncState* const syncState, Message* const message) { AnalysisDataEval* analysisData= syncState->analysisData; - MessageStats* messageStats; + MessageStats* messageStats = NULL; /* for gcc */ double* rtt; double tt; struct RttKey rttKey; @@ -1111,7 +1111,7 @@ static void readRttInfo(GHashTable* rttInfo, FILE* rttStream) if (retval == -1 && !feof(rttStream)) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } if (line[retval - 1] == '\n') @@ -1124,7 +1124,7 @@ static void readRttInfo(GHashTable* rttInfo, FILE* rttStream) &tmp); if (retval == EOF) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } else if (retval != 3) { @@ -1187,7 +1187,7 @@ static void positionStream(FILE* stream) } else { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } diff --git a/lttv/lttv/sync/event_matching_broadcast.c b/lttv/lttv/sync/event_matching_broadcast.c index 9c83d9c6..4c66d181 100644 --- a/lttv/lttv/sync/event_matching_broadcast.c +++ b/lttv/lttv/sync/event_matching_broadcast.c @@ -382,7 +382,7 @@ static void openGraphDataFiles(SyncState* const syncState) g_assert_cmpint(retval, <=, sizeof(name) - 1); if ((graphs->accuracyPoints[i][j]= fopen(name, "w")) == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } @@ -390,7 +390,7 @@ static void openGraphDataFiles(SyncState* const syncState) retval= chdir(cwd); if (retval == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } free(cwd); } @@ -460,7 +460,7 @@ static void closeGraphDataFiles(SyncState* const syncState) retval= fclose(graphs->accuracyPoints[i][j]); if (retval != 0) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } free(graphs->accuracyPoints[i]); diff --git a/lttv/lttv/sync/event_matching_tcp.c b/lttv/lttv/sync/event_matching_tcp.c index 90d6c43c..2d4fe518 100644 --- a/lttv/lttv/sync/event_matching_tcp.c +++ b/lttv/lttv/sync/event_matching_tcp.c @@ -604,7 +604,7 @@ static void openGraphDataFiles(SyncState* const syncState) if ((matchingData->messagePoints[i][j]= fopen(name, "w")) == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } @@ -613,7 +613,7 @@ static void openGraphDataFiles(SyncState* const syncState) retval= chdir(cwd); if (retval == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } free(cwd); } @@ -676,7 +676,7 @@ static void closeGraphDataFiles(SyncState* const syncState) retval= fclose(matchingData->messagePoints[i][j]); if (retval != 0) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } } diff --git a/lttv/lttv/sync/graph_functions.c b/lttv/lttv/sync/graph_functions.c index c347b249..91feef0c 100644 --- a/lttv/lttv/sync/graph_functions.c +++ b/lttv/lttv/sync/graph_functions.c @@ -55,11 +55,11 @@ FILE* createGraphsDir(const char* const graphsDir) S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH)) == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } if ((result= fdopen(graphsFp, "w")) == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } fprintf(result, @@ -69,7 +69,7 @@ FILE* createGraphsDir(const char* const graphsDir) retval= chdir(cwd); if (retval == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } free(cwd); @@ -95,7 +95,7 @@ char* changeToGraphsDir(const char* const graphsDir) cwd= getcwd(NULL, 0); if (cwd == NULL) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } while ((retval= chdir(graphsDir)) != 0) { @@ -105,12 +105,12 @@ char* changeToGraphsDir(const char* const graphsDir) S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH); if (retval != 0) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } else { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } } @@ -233,11 +233,11 @@ void writeGraphsScript(SyncState* const syncState) if (ftruncate(fileno(syncState->graphsStream), trunc) == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } if (fseek(syncState->graphsStream, 0, SEEK_END) == -1) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } fprintf(syncState->graphsStream, diff --git a/lttv/lttv/sync/sync_chain_lttv.c b/lttv/lttv/sync/sync_chain_lttv.c index 95bef441..bb49bbd2 100644 --- a/lttv/lttv/sync/sync_chain_lttv.c +++ b/lttv/lttv/sync/sync_chain_lttv.c @@ -388,7 +388,7 @@ bool syncTraceset(LttvTracesetContext* const traceSetContext) if (fclose(syncState->graphsStream) != 0) { - g_error(strerror(errno)); + g_error("%s", strerror(errno)); } }