From 7e121f35bfa4d76e5b8104a8f13eb0db5b421fb7 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 8 Jul 2010 18:02:07 +0000 Subject: [PATCH] - fix gcc 4 compiler warnings svn path=/trunk/boinc/; revision=21882 --- checkin_notes | 11 +++++++++++ sched/file_deleter.cpp | 3 ++- sched/sched_locality.cpp | 2 +- sched/sched_send.cpp | 4 +++- sched/single_job_assimilator.cpp | 6 +++++- tools/backend_lib.cpp | 16 +++++++++------- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/checkin_notes b/checkin_notes index 84f74ff6d3d..dffa50aa4ce 100644 --- a/checkin_notes +++ b/checkin_notes @@ -4962,3 +4962,14 @@ Charlie 8 Jul 2010 NoticeListCtrl.cpp, .h mac/ MacAccessiblity.cpp + +David 8 Jul 2010 + - fix gcc 4 compiler warnings + + sched/ + file_deleter.cpp + single_job_assimilator.cpp + sched_locality.cpp + sched_send.cpp + tools/ + backend_lib.cpp diff --git a/sched/file_deleter.cpp b/sched/file_deleter.cpp index 45b22bb0479..969903167bb 100644 --- a/sched/file_deleter.cpp +++ b/sched/file_deleter.cpp @@ -421,7 +421,8 @@ int delete_antique_files() { int nfiles=0; log_messages.printf(MSG_DEBUG, - "delete_antique_files(): start (%d files)\n", files_to_delete.size() + "delete_antique_files(): start (%d files)\n", + (int)files_to_delete.size() ); while (!files_to_delete.empty()) { char timestamp[128]; diff --git a/sched/sched_locality.cpp b/sched/sched_locality.cpp index d661281dbbc..b55bb4cf2f5 100644 --- a/sched/sched_locality.cpp +++ b/sched/sched_locality.cpp @@ -440,7 +440,7 @@ static void build_working_set_namelist(bool slowhost) { if (config.debug_locality) { log_messages.printf(MSG_NORMAL, "[locality] build_working_set_namelist(%s): pattern %s has %d matches\n", - hosttype, pattern, filesets.items.size() + hosttype, pattern, (int)filesets.items.size() ); } return; diff --git a/sched/sched_send.cpp b/sched/sched_send.cpp index 46abd8fb2af..34e6e50f6a5 100644 --- a/sched/sched_send.cpp +++ b/sched/sched_send.cpp @@ -782,7 +782,9 @@ static int insert_after(char* buffer, const char* after, const char* text) { if (strlen(buffer) + strlen(text) > BLOB_SIZE-1) { log_messages.printf(MSG_CRITICAL, - "insert_after: overflow: %d %d\n", strlen(buffer), strlen(text) + "insert_after: overflow: %d %d\n", + (int)strlen(buffer), + (int)strlen(text) ); return ERR_BUFFER_OVERFLOW; } diff --git a/sched/single_job_assimilator.cpp b/sched/single_job_assimilator.cpp index e72465919ff..605a09da224 100644 --- a/sched/single_job_assimilator.cpp +++ b/sched/single_job_assimilator.cpp @@ -59,7 +59,11 @@ int assimilate_handler( log_messages.printf(MSG_CRITICAL, "Can't open job file %s\n", buf); return 0; } - fgets(buf, 1024, f); + if (!fgets(buf, 1024, f)) { + log_messages.printf(MSG_CRITICAL, "Can't read job file %s\n", buf); + fclose(f); + return 0; + } fclose(f); unlink(job_dir_file); diff --git a/tools/backend_lib.cpp b/tools/backend_lib.cpp index cbe839bc3b2..20249f57615 100644 --- a/tools/backend_lib.cpp +++ b/tools/backend_lib.cpp @@ -377,7 +377,7 @@ static int process_wu_template( if (out.size() > sizeof(wu.xml_doc)-1) { fprintf(stderr, "create_work: WU XML field is too long (%d bytes; max is %d)\n", - out.size(), sizeof(wu.xml_doc)-1 + (int)out.size(), (int)sizeof(wu.xml_doc)-1 ); return ERR_BUFFER_OVERFLOW; } @@ -483,7 +483,7 @@ int create_result( if (strlen(result_template) > sizeof(result.xml_doc_in)-1) { fprintf(stderr, "result XML doc is too long: %d bytes, max is %d\n", - strlen(result_template), sizeof(result.xml_doc_in)-1 + (int)strlen(result_template), (int)sizeof(result.xml_doc_in)-1 ); return ERR_BUFFER_OVERFLOW; } @@ -514,9 +514,9 @@ int check_files(char** infiles, int ninfiles, SCHED_CONFIG& config_loc) { dir_hier_path( infiles[i], config_loc.download_dir, config_loc.uldl_dir_fanout, path ); - if (!boinc_file_exists(path)) { - return 1; - } + if (!boinc_file_exists(path)) { + return 1; + } } return 0; @@ -564,8 +564,10 @@ int create_work( } if (strlen(result_template_filename) > sizeof(wu.result_template_file)-1) { - fprintf(stderr, "result template filename is too big: %d bytes, max is %d\n", - strlen(result_template_filename), sizeof(wu.result_template_file)-1 + fprintf(stderr, + "result template filename is too big: %d bytes, max is %d\n", + (int)strlen(result_template_filename), + (int)sizeof(wu.result_template_file)-1 ); return ERR_BUFFER_OVERFLOW; }