diff --git a/api/x_opengl.C b/api/x_opengl.C index bc778b4dce..2314e9c4e5 100644 --- a/api/x_opengl.C +++ b/api/x_opengl.C @@ -69,17 +69,17 @@ int xwin_glut_is_initialized() { return glut_is_initialized; } -void app_debug_msg (char *fmt, ...); +void app_debug_msg (const char *fmt, ...); // This callback is invoked when a user presses a key. // -void keyboardD(unsigned char key, int x, int y) { +void keyboardD(unsigned char /*key*/, int /*x*/, int /*y*/) { if (current_graphics_mode == MODE_FULLSCREEN) { set_mode(MODE_HIDE_GRAPHICS); } } -void keyboardU(unsigned char key, int x, int y) { +void keyboardU(unsigned char /*key*/, int /*x*/, int /*y*/) { if (current_graphics_mode == MODE_FULLSCREEN) { set_mode(MODE_HIDE_GRAPHICS); } @@ -159,10 +159,10 @@ static void make_new_window(int mode) { // this should only called once, even if restarted by user-exit // static void boinc_glut_init() { - char* args[2] = {"screensaver", NULL}; + const char* args[2] = {"screensaver", NULL}; int one=1; app_debug_msg("Calling glutInit()... \n"); - glutInit (&one, args); + glutInit (&one, (char**)args); app_debug_msg("...survived glutInit(). \n"); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); @@ -225,7 +225,6 @@ static void timer_handler(int) { char buf[MSG_CHANNEL_SIZE]; GRAPHICS_MSG m; - int new_mode; if (*g_bmsp->app_client_shmp) { if ((*g_bmsp->app_client_shmp)->shm->graphics_request.get_msg(buf)) { (*g_bmsp->app_client_shmp)->decode_graphics_msg(buf, m); @@ -301,7 +300,7 @@ void restart() { // into xwin_graphics_event_loop. If we are in the main thread, then // restore the old signal handler and raise SIGABORT. // -void restart_sig(int signal_number) { +void restart_sig(int /*signal_number*/) { if (pthread_equal(pthread_self(), graphics_thread)) { // alternative approach is for the signal hander to call exit(). fprintf(stderr, "Caught SIGABRT in graphics thread\n"); @@ -401,7 +400,7 @@ void xwin_graphics_event_loop() { -void app_debug_msg (char *fmt, ...) { +void app_debug_msg (const char* /*fmt*/, ...) { #ifndef _DEBUG return; #else diff --git a/checkin_notes b/checkin_notes index b8b7841cfb..1710af3260 100755 --- a/checkin_notes +++ b/checkin_notes @@ -24879,3 +24879,32 @@ David 16 Feb 2005 html/user/ account_setup_first_done.php team_display.php + +David 16 Feb 2005 + - Giant checkin to remove warnings when compiled with + all known warnings enabled. + This consisted of: + 1) string literals ("foo") are type const char*, + so any variables or args that you assign them to + must be const char* + 2) shadowed variables + 3) unused params (removed or commented out) + 4) a couple of printf format/var mismatches + (nothing that would cause a problem at this point) + + api/ + x_opengl.C + client/ + (most .C, .h) + clientgui/ + (most .C, .h) + res/ + *.xpm + db/ + (most .C, .h) + lib/ + (most .C, .h) + sched/ + (most .C, .h) + tools/ + (most .C, .h) diff --git a/client/acct_mgr.C b/client/acct_mgr.C index be041938ff..b082aed719 100644 --- a/client/acct_mgr.C +++ b/client/acct_mgr.C @@ -118,7 +118,8 @@ void ACCT_MGR::handle_reply() { if (pp) { if (strcmp(pp->authenticator, acct.authenticator.c_str())) { msg_printf(NULL, MSG_ERROR, - "You're attached to project %s with a different account" + "You're attached to project %s with a different account", + pp->get_project_name() ); } } else { diff --git a/client/app.C b/client/app.C index e90532cf98..fcda472e2b 100644 --- a/client/app.C +++ b/client/app.C @@ -460,7 +460,7 @@ int ACTIVE_TASK_SET::parse(MIOFILE& fin) { return 0; } -void MSG_QUEUE::msg_queue_send(char* msg, MSG_CHANNEL& channel) { +void MSG_QUEUE::msg_queue_send(const char* msg, MSG_CHANNEL& channel) { if (channel.send_msg(msg)) { //msg_printf(NULL, MSG_INFO, "sent %s to %s", msg, name); return; @@ -470,8 +470,8 @@ void MSG_QUEUE::msg_queue_send(char* msg, MSG_CHANNEL& channel) { void MSG_QUEUE::msg_queue_poll(MSG_CHANNEL& channel) { if (msgs.size() > 0) { - if (channel.send_msg((char*)(msgs[0].c_str()))) { - //msg_printf(NULL, MSG_INFO, "sent %s to %s (delayed)", (char*)(msgs[0].c_str()), name); + if (channel.send_msg(msgs[0].c_str())) { + //msg_printf(NULL, MSG_INFO, "sent %s to %s (delayed)", (msgs[0].c_str()), name); msgs.erase(msgs.begin()); } } diff --git a/client/app.h b/client/app.h index 68b3f2e661..09dcd6b996 100644 --- a/client/app.h +++ b/client/app.h @@ -152,7 +152,7 @@ public: int kill_task(); // send a SIGKILL signal or equivalent int suspend(); // send a SIGSTOP signal or equivalent int unsuspend(); // send a SIGCONT signal or equivalent - int abort_task(char*); // flag as abort pending and send kill signal + int abort_task(const char*); // flag as abort pending and send kill signal bool has_task_exited(); // return true if this task has exited int preempt(bool quit_task); // preempt (via suspend or quit) a running task int resume_or_start(); diff --git a/client/app_control.C b/client/app_control.C index 47f2b2e281..9ba583fdd3 100644 --- a/client/app_control.C +++ b/client/app_control.C @@ -535,7 +535,7 @@ bool ACTIVE_TASK_SET::check_rsc_limits_exceeded() { // If process is running, send it a kill signal // This is done when app has exceeded CPU, disk, or mem limits // -int ACTIVE_TASK::abort_task(char* msg) { +int ACTIVE_TASK::abort_task(const char* msg) { if (task_state == PROCESS_EXECUTING || task_state == PROCESS_SUSPENDED) { task_state = PROCESS_ABORT_PENDING; kill_task(); diff --git a/client/app_graphics.C b/client/app_graphics.C index 0a5828092f..3656a61a42 100644 --- a/client/app_graphics.C +++ b/client/app_graphics.C @@ -129,7 +129,6 @@ void ACTIVE_TASK_SET::hide_apps() { void ACTIVE_TASK_SET::restore_apps() { unsigned int i; ACTIVE_TASK* atp; - GRAPHICS_MSG gm; for (i=0; iproject->user_name); safe_strcpy(aid.team_name, wup->project->team_name); if (wup->project->project_specific_prefs.length()) { - aid.project_preferences = (char*)wup->project->project_specific_prefs.c_str(); + aid.project_preferences = strdup(wup->project->project_specific_prefs.c_str()); } get_project_dir(wup->project, project_dir); relative_to_absolute(project_dir, project_path); @@ -267,7 +267,7 @@ int ACTIVE_TASK::start(bool first_time) { // strcpy(exec_name, ""); for (i=0; iapp_files.size(); i++) { - FILE_REF fref = app_version->app_files[i]; + fref = app_version->app_files[i]; fip = fref.file_info; get_pathname(fip, file_path); if (fref.main_program) { @@ -447,7 +447,7 @@ int ACTIVE_TASK::start(bool first_time) { // Postcondition: "state" is set correctly // int ACTIVE_TASK::resume_or_start() { - char* str = "??"; + const char* str = "??"; int retval; switch (task_state) { diff --git a/client/client_msgs.C b/client/client_msgs.C index e25dedcfa3..3be8fce8df 100644 --- a/client/client_msgs.C +++ b/client/client_msgs.C @@ -78,16 +78,12 @@ deque message_descs; // and passes it to show_message // TODO: add translation functionality // -void msg_printf(PROJECT *p, int priority, char *fmt, ...) { +void msg_printf(PROJECT *p, int priority, const char *fmt, ...) { char buf[8192]; // output can be much longer than format va_list ap; if (fmt == NULL) return; - // Since Windows doesn't support vsnprintf, we have to do a - // workaround to prevent buffer overruns - // - if (strlen(fmt) > 512) fmt[511] = '\0'; va_start(ap, fmt); // Parses string for variables vsprintf(buf, fmt, ap); // And convert symbols To actual numbers va_end(ap); // Results are stored in text diff --git a/client/client_msgs.h b/client/client_msgs.h index 10b3edd082..51198f3eb9 100644 --- a/client/client_msgs.h +++ b/client/client_msgs.h @@ -88,6 +88,6 @@ public: extern CLIENT_MSG_LOG log_messages; -extern void msg_printf(PROJECT *p, int priority, char *fmt, ...) __attribute__ ((format (printf, 3, 4))); +extern void msg_printf(PROJECT *p, int priority, const char *fmt, ...) __attribute__ ((format (printf, 3, 4))); #endif diff --git a/client/client_state.h b/client/client_state.h index c1dc15a3f0..98ead16cb1 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -129,7 +129,7 @@ private: bool client_state_dirty; int old_major_version; int old_minor_version; - char* platform_name; + const char* platform_name; bool skip_cpu_benchmarks; // if set, use hardwired numbers rather than running benchmarks bool run_cpu_benchmarks; @@ -279,7 +279,7 @@ private: // --------------- cs_statefile.C: public: - void set_client_state_dirty(char*); + void set_client_state_dirty(const char*); int parse_state_file(); int write_state(MIOFILE&); int write_state_file(); diff --git a/client/cs_account.C b/client/cs_account.C index 032a9a65c7..a81aa3ef3d 100644 --- a/client/cs_account.C +++ b/client/cs_account.C @@ -201,7 +201,7 @@ int CLIENT_STATE::parse_account_files() { DirScanner dir("."); while (dir.scan(name)) { - if (is_account_file((char*)name.c_str())) { + if (is_account_file(name.c_str())) { f = fopen(name.c_str(), "r"); if (!f) continue; project = new PROJECT; diff --git a/client/cs_apps.C b/client/cs_apps.C index 9133fe2bc0..c3af149994 100644 --- a/client/cs_apps.C +++ b/client/cs_apps.C @@ -357,7 +357,7 @@ bool CLIENT_STATE::schedule_cpus(double now) { ACTIVE_TASK *atp; PROJECT *p; bool some_app_started = false, first; - double total_resource_share; + double local_total_resource_share; int retval, j; double min_debt=0; double vm_limit, elapsed_time; @@ -417,12 +417,12 @@ bool CLIENT_STATE::schedule_cpus(double now) { // compute total resource share among projects with runnable results // assign_results_to_projects(); // see which projects have work - total_resource_share = 0; + local_total_resource_share = 0; for (i=0; inon_cpu_intensive) continue; if (p->next_runnable_result) { - total_resource_share += projects[i]->resource_share; + local_total_resource_share += projects[i]->resource_share; } } @@ -439,7 +439,7 @@ bool CLIENT_STATE::schedule_cpus(double now) { p->anticipated_debt = 0; } else { p->debt += - (p->resource_share/total_resource_share) + (p->resource_share/local_total_resource_share) * cpu_sched_work_done_this_period - p->work_done_this_period; if (first) { @@ -535,9 +535,9 @@ bool CLIENT_STATE::schedule_cpus(double now) { } // debts and active_tasks can only change if some project had a runnable result - // (and thus if total_resource_share is positive) + // (and thus if local_total_resource_share is positive) // - if (total_resource_share > 0) { + if (local_total_resource_share > 0) { set_client_state_dirty("schedule_cpus"); return true; } else { diff --git a/client/cs_benchmark.C b/client/cs_benchmark.C index e006a5ae0f..fa95f0a562 100644 --- a/client/cs_benchmark.C +++ b/client/cs_benchmark.C @@ -108,7 +108,7 @@ static BENCHMARK_DESC* benchmark_descs=0; static bool benchmarks_running=false; // at least 1 benchmark thread running static double cpu_benchmarks_start; -char *file_names[2] = {"do_fp", "do_int"}; +const char *file_names[2] = {"do_fp", "do_int"}; static void remove_benchmark_file(int which) { boinc_delete_file(file_names[which]); diff --git a/client/cs_prefs.C b/client/cs_prefs.C index 3dfab02e61..37c70c8dc1 100644 --- a/client/cs_prefs.C +++ b/client/cs_prefs.C @@ -131,7 +131,7 @@ inline bool now_between_two_hours(int start_hour, int end_hour) { // See if (on the basis of user run request and prefs) // we should suspend activities. // -void CLIENT_STATE::check_suspend_activities(double now, int& reason) { +void CLIENT_STATE::check_suspend_activities(double /*now*/, int& reason) { reason = 0; // Don't work while we're running CPU benchmarks @@ -202,7 +202,7 @@ int CLIENT_STATE::resume_activities() { return 0; } -void CLIENT_STATE::check_suspend_network(double now, int& reason) { +void CLIENT_STATE::check_suspend_network(double /*now*/, int& reason) { reason = 0; if (user_network_request == USER_RUN_REQUEST_ALWAYS) return; diff --git a/client/cs_statefile.C b/client/cs_statefile.C index 41b8b344e9..125dc94808 100644 --- a/client/cs_statefile.C +++ b/client/cs_statefile.C @@ -28,7 +28,7 @@ #include "client_msgs.h" #include "client_state.h" -void CLIENT_STATE::set_client_state_dirty(char* source) { +void CLIENT_STATE::set_client_state_dirty(const char* source) { log_messages.printf(CLIENT_MSG_LOG::DEBUG_STATE, "set dirty: %s\n", source); client_state_dirty = true; } @@ -40,7 +40,7 @@ int CLIENT_STATE::parse_state_file() { PROJECT *project=NULL; int retval=0; int failnum; - char *fname; + const char *fname; SCOPE_MSG_LOG scope_messages(log_messages, CLIENT_MSG_LOG::DEBUG_STATE); diff --git a/client/file_names.C b/client/file_names.C index 51afb6f706..bd1f99befa 100644 --- a/client/file_names.C +++ b/client/file_names.C @@ -133,7 +133,7 @@ void get_account_filename(char* master_url, char* path) { sprintf(path, "account_%s.xml", buf); } -bool is_account_file(char* filename) { +bool is_account_file(const char* filename) { return (strstr(filename, "account_") == filename); } diff --git a/client/file_names.h b/client/file_names.h index 0b4216fc22..98680f7116 100644 --- a/client/file_names.h +++ b/client/file_names.h @@ -37,7 +37,7 @@ extern int make_project_dir(PROJECT&); extern int remove_project_dir(PROJECT&); extern int make_slot_dir(int); extern void get_account_filename(char* master_url, char* path); -extern bool is_account_file(char*); +extern bool is_account_file(const char*); extern void escape_project_url(char *in, char* out); extern int check_unique_instance(); extern void get_sched_request_filename(PROJECT&, char*); diff --git a/client/gui_rpc_server.C b/client/gui_rpc_server.C index 80cb46b3a7..0b7671ec9f 100644 --- a/client/gui_rpc_server.C +++ b/client/gui_rpc_server.C @@ -154,7 +154,7 @@ static void handle_result_show_graphics(char* buf, MIOFILE& fout) { } -static void handle_project_op(char* buf, MIOFILE& fout, char* op) { +static void handle_project_op(char* buf, MIOFILE& fout, const char* op) { PROJECT* p = get_project(buf, fout); if (!p) { fout.printf("no such project\n"); @@ -324,7 +324,8 @@ void handle_get_messages(char* buf, MIOFILE& fout) { // XXX // XXX // -static void handle_file_transfer_op(char* buf, MIOFILE& fout, char* op) { +// +static void handle_file_transfer_op(char* buf, MIOFILE& fout, const char* op) { string filename; PROJECT* p = get_project(buf, fout); @@ -361,7 +362,7 @@ static void handle_file_transfer_op(char* buf, MIOFILE& fout, char* op) { fout.printf("\n"); } -static void handle_result_op(char* buf, MIOFILE& fout, char* op) { +static void handle_result_op(char* buf, MIOFILE& fout, const char* op) { RESULT* rp; char result_name[256]; ACTIVE_TASK* atp; @@ -586,14 +587,14 @@ int GUI_RPC_CONN_SET::get_allowed_hosts() { ); // read in each line, if it is not a comment - // then resolve the address and add to our - // allowed list + // then resolve the address and add to our allowed list + // memset(buf,0,sizeof(buf)); while (fgets(buf, 256, f) != NULL) { strip_whitespace(buf); if (!(buf[0] =='#' || buf[0] == ';') && strlen(buf) > 0 ) { - // resolve and add - if (temp.get_ip_addr(buf, ipaddr) == 0) { + strcpy(temp.hostname, buf); + if (temp.get_ip_addr(ipaddr) == 0) { allowed_remote_ip_addresses.push_back((int)ntohl(ipaddr)); } } @@ -729,7 +730,7 @@ bool GUI_RPC_CONN_SET::poll(double) { show_connect_error(ia); boinc_close_socket(sock); } else { - GUI_RPC_CONN* gr = new GUI_RPC_CONN(sock); + gr = new GUI_RPC_CONN(sock); insert(gr); } } diff --git a/client/hostinfo_unix.C b/client/hostinfo_unix.C index c903849f44..7313974e2b 100644 --- a/client/hostinfo_unix.C +++ b/client/hostinfo_unix.C @@ -477,7 +477,7 @@ int HOST_INFO::get_host_info() { // returns true iff device was last accessed before t // or if an error occurred looking at the device. -inline bool device_idle(time_t t, char *device) { +inline bool device_idle(time_t t, const char *device) { struct stat sbuf; return stat(device, &sbuf) || (sbuf.st_atime < t); } diff --git a/client/http.C b/client/http.C index f51474d4f5..d29346830f 100644 --- a/client/http.C +++ b/client/http.C @@ -115,7 +115,7 @@ static void http_get_request_header( } static void http_get_request_header_proxy( - char* buf, char* host, int port, char* file, double offset, char* encstr + char* buf, char* host, int port, char* file, double offset, const char* encstr ) { char offset_info[256]; char user_agent_string[256]; @@ -155,7 +155,7 @@ static void http_head_request_header( } static void http_head_request_header_proxy( - char* buf, char* host, int port, char* file, char* encstr + char* buf, char* host, int port, char* file, const char* encstr ) { char user_agent_string[256]; get_user_agent_string(user_agent_string); @@ -191,7 +191,7 @@ static void http_post_request_header( } static void http_post_request_header_proxy( - char* buf, char* host, int port, char* file, int size, char* encstr + char* buf, char* host, int port, char* file, int size, const char* encstr ) { sprintf(buf, "POST %s HTTP/1.0\015\012" @@ -377,7 +377,7 @@ int HTTP_OP::init_head(const char* url) { strcat(id_passwd,pi.http_user_passwd); encstr = r_base64_encode(id_passwd,strlen(id_passwd)); http_head_request_header_proxy( - request_header, url_hostname, port, proxy_buf, (char*)encstr.c_str() + request_header, url_hostname, port, proxy_buf, encstr.c_str() ); } return 0; @@ -385,7 +385,7 @@ int HTTP_OP::init_head(const char* url) { // Initialize HTTP GET operation // -int HTTP_OP::init_get(const char* url, char* out, bool del_old_file, double off) { +int HTTP_OP::init_get(const char* url, const char* out, bool del_old_file, double off) { char proxy_buf[256]; if (del_old_file) { @@ -418,7 +418,7 @@ int HTTP_OP::init_get(const char* url, char* out, bool del_old_file, double off) encstr = r_base64_encode(id_passwd,strlen(id_passwd)); http_get_request_header_proxy( request_header, url_hostname, - port, proxy_buf, (int)file_offset, (char*)encstr.c_str() + port, proxy_buf, (int)file_offset, encstr.c_str() ); } return 0; @@ -426,7 +426,9 @@ int HTTP_OP::init_get(const char* url, char* out, bool del_old_file, double off) // Initialize HTTP POST operation // -int HTTP_OP::init_post(const char* url, char* in, char* out) { +int HTTP_OP::init_post( + const char* url, const char* in, const char* out +) { int retval; double size; char proxy_buf[256]; @@ -464,7 +466,7 @@ int HTTP_OP::init_post(const char* url, char* in, char* out) { encstr = r_base64_encode(id_passwd,strlen(id_passwd)); http_post_request_header_proxy( request_header, url_hostname, port, proxy_buf, content_length, - (char*)encstr.c_str() + encstr.c_str() ); } scope_messages.printf("HTTP_OP::init_post(): %p io_done %d\n", this, io_done); @@ -474,7 +476,7 @@ int HTTP_OP::init_post(const char* url, char* in, char* out) { // Initialize HTTP POST operation // int HTTP_OP::init_post2( - const char* url, char* r1, char* in, double offset + const char* url, char* r1, const char* in, double offset ) { int retval; double size; @@ -516,7 +518,7 @@ int HTTP_OP::init_post2( encstr = r_base64_encode(id_passwd,strlen(id_passwd)); http_post_request_header_proxy( request_header, url_hostname, port, proxy_buf, content_length, - (char*)encstr.c_str() + encstr.c_str() ); } return 0; diff --git a/client/http.h b/client/http.h index 3bde5d3476..d1b98bf246 100644 --- a/client/http.h +++ b/client/http.h @@ -82,12 +82,12 @@ public: //// bool proxy_auth_done; int init_head(const char* url); - int init_get(const char* url, char* outfile, bool del_old_file, double offset=0); - int init_post(const char* url, char* infile, char* outfile); + int init_get(const char* url, const char* outfile, bool del_old_file, double offset=0); + int init_post(const char* url, const char* infile, const char* outfile); int init_post2( const char* url, char* req1, // first part of request. ALSO USED FOR REPLY - char* infile, double offset // infile is NULL if no file sent + const char* infile, double offset // infile is NULL if no file sent ); bool http_op_done(); }; diff --git a/client/main.C b/client/main.C index cbf607ca91..97ff058688 100644 --- a/client/main.C +++ b/client/main.C @@ -75,7 +75,7 @@ void project_add_failed(PROJECT* project) { // Depending on the priority, the message may be more or less obtrusive // void show_message(PROJECT *p, char* msg, int priority) { - char* x; + const char* x; char message[1024]; time_t now = time(0); char* time_string = time_to_string(now); diff --git a/client/net_xfer.C b/client/net_xfer.C index a0c04b1449..66f8c71253 100644 --- a/client/net_xfer.C +++ b/client/net_xfer.C @@ -114,10 +114,6 @@ int get_socket_error(int fd) { } int NET_XFER::get_ip_addr(int &ip_addr) { - return get_ip_addr(hostname, ip_addr); -} - -int NET_XFER::get_ip_addr(char *hostname, int &ip_addr) { #ifdef WIN32 int retval; @@ -207,7 +203,7 @@ int NET_XFER::open_server() { sockaddr_in addr; int fd=0, ipaddr, retval=0; - retval = get_ip_addr(hostname, ipaddr); + retval = get_ip_addr(ipaddr); if (retval) return retval; fd = ::socket(AF_INET, SOCK_STREAM, 0); diff --git a/client/net_xfer.h b/client/net_xfer.h index 7d28b86dec..f36bb45a2d 100644 --- a/client/net_xfer.h +++ b/client/net_xfer.h @@ -37,9 +37,8 @@ // or being transferred to/from a file // class NET_XFER { - char hostname[256]; - // The host we're connecting to (possibly a proxy) public: + char hostname[256]; // The host we're connecting to (possibly a proxy) int socket; bool is_connected; bool want_download; // at most one should be true @@ -73,7 +72,6 @@ public: void init(char* host, int port, int blocksize); int get_ip_addr(int &ip_addr); - int get_ip_addr(char *hostname, int &ip_addr); int open_server(); void close_socket(); int do_xfer(int&); diff --git a/client/pers_file_xfer.C b/client/pers_file_xfer.C index 0724cf65a8..0b43f714bb 100644 --- a/client/pers_file_xfer.C +++ b/client/pers_file_xfer.C @@ -283,7 +283,7 @@ bool PERS_FILE_XFER::poll(double now) { // If there are more URLs to try, the file_xfer is restarted with these new // urls until a good transfer is made or it completely gives up. // -void PERS_FILE_XFER::check_giveup(char* why) { +void PERS_FILE_XFER::check_giveup(const char* why) { if (fip->get_next_url(fip->upload_when_present) == NULL) { // the file has no appropriate download location // remove the file from the directory and delete the file xfer object diff --git a/client/pers_file_xfer.h b/client/pers_file_xfer.h index 47536e4b20..814c4b5218 100644 --- a/client/pers_file_xfer.h +++ b/client/pers_file_xfer.h @@ -65,7 +65,7 @@ public: bool poll(double); void handle_xfer_failure(); void retry_or_backoff(); - void check_giveup(char*); + void check_giveup(const char*); void abort(); int write(MIOFILE& fout); int parse(MIOFILE& fin); diff --git a/client/proxy.C b/client/proxy.C index 84aa2db8f1..e2592585dc 100644 --- a/client/proxy.C +++ b/client/proxy.C @@ -91,9 +91,9 @@ PROXY::PROXY() { proxy_retval = 0; } -void PROXY::init(char *dst_host, int port) { +void PROXY::init(char *dst_host, int _port) { strcpy(dest_serv_name, dst_host); - dest_serv_port = port; + dest_serv_port = _port; proxy_state = PROXY_STATE_CONNECTING; } diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 0462be986f..42a578ef12 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -189,7 +189,7 @@ int SCHEDULER_OP::set_min_rpc_time(PROJECT* p) { // Back off contacting this project's schedulers, // and output an error msg if needed // -void SCHEDULER_OP::backoff(PROJECT* p, char *error_msg ) { +void SCHEDULER_OP::backoff(PROJECT* p, const char *error_msg ) { msg_printf(p, MSG_ERROR, error_msg); if (p->master_fetch_failures >= gstate.master_fetch_retry_cap) { @@ -319,15 +319,15 @@ int SCHEDULER_OP::parse_master_file(vector &urls) { // transfer scheduler urls to project. // Return true if any of them is new // -bool SCHEDULER_OP::update_urls(PROJECT& project, vector &urls) { +bool SCHEDULER_OP::update_urls(vector &urls) { unsigned int i, j; bool found, any_new; any_new = false; for (i=0; ischeduler_urls.size(); j++) { + if (!strcmp(urls[i].text, project->scheduler_urls[i].text)) { found = true; break; } @@ -335,9 +335,9 @@ bool SCHEDULER_OP::update_urls(PROJECT& project, vector &urls) { if (!found) any_new = true; } - project.scheduler_urls.clear(); + project->scheduler_urls.clear(); for (i=0; ischeduler_urls.push_back(urls[i]); } return any_new; @@ -386,7 +386,7 @@ bool SCHEDULER_OP::poll() { } else { // everything succeeded. Clear error counters // - changed = update_urls(*project, urls); + changed = update_urls(urls); if (changed) { project->min_rpc_time = 0; project->nrpc_failures = 0; diff --git a/client/scheduler_op.h b/client/scheduler_op.h index f4aa676bf4..ddfd96ac25 100644 --- a/client/scheduler_op.h +++ b/client/scheduler_op.h @@ -78,10 +78,10 @@ struct SCHEDULER_OP { int init_op_project(double ns); int init_master_fetch(PROJECT*); int set_min_rpc_time(PROJECT*); - bool update_urls(PROJECT& project, std::vector &urls); + bool update_urls(std::vector &urls); int start_op(PROJECT*); bool check_master_fetch_start(); - void backoff(PROJECT* p, char *error_msg); + void backoff(PROJECT* p, const char *error_msg); int start_rpc(); int parse_master_file(std::vector&); }; diff --git a/clientgui/BOINCBaseView.cpp b/clientgui/BOINCBaseView.cpp index 240d42e857..6981c5a346 100644 --- a/clientgui/BOINCBaseView.cpp +++ b/clientgui/BOINCBaseView.cpp @@ -101,7 +101,7 @@ wxString CBOINCBaseView::GetViewName() // The user friendly icon of the view. // If it has not been defined by the view the BOINC icon is returned. // -char** CBOINCBaseView::GetViewIcon() +const char** CBOINCBaseView::GetViewIcon() { wxASSERT(NULL != boinc_xpm); return boinc_xpm; diff --git a/clientgui/BOINCBaseView.h b/clientgui/BOINCBaseView.h index 0760282a29..9cac9a084e 100644 --- a/clientgui/BOINCBaseView.h +++ b/clientgui/BOINCBaseView.h @@ -50,7 +50,7 @@ public: ~CBOINCBaseView(); virtual wxString GetViewName(); - virtual char** GetViewIcon(); + virtual const char** GetViewIcon(); virtual wxInt32 GetListRowCount(); void FireOnListRender( wxTimerEvent& event ); diff --git a/clientgui/MainFrame.cpp b/clientgui/MainFrame.cpp index cb731a2da8..d5ba09c5c0 100644 --- a/clientgui/MainFrame.cpp +++ b/clientgui/MainFrame.cpp @@ -485,8 +485,8 @@ bool CMainFrame::RestoreState() wxInt32 iPageCount = 0; bool bWindowIconized = false; bool bWindowMaximized = false; - wxInt32 iTop = 0; - wxInt32 iLeft = 0; + //wxInt32 iTop = 0; + //wxInt32 iLeft = 0; wxInt32 iHeight = 0; wxInt32 iWidth = 0; diff --git a/clientgui/ViewMessages.cpp b/clientgui/ViewMessages.cpp index 1f3b0e6ffc..2daa8aed62 100644 --- a/clientgui/ViewMessages.cpp +++ b/clientgui/ViewMessages.cpp @@ -149,7 +149,7 @@ wxString CViewMessages::GetViewName() } -char** CViewMessages::GetViewIcon() +const char** CViewMessages::GetViewIcon() { return mess_xpm; } diff --git a/clientgui/ViewMessages.h b/clientgui/ViewMessages.h index 20d7f1e9b7..1d9f4a042b 100644 --- a/clientgui/ViewMessages.h +++ b/clientgui/ViewMessages.h @@ -39,7 +39,7 @@ public: ~CViewMessages(); virtual wxString GetViewName(); - virtual char** GetViewIcon(); + virtual const char** GetViewIcon(); protected: diff --git a/clientgui/ViewProjects.cpp b/clientgui/ViewProjects.cpp index 6e42d2157a..599315e252 100644 --- a/clientgui/ViewProjects.cpp +++ b/clientgui/ViewProjects.cpp @@ -309,7 +309,7 @@ wxString CViewProjects::GetViewName() } -char** CViewProjects::GetViewIcon() +const char** CViewProjects::GetViewIcon() { return proj_xpm; } diff --git a/clientgui/ViewProjects.h b/clientgui/ViewProjects.h index 287a2d5dec..d80050caf3 100644 --- a/clientgui/ViewProjects.h +++ b/clientgui/ViewProjects.h @@ -72,7 +72,7 @@ public: ~CViewProjects(); virtual wxString GetViewName(); - virtual char** GetViewIcon(); + virtual const char** GetViewIcon(); protected: diff --git a/clientgui/ViewResources.cpp b/clientgui/ViewResources.cpp index d92024ebd0..e61301e8fb 100644 --- a/clientgui/ViewResources.cpp +++ b/clientgui/ViewResources.cpp @@ -154,7 +154,7 @@ wxString CViewResources::GetViewName() } -char** CViewResources::GetViewIcon() +const char** CViewResources::GetViewIcon() { return usage_xpm; } diff --git a/clientgui/ViewResources.h b/clientgui/ViewResources.h index bbdfb76685..dfb8726d09 100644 --- a/clientgui/ViewResources.h +++ b/clientgui/ViewResources.h @@ -57,7 +57,7 @@ public: ~CViewResources(); virtual wxString GetViewName(); - virtual char** GetViewIcon(); + virtual const char** GetViewIcon(); protected: diff --git a/clientgui/ViewTransfers.cpp b/clientgui/ViewTransfers.cpp index ee3f0d3088..d0c9be2828 100644 --- a/clientgui/ViewTransfers.cpp +++ b/clientgui/ViewTransfers.cpp @@ -256,7 +256,7 @@ wxString CViewTransfers::GetViewName() } -char** CViewTransfers::GetViewIcon() +const char** CViewTransfers::GetViewIcon() { return xfer_xpm; } diff --git a/clientgui/ViewTransfers.h b/clientgui/ViewTransfers.h index 1473c8e10b..a98780bc2f 100644 --- a/clientgui/ViewTransfers.h +++ b/clientgui/ViewTransfers.h @@ -72,7 +72,7 @@ public: ~CViewTransfers(); virtual wxString GetViewName(); - virtual char** GetViewIcon(); + virtual const char** GetViewIcon(); protected: diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index 618486a263..9ec6eef586 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -283,7 +283,7 @@ wxString CViewWork::GetViewName() } -char** CViewWork::GetViewIcon() +const char** CViewWork::GetViewIcon() { return result_xpm; } diff --git a/clientgui/ViewWork.h b/clientgui/ViewWork.h index b82cadbc0c..2b48f09e59 100644 --- a/clientgui/ViewWork.h +++ b/clientgui/ViewWork.h @@ -75,7 +75,7 @@ public: ~CViewWork(); virtual wxString GetViewName(); - virtual char** GetViewIcon(); + virtual const char** GetViewIcon(); protected: diff --git a/clientgui/res/BOINCGUIApp.xpm b/clientgui/res/BOINCGUIApp.xpm index 7a02ff7908..98e1aee977 100644 --- a/clientgui/res/BOINCGUIApp.xpm +++ b/clientgui/res/BOINCGUIApp.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *APP_ICON_xpm[] = { +static const char *APP_ICON_xpm[] = { "16 16 32 1", " c None", ". c #000066", diff --git a/clientgui/res/boinc.xpm b/clientgui/res/boinc.xpm index e966e21d9b..9706dd9374 100644 --- a/clientgui/res/boinc.xpm +++ b/clientgui/res/boinc.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *boinc_xpm[] = { +static const char *boinc_xpm[] = { "16 16 32 1", " c None", ". c #000066", diff --git a/clientgui/res/boincsm.xpm b/clientgui/res/boincsm.xpm index 64f9b9c5fa..4f1e93196e 100644 --- a/clientgui/res/boincsm.xpm +++ b/clientgui/res/boincsm.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *boincsm_xpm[] = { +static const char *boincsm_xpm[] = { "50 50 84 1", " c None", ". c #94B5D6", diff --git a/clientgui/res/mess.xpm b/clientgui/res/mess.xpm index 9de86e251a..68701854bc 100644 --- a/clientgui/res/mess.xpm +++ b/clientgui/res/mess.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *mess_xpm[] = { +static const char *mess_xpm[] = { "16 16 3 1", " c #FF00FF", ". c #000000", diff --git a/clientgui/res/proj.xpm b/clientgui/res/proj.xpm index a0f681903f..a3aecb18ad 100644 --- a/clientgui/res/proj.xpm +++ b/clientgui/res/proj.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *proj_xpm[] = { +static const char *proj_xpm[] = { "16 16 4 1", " c #FF00FF", ". c #000000", diff --git a/clientgui/res/result.xpm b/clientgui/res/result.xpm index 1da0c658b8..da83cdc4d6 100644 --- a/clientgui/res/result.xpm +++ b/clientgui/res/result.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *result_xpm[] = { +static const char *result_xpm[] = { "16 16 3 1", " c #FF00FF", ". c #000000", diff --git a/clientgui/res/usage.xpm b/clientgui/res/usage.xpm index 094621e14d..5d0b55714e 100644 --- a/clientgui/res/usage.xpm +++ b/clientgui/res/usage.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *usage_xpm[] = { +static const char *usage_xpm[] = { "16 16 3 1", " c #FF00FF", ". c #000000", diff --git a/clientgui/res/xfer.xpm b/clientgui/res/xfer.xpm index a0e10c1cd3..da4aee4f9f 100644 --- a/clientgui/res/xfer.xpm +++ b/clientgui/res/xfer.xpm @@ -18,7 +18,7 @@ // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA /* XPM */ -static char *xfer_xpm[] = { +static const char *xfer_xpm[] = { "16 16 4 1", " c #FF00FF", ". c #000000", diff --git a/db/boinc_db.C b/db/boinc_db.C index 55deb832a3..0e1e692c33 100644 --- a/db/boinc_db.C +++ b/db/boinc_db.C @@ -1021,7 +1021,7 @@ void WORK_ITEM::parse(MYSQL_ROW& r) { strcpy2(wu.result_template_file, r[i++]); } -int DB_WORK_ITEM::enumerate(int limit, char* order_clause) { +int DB_WORK_ITEM::enumerate(int limit, const char* order_clause) { char query[MAX_QUERY_LEN]; int retval; MYSQL_ROW row; diff --git a/db/boinc_db.h b/db/boinc_db.h index 0845182055..6296ae3b09 100755 --- a/db/boinc_db.h +++ b/db/boinc_db.h @@ -117,7 +117,7 @@ struct APP_VERSION { int max_core_version; // if <>0, max core version this will run with bool deprecated; - int write(FILE*, APP&); + int write(FILE*); void clear(); }; @@ -633,7 +633,7 @@ class DB_WORK_ITEM : public WORK_ITEM, public DB_BASE_SPECIAL { public: DB_WORK_ITEM(DB_CONN* p=0); // CURSOR cursor; - int enumerate(int limit, char* order_clause); + int enumerate(int limit, const char* order_clause); // used by feeder int read_result(); // used by scheduler to read result server state diff --git a/db/db_base.C b/db/db_base.C index 0876b46159..131f5549b0 100644 --- a/db/db_base.C +++ b/db/db_base.C @@ -50,7 +50,7 @@ void DB_CONN::close() { if (mysql) mysql_close(mysql); } -int DB_CONN::do_query(char* p) { +int DB_CONN::do_query(const char* p) { int retval; #ifdef SHOW_QUERIES fprintf(stderr, "query: %s\n", p); @@ -75,7 +75,7 @@ int DB_CONN::insert_id() { return atoi(row[0]); } -void DB_CONN::print_error(char* p) { +void DB_CONN::print_error(const char* p) { fprintf(stderr, "%s: Database error: %s\n", p, error_string()); } @@ -91,7 +91,7 @@ int DB_CONN::commit_transaction() { return do_query("COMMIT"); } -DB_BASE::DB_BASE(char *tn, DB_CONN* p) : db(p), table_name(tn) { +DB_BASE::DB_BASE(const char *tn, DB_CONN* p) : db(p), table_name(tn) { is_high_priority = false; } @@ -110,7 +110,7 @@ int DB_BASE::insert() { int DB_BASE::insert_batch(std::string& values) { std::string query; query = "insert into " + std::string(table_name) + " values " + values; - return db->do_query((char*)query.c_str()); + return db->do_query(query.c_str()); } // update an entire record @@ -125,7 +125,7 @@ int DB_BASE::update() { // update one or more fields // "clause" is something like "foo=5, blah='xxx'" or "foo=foo+5" // -int DB_BASE::update_field(char* clause) { +int DB_BASE::update_field(const char* clause) { char query[MAX_QUERY_LEN]; sprintf(query, "update %s set %s where id=%d", table_name, clause, get_id()); return db->do_query(query); @@ -140,7 +140,7 @@ int DB_BASE::delete_from_db() { return db->do_query(query); } -int DB_BASE::get_field_int(char* field, int& val) { +int DB_BASE::get_field_int(const char* field, int& val) { char query[MAX_QUERY_LEN]; int retval; MYSQL_ROW row; @@ -158,7 +158,7 @@ int DB_BASE::get_field_int(char* field, int& val) { return 0; } -int DB_BASE::lookup(char* clause) { +int DB_BASE::lookup(const char* clause) { char query[MAX_QUERY_LEN]; int retval; MYSQL_ROW row; @@ -206,7 +206,7 @@ int DB_BASE::lookup_id(int id) { return 0; } -int DB_BASE::enumerate(char* clause, bool use_use_result) { +int DB_BASE::enumerate(const char* clause, bool use_use_result) { int x; char query[MAX_QUERY_LEN]; MYSQL_ROW row; @@ -237,7 +237,7 @@ int DB_BASE::enumerate(char* clause, bool use_use_result) { if (!row) { mysql_free_result(cursor.rp); cursor.active = false; - int x = mysql_errno(db->mysql); + x = mysql_errno(db->mysql); if (x) return x; return ERR_DB_NOT_FOUND; } else { @@ -256,7 +256,7 @@ int DB_BASE::end_enumerate() { return 0; } -int DB_BASE::get_integer(char* query, int& n) { +int DB_BASE::get_integer(const char* query, int& n) { int retval; MYSQL_ROW row; MYSQL_RES* resp; @@ -273,7 +273,7 @@ int DB_BASE::get_integer(char* query, int& n) { return 0; } -int DB_BASE::get_double(char* query, double& x) { +int DB_BASE::get_double(const char* query, double& x) { int retval; MYSQL_ROW row; MYSQL_RES* resp; @@ -290,7 +290,7 @@ int DB_BASE::get_double(char* query, double& x) { return 0; } -int DB_BASE::count(int& n, char* clause) { +int DB_BASE::count(int& n, const char* clause) { char query[MAX_QUERY_LEN]; if (is_high_priority) { @@ -302,13 +302,13 @@ int DB_BASE::count(int& n, char* clause) { return get_integer(query, n); } -int DB_BASE::max_id(int& n, char* clause) { +int DB_BASE::max_id(int& n, const char* clause) { char query[MAX_QUERY_LEN]; sprintf(query, "select max(id) from %s %s", table_name, clause); return get_integer(query, n); } -int DB_BASE::sum(double& x, char* field, char* clause) { +int DB_BASE::sum(double& x, const char* field, const char* clause) { char query[MAX_QUERY_LEN]; if (is_high_priority) { diff --git a/db/db_base.h b/db/db_base.h index ecffcb88c0..30c7595801 100644 --- a/db/db_base.h +++ b/db/db_base.h @@ -38,7 +38,7 @@ inline float safe_atof(const char* s) { #define strcpy2(x, y) \ { \ - char* z = y; \ + const char* z = y; \ if (!z) { \ x[0]=0; \ } else { \ @@ -61,10 +61,10 @@ class DB_CONN { public: DB_CONN(); int open(char* name, char* host, char* user, char* passwd); - int do_query(char*); + int do_query(const char*); void close(); int insert_id(); - void print_error(char*); + void print_error(const char*); const char* error_string(); MYSQL* mysql; @@ -77,22 +77,22 @@ public: // class DB_BASE { public: - DB_BASE(char *table_name, DB_CONN*); + DB_BASE(const char *table_name, DB_CONN*); int insert(); int insert_batch(std::string&); int update(); - int update_field(char*); + int update_field(const char*); int delete_from_db(); - int get_field_int(char*, int&); + int get_field_int(const char*, int&); int lookup_id(int id); - int lookup(char*); - int enumerate(char* clause="", bool use_use_result=false); + int lookup(const char*); + int enumerate(const char* clause="", bool use_use_result=false); int end_enumerate(); - int count(int&, char* clause=""); - int max_id(int&, char* clause=""); - int sum(double&, char* field, char* clause=""); - int get_double(char* query, double&); - int get_integer(char* query, int&); + int count(int&, const char* clause=""); + int max_id(int&, const char* clause=""); + int sum(double&, const char* field, const char* clause=""); + int get_double(const char* query, double&); + int get_integer(const char* query, int&); bool is_high_priority; DB_CONN* db; diff --git a/lib/app_ipc.C b/lib/app_ipc.C index 61c6960b60..6589ab3ad0 100755 --- a/lib/app_ipc.C +++ b/lib/app_ipc.C @@ -36,7 +36,7 @@ using std::string; -char* xml_graphics_modes[NGRAPHICS_MSGS] = { +const char* xml_graphics_modes[NGRAPHICS_MSGS] = { "", "", "", @@ -50,6 +50,14 @@ GRAPHICS_MSG::GRAPHICS_MSG() { memset(this, 0, sizeof(GRAPHICS_MSG)); } +APP_INIT_DATA::APP_INIT_DATA() { + project_preferences = 0; +} + +APP_INIT_DATA::~APP_INIT_DATA() { + if (project_preferences) free(project_preferences); +} + int write_init_data_file(FILE* f, APP_INIT_DATA& ai) { string str1, str2; fprintf(f, "\n%d\n", ai.core_version); @@ -187,14 +195,14 @@ bool MSG_CHANNEL::has_msg() { return false; } -bool MSG_CHANNEL::send_msg(char *msg) { +bool MSG_CHANNEL::send_msg(const char *msg) { if (buf[0]) return false; safe_strncpy(buf+1, msg, MSG_CHANNEL_SIZE-1); buf[0] = 1; return true; } -void MSG_CHANNEL::send_msg_overwrite(char* msg) { +void MSG_CHANNEL::send_msg_overwrite(const char* msg) { safe_strncpy(buf+1, msg, MSG_CHANNEL_SIZE-1); buf[0] = 1; } diff --git a/lib/app_ipc.h b/lib/app_ipc.h index 4b6eb65f8b..38097665fa 100755 --- a/lib/app_ipc.h +++ b/lib/app_ipc.h @@ -54,9 +54,9 @@ struct MSG_CHANNEL { char buf[MSG_CHANNEL_SIZE]; bool get_msg(char*); // returns a message and clears pending flag bool has_msg(); - bool send_msg(char*); // if there is not a message in the segment, + bool send_msg(const char*); // if there is not a message in the segment, // writes specified message and sets pending flag - void send_msg_overwrite(char*); + void send_msg_overwrite(const char*); // write message, overwriting any msg already there }; @@ -101,7 +101,7 @@ struct SHARED_MEM { struct MSG_QUEUE { std::vector msgs; char name[256]; - void msg_queue_send(char*, MSG_CHANNEL& channel); + void msg_queue_send(const char*, MSG_CHANNEL& channel); void msg_queue_poll(MSG_CHANNEL& channel); }; @@ -186,6 +186,9 @@ struct APP_INIT_DATA { // fraction of the total. double fraction_done_start; double fraction_done_end; + + APP_INIT_DATA(); + ~APP_INIT_DATA(); }; struct GRAPHICS_INFO { @@ -210,7 +213,7 @@ int parse_graphics_file(FILE* f, GRAPHICS_INFO* gi); #define STDOUT_FILE "stdout.txt" #define LOCKFILE "boinc_lockfile" -extern char* xml_graphics_modes[NGRAPHICS_MSGS]; +extern const char* xml_graphics_modes[NGRAPHICS_MSGS]; int boinc_link(const char* existing, const char* new_link); #endif diff --git a/lib/boinc_cmd.C b/lib/boinc_cmd.C index ac9265343c..e60554394b 100644 --- a/lib/boinc_cmd.C +++ b/lib/boinc_cmd.C @@ -93,7 +93,6 @@ int main(int argc, char** argv) { MESSAGES messages; int retval; char* hostname=0; - PROJECT project; #ifdef _WIN32 WSADATA wsdata; diff --git a/lib/crypt.C b/lib/crypt.C index 3a4c9f6071..c84db8df13 100644 --- a/lib/crypt.C +++ b/lib/crypt.C @@ -113,7 +113,7 @@ int scan_hex_data(FILE* f, DATA_BLOCK& x) { // same, but read from buffer // -static int sscan_hex_data(char* p, DATA_BLOCK& x) { +static int sscan_hex_data(const char* p, DATA_BLOCK& x) { int m, n, nleft=x.len; x.len = 0; @@ -189,7 +189,7 @@ int scan_key_hex(FILE* f, KEY* key, int size) { // parse a text-encoded key from a memory buffer // -int sscan_key_hex(char* buf, KEY* key, int size) { +int sscan_key_hex(const char* buf, KEY* key, int size) { int n, retval,num_bits; DATA_BLOCK db; @@ -234,7 +234,7 @@ int decrypt_public(R_RSA_PUBLIC_KEY& key, DATA_BLOCK& in, DATA_BLOCK& out) { return RSAPublicDecrypt(out.data, &out.len, in.data, in.len, &key); } -int sign_file(char* path, R_RSA_PRIVATE_KEY& key, DATA_BLOCK& signature) { +int sign_file(const char* path, R_RSA_PRIVATE_KEY& key, DATA_BLOCK& signature) { char md5_buf[MD5_LEN]; double file_length; DATA_BLOCK in_block; @@ -266,7 +266,7 @@ int sign_block(DATA_BLOCK& data_block, R_RSA_PRIVATE_KEY& key, DATA_BLOCK& signa } int verify_file( - char* path, R_RSA_PUBLIC_KEY& key, DATA_BLOCK& signature, bool& answer + const char* path, R_RSA_PUBLIC_KEY& key, DATA_BLOCK& signature, bool& answer ) { char md5_buf[MD5_LEN], clear_buf[MD5_LEN]; double file_length; @@ -291,7 +291,7 @@ int verify_file( } int verify_file2( - char* path, char* signature_text, char* key_text, bool& answer + const char* path, const char* signature_text, const char* key_text, bool& answer ) { R_RSA_PUBLIC_KEY key; unsigned char signature_buf[SIGNATURE_SIZE_BINARY]; @@ -313,7 +313,7 @@ int verify_file2( // verify, where both text and signature are char strings // int verify_string( - char* text, char* signature_text, R_RSA_PUBLIC_KEY& key, bool& answer + const char* text, const char* signature_text, R_RSA_PUBLIC_KEY& key, bool& answer ) { char md5_buf[MD5_LEN]; unsigned char signature_buf[SIGNATURE_SIZE_BINARY]; @@ -321,7 +321,7 @@ int verify_string( int retval, n; DATA_BLOCK signature, clear_signature; - retval = md5_block((unsigned char*)text, strlen(text), md5_buf); + retval = md5_block((const unsigned char*)text, strlen(text), md5_buf); if (retval) return retval; n = strlen(md5_buf); signature.data = signature_buf; @@ -339,7 +339,7 @@ int verify_string( // Same, where public key is also encoded as text // int verify_string2( - char* text, char* signature_text, char* key_text, bool& answer + const char* text, const char* signature_text, const char* key_text, bool& answer ) { R_RSA_PUBLIC_KEY key; int retval; @@ -349,7 +349,7 @@ int verify_string2( return verify_string(text, signature_text, key, answer); } -int read_key_file(char* keyfile, R_RSA_PRIVATE_KEY& key) { +int read_key_file(const char* keyfile, R_RSA_PRIVATE_KEY& key) { int retval; FILE* fkey = fopen(keyfile, "r"); if (!fkey) { diff --git a/lib/crypt.h b/lib/crypt.h index 89046eb376..cb706d9c5b 100644 --- a/lib/crypt.h +++ b/lib/crypt.h @@ -52,18 +52,26 @@ int sprint_hex_data(char* p, DATA_BLOCK&); int scan_hex_data(FILE* f, DATA_BLOCK&); int print_key_hex(FILE*, KEY* key, int len); int scan_key_hex(FILE*, KEY* key, int len); -int sscan_key_hex(char*, KEY* key, int len); +int sscan_key_hex(const char*, KEY* key, int len); int encrypt_private( R_RSA_PRIVATE_KEY& key, DATA_BLOCK& in, DATA_BLOCK& out, int& ); int decrypt_public(R_RSA_PUBLIC_KEY& key, DATA_BLOCK& in, DATA_BLOCK& out); -int sign_file(char* path, R_RSA_PRIVATE_KEY&, DATA_BLOCK& signature); +int sign_file(const char* path, R_RSA_PRIVATE_KEY&, DATA_BLOCK& signature); int sign_block(DATA_BLOCK& data, R_RSA_PRIVATE_KEY&, DATA_BLOCK& signature); -int verify_file(char* path, R_RSA_PUBLIC_KEY&, DATA_BLOCK& signature, bool&); -int verify_file2(char* path, char* signature, char* key, bool&); -int verify_string(char* text, char* signature, R_RSA_PUBLIC_KEY&, bool&); -int verify_string2(char* text, char* signature, char* key, bool&); +int verify_file( + const char* path, R_RSA_PUBLIC_KEY&, DATA_BLOCK& signature, bool& +); +int verify_file2( + const char* path, const char* signature, const char* key, bool& +); +int verify_string( + const char* text, const char* signature, R_RSA_PUBLIC_KEY&, bool& +); +int verify_string2( + const char* text, const char* signature, const char* key, bool& +); -int read_key_file(char* keyfile, R_RSA_PRIVATE_KEY& key); +int read_key_file(const char* keyfile, R_RSA_PRIVATE_KEY& key); #endif diff --git a/lib/crypt_prog.C b/lib/crypt_prog.C index 715702e58f..fbe923cbb8 100644 --- a/lib/crypt_prog.C +++ b/lib/crypt_prog.C @@ -38,7 +38,7 @@ #include "crypt.h" -void die(char* p) { +void die(const char* p) { fprintf(stderr, "Error: %s\n", p); exit(1); } @@ -145,7 +145,8 @@ int main(int argc, char** argv) { if (!fpub) die("fopen"); retval = scan_key_hex(fpub, (KEY*)&public_key, sizeof(public_key)); if (retval) die("read_public_key"); - in.data = (unsigned char*) "foobar"; + strcpy((char*)buf2, "foobar"); + in.data = buf2; in.len = strlen((char*)in.data); out.data = buf; encrypt_private(private_key, in, out, n); diff --git a/lib/diagnostics.C b/lib/diagnostics.C index 7566e79ca1..915d4a6056 100644 --- a/lib/diagnostics.C +++ b/lib/diagnostics.C @@ -104,7 +104,9 @@ int boinc_install_signal_handlers() { // initialize the diagnostics environment. // -int diagnostics_init(int _flags, char* stdout_prefix, char* stderr_prefix) { +int diagnostics_init( + int _flags, const char* stdout_prefix, const char* stderr_prefix +) { flags = _flags; snprintf(stdout_log, sizeof(stdout_log), "%s.txt", stdout_prefix); diff --git a/lib/diagnostics.h b/lib/diagnostics.h index 4dfb07ecbe..854e651c9b 100644 --- a/lib/diagnostics.h +++ b/lib/diagnostics.h @@ -136,7 +136,9 @@ extern int boinc_init_diagnostics(int flags); extern int boinc_finish_diag(); extern int boinc_install_signal_handlers(); -extern int diagnostics_init(int flags, char* stdout_prefix, char* stderr_prefix); +extern int diagnostics_init( + int flags, const char* stdout_prefix, const char* stderr_prefix +); extern int diagnostics_cycle_logs(); #ifdef __cplusplus diff --git a/lib/filesys.C b/lib/filesys.C index ce411081de..2e50bebd41 100755 --- a/lib/filesys.C +++ b/lib/filesys.C @@ -471,7 +471,7 @@ typedef int HANDLE; #endif HANDLE app_lockfile_handle; -int lock_file(char* filename) { +int lock_file(const char* filename) { int retval=0; #ifdef _WIN32 app_lockfile_handle = CreateFile( @@ -517,7 +517,7 @@ int lock_file(char* filename) { return retval; } -void relative_to_absolute(char* relname, char* path) { +void relative_to_absolute(const char* relname, char* path) { #ifdef _WIN32 _getcwd(path, 256); #else diff --git a/lib/filesys.h b/lib/filesys.h index 013160b016..f3df4d50a0 100755 --- a/lib/filesys.h +++ b/lib/filesys.h @@ -65,8 +65,8 @@ extern "C" { extern int boinc_rename(const char* old, const char* newf); extern int boinc_mkdir(const char*); extern int boinc_rmdir(const char*); - extern int lock_file(char*); - extern void relative_to_absolute(char* relname, char* path); + extern int lock_file(const char*); + extern void relative_to_absolute(const char* relname, char* path); extern int boinc_make_dirs(char*, char*); extern char boinc_failed_file[256]; int is_dir(const char* path); diff --git a/lib/gui_rpc_client.C b/lib/gui_rpc_client.C index 808513385a..6bf6fad9dc 100644 --- a/lib/gui_rpc_client.C +++ b/lib/gui_rpc_client.C @@ -981,7 +981,7 @@ int RPC_CLIENT::init(const char* host) { return 0; } -int RPC_CLIENT::send_request(char* p) { +int RPC_CLIENT::send_request(const char* p) { char buf[4096]; sprintf(buf, "\n" @@ -1023,7 +1023,7 @@ RPC::~RPC() { if (mbuf) free(mbuf); } -int RPC::do_rpc(char* req) { +int RPC::do_rpc(const char* req) { int retval; if (rpc_client->sock == 0) return ERR_CONNECT; @@ -1222,8 +1222,9 @@ int RPC_CLIENT::show_graphics( return rpc.do_rpc(buf); } -int RPC_CLIENT::project_op(PROJECT& project, char* op) { - char buf[256], *tag; +int RPC_CLIENT::project_op(PROJECT& project, const char* op) { + char buf[256]; + const char *tag; RPC rpc(this); if (!strcmp(op, "reset")) { @@ -1268,8 +1269,8 @@ int RPC_CLIENT::project_attach(char* url, char* auth) { return rpc.do_rpc(buf); } -char* RPC_CLIENT::mode_name(int mode) { - char* p = NULL; +const char* RPC_CLIENT::mode_name(int mode) { + const char* p = NULL; switch (mode) { case RUN_MODE_ALWAYS: p=""; break; case RUN_MODE_NEVER: p=""; break; @@ -1448,8 +1449,9 @@ int RPC_CLIENT::get_messages(int seqno, MESSAGES& msgs) { return 0; } -int RPC_CLIENT::file_transfer_op(FILE_TRANSFER& ft, char* op) { - char buf[4096], *tag; +int RPC_CLIENT::file_transfer_op(FILE_TRANSFER& ft, const char* op) { + char buf[4096]; + const char *tag; RPC rpc(this); if (!strcmp(op, "retry")) { @@ -1472,8 +1474,9 @@ int RPC_CLIENT::file_transfer_op(FILE_TRANSFER& ft, char* op) { return rpc.do_rpc(buf); } -int RPC_CLIENT::result_op(RESULT& result, char* op) { - char buf[4096], *tag; +int RPC_CLIENT::result_op(RESULT& result, const char* op) { + char buf[4096]; + const char *tag; RPC rpc(this); if (!strcmp(op, "abort")) { diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index 323f3c2d8b..5a90682277 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -371,7 +371,7 @@ struct DISPLAY_INFO { class RPC_CLIENT { public: int sock; - int send_request(char*); + int send_request(const char*); int get_reply(char*&); public: @@ -389,7 +389,7 @@ public: const char* project, const char* result_name, bool full_screen, DISPLAY_INFO& ); - int project_op(PROJECT&, char* op); + int project_op(PROJECT&, const char* op); int project_attach(char* url, char* auth); int set_run_mode(int mode); int get_run_mode(int& mode); @@ -403,12 +403,12 @@ public: int set_proxy_settings(PROXY_INFO&); int get_proxy_settings(PROXY_INFO&); int get_messages(int seqno, MESSAGES&); - int file_transfer_op(FILE_TRANSFER&, char*); - int result_op(RESULT&, char*); + int file_transfer_op(FILE_TRANSFER&, const char*); + int result_op(RESULT&, const char*); int get_host_info(HOST_INFO&); int quit(); int acct_mgr_rpc(char* url, char* name, char* passwd); - char* mode_name(int mode); + const char* mode_name(int mode); }; struct RPC { @@ -418,5 +418,5 @@ struct RPC { RPC(RPC_CLIENT*); ~RPC(); - int do_rpc(char*); + int do_rpc(const char*); }; diff --git a/lib/language.C b/lib/language.C index 83c3cb3796..826492ffe5 100755 --- a/lib/language.C +++ b/lib/language.C @@ -40,7 +40,7 @@ LANGUAGE::~LANGUAGE() { language_file_contents = NULL; } -int LANGUAGE::read_language_file(char *file_name) { +int LANGUAGE::read_language_file(const char *file_name) { int retval; // TODO: put in a size limitation here? diff --git a/lib/language.h b/lib/language.h index 094cfaa2d1..75f97032e3 100755 --- a/lib/language.h +++ b/lib/language.h @@ -35,7 +35,7 @@ class LANGUAGE { public: LANGUAGE(); ~LANGUAGE(); - int read_language_file(char *); + int read_language_file(const char *); int get_translation(char *, char *, char *, int ); }; diff --git a/lib/parse.C b/lib/parse.C index d46462375e..548a8dcd28 100644 --- a/lib/parse.C +++ b/lib/parse.C @@ -226,7 +226,7 @@ int read_file_malloc(const char* pathname, char*& str) { // replace XML element contents (element must be present) // void replace_element_contents( - char* buf, char* start, char* end, char* replacement + char* buf, const char* start, const char* end, const char* replacement ) { char temp[4096], *p, *q; @@ -240,7 +240,7 @@ void replace_element_contents( // if the string contains a substring of the form X...Y, // remove the first such. -bool remove_element(char* buf, char* start, char* end) { +bool remove_element(char* buf, const char* start, const char* end) { char* p, *q; p = strstr(buf, start); if (!p) return false; @@ -252,7 +252,7 @@ bool remove_element(char* buf, char* start, char* end) { // replace a substring. Do at most one instance. // -bool str_replace(char* str, char* substr, char* replacement) { +bool str_replace(char* str, const char* substr, const char* replacement) { char temp[4096], *p; p = strstr(str, substr); diff --git a/lib/parse.h b/lib/parse.h index c699614f9a..943f52b218 100644 --- a/lib/parse.h +++ b/lib/parse.h @@ -41,10 +41,10 @@ extern int copy_element_contents(FILE* in, const char* end_tag, char* p, int len extern int copy_element_contents(FILE* in, const char* end_tag, std::string&); extern int read_file_malloc(const char* pathname, char*& str); extern void replace_element_contents( - char* buf, char* start, char* end, char* replacement + char* buf, const char* start, const char* end, const char* replacement ); -extern bool remove_element(char* buf, char* start, char* end); -extern bool str_replace(char* str, char* old, char* neww); +extern bool remove_element(char* buf, const char* start, const char* end); +extern bool str_replace(char* str, const char* old, const char* neww); extern char* sgets(char* buf, int len, char* &in); extern void xml_escape(std::string&, std::string&); extern void xml_escape(char*, std::string&); diff --git a/lib/prefs.C b/lib/prefs.C index 6f926b7602..4e1c3332c5 100644 --- a/lib/prefs.C +++ b/lib/prefs.C @@ -90,7 +90,7 @@ GLOBAL_PREFS::GLOBAL_PREFS() { // where X==host_venue, then parse that and ignore the rest. // Otherwise ignore elements. // -int GLOBAL_PREFS::parse(FILE* in, char* host_venue, bool& found_venue) { +int GLOBAL_PREFS::parse(FILE* in, const char* host_venue, bool& found_venue) { char buf[256], buf2[256]; bool in_venue = false, in_correct_venue=false; @@ -206,7 +206,7 @@ int GLOBAL_PREFS::parse(FILE* in, char* host_venue, bool& found_venue) { // Parse global prefs file // int GLOBAL_PREFS::parse_file( - char* filename, char* host_venue, bool& found_venue + const char* filename, const char* host_venue, bool& found_venue ) { FILE* f; int retval; diff --git a/lib/prefs.h b/lib/prefs.h index 29db75801c..9d9b729fa5 100644 --- a/lib/prefs.h +++ b/lib/prefs.h @@ -63,8 +63,8 @@ struct GLOBAL_PREFS { GLOBAL_PREFS(); void defaults(); void clear_bools(); - int parse(FILE*, char* venue, bool& found_venue); - int parse_file(char* filename, char* venue, bool& found_venue); + int parse(FILE*, const char* venue, bool& found_venue); + int parse_file(const char* filename, const char* venue, bool& found_venue); int write(FILE*); }; diff --git a/sched/assimilator_placeholder.C b/sched/assimilator_placeholder.C index 367721b007..8904d6c28a 100644 --- a/sched/assimilator_placeholder.C +++ b/sched/assimilator_placeholder.C @@ -36,7 +36,7 @@ using std::vector; using std::string; int assimilate_handler( - WORKUNIT& wu, vector& results, RESULT& canonical_result + WORKUNIT& wu, vector& /*results*/, RESULT& canonical_result ) { SCOPE_MSG_LOG scope_messages(log_messages, SCHED_MSG_LOG::NORMAL); scope_messages.printf("[%s] Assimilating\n", wu.name); diff --git a/sched/db_dump.C b/sched/db_dump.C index f967fcd05f..d706d6c1ca 100644 --- a/sched/db_dump.C +++ b/sched/db_dump.C @@ -79,8 +79,8 @@ using std::vector; #define TABLE_HOST 2 // must match the above -char* table_name[3] = {"user", "team", "host"}; -char* tag_name[3] = {"users", "teams", "hosts"}; +const char* table_name[3] = {"user", "team", "host"}; +const char* tag_name[3] = {"users", "teams", "hosts"}; struct OUTPUT { int recs_per_file; @@ -366,7 +366,7 @@ void write_host(HOST& host, FILE* f, bool detail) { ); } -void write_user(USER& user, FILE* f, bool detail) { +void write_user(USER& user, FILE* f, bool /*detail*/) { char buf[1024]; char cpid[MD5_LEN]; diff --git a/sched/db_purge.C b/sched/db_purge.C index 69c90e9af1..a598ed22b2 100644 --- a/sched/db_purge.C +++ b/sched/db_purge.C @@ -105,7 +105,7 @@ int max_number_workunits_to_purge=0; #define COMPRESSION_ZIP 2 // subscripts MUST be in agreement with defines above -char *suffix[3]={"", ".gz", ".zip"}; +const char *suffix[3]={"", ".gz", ".zip"}; // default is no compression int compression_type=COMPRESSION_NONE; @@ -128,7 +128,7 @@ bool time_to_quit() { // asked for compression, then we popen(2) a pipe to gzip or zip. // This does 'in place' compression. // -void open_archive(char* filename_prefix, FILE*& f){ +void open_archive(const char* filename_prefix, FILE*& f){ char path[256]; char command[512]; @@ -174,7 +174,7 @@ void open_archive(char* filename_prefix, FILE*& f){ return; } -void close_archive(char *filename, FILE*& fp){ +void close_archive(const char *filename, FILE*& fp){ char path[256]; // Set file pointer to NULL after closing file to indicate that it's closed. diff --git a/sched/feeder.C b/sched/feeder.C index 593e7ee056..dce1d26c1a 100644 --- a/sched/feeder.C +++ b/sched/feeder.C @@ -124,7 +124,7 @@ SCHED_CONFIG config; SCHED_SHMEM* ssp; key_t sema_key; -char* order_clause=""; +const char* order_clause=""; void cleanup_shmem() { detach_shmem((void*)ssp); @@ -195,7 +195,7 @@ static int remove_infeasible(int i) { static void scan_work_array( DB_WORK_ITEM& wi, - int& nadditions, int& ncollisions, int& ninfeasible, + int& nadditions, int& ncollisions, int& /*ninfeasible*/, bool& no_wus ) { int i, j, retval; diff --git a/sched/file_upload_handler.C b/sched/file_upload_handler.C index e4b3ac34a8..068df67576 100644 --- a/sched/file_upload_handler.C +++ b/sched/file_upload_handler.C @@ -114,7 +114,7 @@ int return_error(bool transient, const char* message, ...) { return 1; } -int return_success(char* text) { +int return_success(const char* text) { printf( "Content-type: text/plain\n\n" "\n" @@ -413,7 +413,7 @@ int get_key(R_RSA_PUBLIC_KEY& key) { return 0; } -void boinc_catch_signal(int x) { +void boinc_catch_signal(int ) { } void installer() { diff --git a/sched/handle_request.C b/sched/handle_request.C index d1f2eadb39..2be735f877 100644 --- a/sched/handle_request.C +++ b/sched/handle_request.C @@ -252,7 +252,7 @@ make_new_host: // somewhat arbitrary formula for credit as a function of CPU time. // Could also include terms for RAM size, network speed etc. // -static void compute_credit_rating(HOST& host, SCHEDULER_REQUEST& sreq) { +static void compute_credit_rating(HOST& host) { double cobblestone_factor = 100; host.credit_per_cpu_sec = (fabs(host.p_fpops)/1e9 + fabs(host.p_iops)/1e9) @@ -293,7 +293,7 @@ static int modify_host_struct(SCHEDULER_REQUEST& sreq, HOST& host) { host.n_bwdown = sreq.host.n_bwdown; host.fix_nans(); - compute_credit_rating(host, sreq); + compute_credit_rating(host); return 0; } @@ -474,7 +474,7 @@ int handle_results( reply.host.id, srip->id, srip->name, srip->hostid ); DB_HOST result_host; - int retval = result_host.lookup_id(srip->hostid); + retval = result_host.lookup_id(srip->hostid); if (retval) { log_messages.printf( @@ -799,7 +799,7 @@ void handle_msgs_from_host(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { } } -void handle_msgs_to_host(SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply) { +void handle_msgs_to_host(SCHEDULER_REPLY& reply) { DB_MSG_TO_HOST mth; char buf[256]; sprintf(buf, "where hostid = %d and handled = %d", reply.host.id, 0); @@ -987,7 +987,7 @@ void process_request( handle_msgs_from_host(sreq, reply); if (config.msg_to_host) { - handle_msgs_to_host(sreq, reply); + handle_msgs_to_host(reply); } update_host_record(reply.host, reply.user); diff --git a/sched/main.C b/sched/main.C index ddc32033db..30ca49566b 100644 --- a/sched/main.C +++ b/sched/main.C @@ -68,7 +68,7 @@ GUI_URLS gui_urls; key_t sema_key; int g_pid; -void send_message(char* msg, int delay) { +void send_message(const char* msg, int delay) { printf( "Content-type: text/plain\n\n" "\n" diff --git a/sched/main.h b/sched/main.h index 767296a368..0bbd94ba68 100644 --- a/sched/main.h +++ b/sched/main.h @@ -29,5 +29,5 @@ extern int g_pid; extern void lock_sema(); extern void unlock_sema(); -extern void send_message(char*, int); +extern void send_message(const char*, int); extern int open_database(); diff --git a/sched/sample_dummy_assimilator.C b/sched/sample_dummy_assimilator.C index 70bd625ba5..0a1ed24e86 100644 --- a/sched/sample_dummy_assimilator.C +++ b/sched/sample_dummy_assimilator.C @@ -31,7 +31,7 @@ using std::vector; using std::string; int assimilate_handler( - WORKUNIT& wu, vector& results, RESULT& canonical_result + WORKUNIT& wu, vector& /*results*/, RESULT& canonical_result ) { SCOPE_MSG_LOG scope_messages(log_messages, SCHED_MSG_LOG::NORMAL); scope_messages.printf("[%s] Assimilating\n", wu.name); diff --git a/sched/sample_trivial_validator.C b/sched/sample_trivial_validator.C index b4ed476d5b..b268a244de 100644 --- a/sched/sample_trivial_validator.C +++ b/sched/sample_trivial_validator.C @@ -26,7 +26,7 @@ using std::vector; static const double MIN_CPU_TIME = 0; -int init_result_trivial(RESULT const& result, void*& data) { +int init_result_trivial(RESULT const& /*result*/, void*& /*data*/) { return 0; } diff --git a/sched/sched_config.C b/sched/sched_config.C index 1a8fe56b17..8818abeac3 100644 --- a/sched/sched_config.C +++ b/sched/sched_config.C @@ -36,7 +36,7 @@ const char* CONFIG_FILE = "config.xml"; // look for a boolean; accepts either or 1 // -static void parse_bool(char* buf, char* tag, bool& result) { +static void parse_bool(char* buf, const char* tag, bool& result) { char single_tag[256], start_tag[256]; int x; @@ -104,7 +104,7 @@ int SCHED_CONFIG::parse(char* buf) { return ERR_XML_PARSE; } -int SCHED_CONFIG::parse_file(char* dir) { +int SCHED_CONFIG::parse_file(const char* dir) { char* p; char path[256]; int retval; diff --git a/sched/sched_config.h b/sched/sched_config.h index 60668c0757..0eafc7514a 100644 --- a/sched/sched_config.h +++ b/sched/sched_config.h @@ -65,7 +65,7 @@ public: bool cache_md5_info; int parse(char*); - int parse_file(char* dir="."); + int parse_file(const char* dir="."); }; // get the project's home directory diff --git a/sched/sched_locality.C b/sched/sched_locality.C index d62a5e7e08..29c8156af4 100644 --- a/sched/sched_locality.C +++ b/sched/sched_locality.C @@ -118,7 +118,7 @@ bool host_has_file( // routine, in the same way as if there was no scheduling locality. // int decrement_disk_space_locality( - DB_RESULT& result, WORKUNIT& wu, SCHEDULER_REQUEST& request, + WORKUNIT& wu, SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply ) { char filename[256], path[512]; @@ -385,7 +385,7 @@ static int send_results_for_file( int& nsent, SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform, SCHED_SHMEM& ss, - bool in_working_set + bool /*in_working_set*/ ) { DB_RESULT result, prev_result; char buf[256], query[1024]; @@ -481,7 +481,6 @@ static int send_results_for_file( if (config.one_result_per_user_per_wu) { // do an EXPENSIVE db query - char query[256]; #ifdef USE_REGEXP sprintf(query, "where server_state=%d and name like '%s__%%' limit 1", @@ -585,7 +584,7 @@ static int send_results_for_file( // static int send_new_file_work_deterministic_seeded( SCHEDULER_REQUEST& sreq, SCHEDULER_REPLY& reply, PLATFORM& platform, - SCHED_SHMEM& ss, int& nsent, char *start_f, char *end_f + SCHED_SHMEM& ss, int& nsent, const char *start_f, const char *end_f ) { DB_RESULT result; char filename[256], min_resultname[256], query[1024]; @@ -651,7 +650,9 @@ static int send_new_file_work_deterministic( // continue deterministic search at lexically first possible // filename, continue to randomly choosen one if (!getfile_retval && reply.work_needed(true)) { - send_new_file_work_deterministic_seeded(sreq, reply, platform, ss, nsent, "", start_filename); + send_new_file_work_deterministic_seeded( + sreq, reply, platform, ss, nsent, "", start_filename + ); if (nsent) { return 0; } diff --git a/sched/sched_locality.h b/sched/sched_locality.h index 360046b7e5..eeef5478ca 100644 --- a/sched/sched_locality.h +++ b/sched/sched_locality.h @@ -22,6 +22,6 @@ extern void send_work_locality( SCHED_SHMEM& ss ); extern int decrement_disk_space_locality( - DB_RESULT& result, WORKUNIT& wu, SCHEDULER_REQUEST& request, + WORKUNIT& wu, SCHEDULER_REQUEST& request, SCHEDULER_REPLY& reply ); diff --git a/sched/sched_send.C b/sched/sched_send.C index 772f3c53a6..15cbbf5eea 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -227,7 +227,10 @@ int wu_is_infeasible( reason |= INFEASIBLE_DISK; } - if (!config.ignore_delay_bound && 0.00) { double ewd = estimate_wallclock_duration(wu, request, reply); if (request.estimated_delay + ewd > wu.delay_bound) { log_messages.printf( @@ -246,7 +249,7 @@ int wu_is_infeasible( // insert "text" right after "after" in the given buffer // -int insert_after(char* buffer, char* after, char* text) { +int insert_after(char* buffer, const char* after, const char* text) { char* p; char temp[LARGE_BLOB_SIZE]; @@ -556,7 +559,7 @@ int add_result_to_reply( // the file OR the file was not already sent. // if (!config.locality_scheduling || - decrement_disk_space_locality(result, wu, request, reply) + decrement_disk_space_locality(wu, request, reply) ) { reply.wreq.disk_available -= wu.rsc_disk_bound; } @@ -854,8 +857,8 @@ int send_work( if (reply.wreq.nresults == 0) { reply.set_delay(3600); - USER_MESSAGE um("No work available", "high"); - reply.insert_message(um); + USER_MESSAGE um2("No work available", "high"); + reply.insert_message(um2); if (reply.wreq.no_app_version) { USER_MESSAGE um("(there was work for other platforms)", "high"); reply.insert_message(um); @@ -883,11 +886,11 @@ int send_work( ); reply.insert_message(um); if (!config.ignore_delay_bound && sreq.resource_share_fraction<1.0) { - USER_MESSAGE um( + USER_MESSAGE um3 ( "Review preferences for this project's Resource Share", "high" ); - reply.insert_message(um); + reply.insert_message(um3); } } if (reply.wreq.homogeneous_redundancy_reject) { diff --git a/sched/sched_shmem.C b/sched/sched_shmem.C index ade6eba6f9..dce4544a0d 100644 --- a/sched/sched_shmem.C +++ b/sched/sched_shmem.C @@ -67,7 +67,7 @@ int SCHED_SHMEM::verify() { return 0; } -static void overflow(char* table, char* param_name) { +static void overflow(const char* table, const char* param_name) { log_messages.printf( SCHED_MSG_LOG::CRITICAL, "The SCHED_SHMEM structure is too small for the %s table.\n" @@ -183,6 +183,7 @@ APP_VERSION* SCHED_SHMEM::lookup_app_version( return best_avp; } +#if 0 // find the latest core version for a given platform // CORE_VERSION* SCHED_SHMEM::lookup_core_version(int platformid) { @@ -197,6 +198,7 @@ CORE_VERSION* SCHED_SHMEM::lookup_core_version(int platformid) { } return best; } +#endif bool SCHED_SHMEM::no_work(int pid) { int i; diff --git a/sched/sched_shmem.h b/sched/sched_shmem.h index 8029f8c8a1..1b8e7b4dfe 100644 --- a/sched/sched_shmem.h +++ b/sched/sched_shmem.h @@ -91,7 +91,9 @@ struct SCHED_SHMEM { APP* lookup_app(int); APP_VERSION* lookup_app_version(int appid, int platform, int version); +#if 0 CORE_VERSION* lookup_core_version(int platform); +#endif PLATFORM* lookup_platform(char*); }; diff --git a/sched/sched_timezone.C b/sched/sched_timezone.C index 93136932c7..5948325982 100644 --- a/sched/sched_timezone.C +++ b/sched/sched_timezone.C @@ -51,8 +51,8 @@ static int hostid=0; // earth. This function finds the 'shortest way around' // static int compare(const void *x, const void *y) { - URLTYPE *a=(URLTYPE *)x; - URLTYPE *b=(URLTYPE *)y; + const URLTYPE *a=(const URLTYPE *)x; + const URLTYPE *b=(const URLTYPE *)y; char longname[512]; @@ -168,12 +168,12 @@ URLTYPE* read_download_list() { // return number of bytes written, or <0 to indicate an error // -int make_download_list(char *buffer, char *path, int timezone) { +int make_download_list(char *buffer, char *path, int tz) { char *start=buffer; int i; // global variable used in the compare() function - tzone=timezone; + tzone=tz; URLTYPE *serverlist=read_download_list(); if (!serverlist) return -1; @@ -196,7 +196,7 @@ int make_download_list(char *buffer, char *path, int timezone) { // returns zero on success, non-zero to indicate an error // -int add_download_servers(char *old_xml, char *new_xml, int timezone) { +int add_download_servers(char *old_xml, char *new_xml, int tz) { char *p, *q, *r; p=r=old_xml; @@ -232,7 +232,7 @@ int add_download_servers(char *old_xml, char *new_xml, int timezone) { // insert new download list in place of the original one // - len = make_download_list(new_xml, s, timezone); + len = make_download_list(new_xml, s, tz); if (len<0) { return 1; } diff --git a/sched/sched_util.C b/sched/sched_util.C index a6a8ed8c0f..c8519364da 100644 --- a/sched/sched_util.C +++ b/sched/sched_util.C @@ -90,7 +90,7 @@ bool check_stop_sched() { // (this is generally a recoverable error, // like NFS mount failure, that may go away later) // -int try_fopen(char* path, FILE*& f, char* mode) { +int try_fopen(const char* path, FILE*& f, const char* mode) { char* p; DIR* d; char dirpath[256]; @@ -114,7 +114,7 @@ int try_fopen(char* path, FILE*& f, char* mode) { return 0; } -void get_log_path(char* p, char* filename) { +void get_log_path(char* p, const char* filename) { char buf[256]; char path[256]; gethostname(buf, 256); diff --git a/sched/sched_util.h b/sched/sched_util.h index c282cb708f..996ac6410e 100644 --- a/sched/sched_util.h +++ b/sched/sched_util.h @@ -33,8 +33,8 @@ extern void set_debug_level(int); extern void check_stop_daemons(); extern bool check_stop_sched(); extern void install_stop_signal_handler(); -extern int try_fopen(char* path, FILE*& f, char* mode); -extern void get_log_path(char*, char*); +extern int try_fopen(const char* path, FILE*& f, const char* mode); +extern void get_log_path(char*, const char*); // convert filename to path in a hierarchical directory system // diff --git a/sched/server_types.C b/sched/server_types.C index e87829fb69..5e6ba40c3e 100644 --- a/sched/server_types.C +++ b/sched/server_types.C @@ -331,8 +331,8 @@ int SCHEDULER_REPLY::write(FILE* fout) { ); if (request_delay) { - fprintf(fout, "%d\n", request_delay); - log_messages.printf(SCHED_MSG_LOG::NORMAL, "sending delay request %d\n", request_delay); + fprintf(fout, "%f\n", request_delay); + log_messages.printf(SCHED_MSG_LOG::NORMAL, "sending delay request %f\n", request_delay); } if (wreq.core_client_version < 462) { std::string msg; @@ -455,7 +455,7 @@ int SCHEDULER_REPLY::write(FILE* fout) { for (i=0; i messages; int hostid; // nonzero only if a new host record was created. @@ -185,7 +185,7 @@ struct SCHEDULER_REPLY { void insert_result(RESULT&); void insert_message(USER_MESSAGE&); bool work_needed(bool locality_sched=false); - void set_delay(int delay); + void set_delay(double); }; #endif diff --git a/sched/validate_util.C b/sched/validate_util.C index f16543073f..9ce8d57213 100644 --- a/sched/validate_util.C +++ b/sched/validate_util.C @@ -134,7 +134,6 @@ int generic_check_set( size_t min_valid) { assert (!results.empty()); - assert (min_valid >= 0); vector data; vector::size_type i, j, neq = 0, n = results.size(); diff --git a/sched/validator_placeholder.C b/sched/validator_placeholder.C index ba982c1995..90aa100459 100644 --- a/sched/validator_placeholder.C +++ b/sched/validator_placeholder.C @@ -26,7 +26,7 @@ using std::vector; static const double MIN_CPU_TIME = 0; -int init_result_trivial(RESULT const& result, void*& data) { +int init_result_trivial(RESULT const& /*result*/, void*& /*data*/) { return 0; } diff --git a/tools/backend_lib.C b/tools/backend_lib.C index de69eb28c5..e5c87730af 100644 --- a/tools/backend_lib.C +++ b/tools/backend_lib.C @@ -415,7 +415,6 @@ int create_work( const char* result_template_filepath, const char** infiles, int ninfiles, - R_RSA_PRIVATE_KEY& key, SCHED_CONFIG& config ) { int retval; diff --git a/tools/backend_lib.h b/tools/backend_lib.h index 44403c55bf..b218c9a695 100644 --- a/tools/backend_lib.h +++ b/tools/backend_lib.h @@ -55,7 +55,6 @@ extern int create_work( const char* result_template_filepath, const char** infiles, int ninfiles, - R_RSA_PRIVATE_KEY&, SCHED_CONFIG& ); diff --git a/tools/create_work.C b/tools/create_work.C index cbedbf59c7..870e88fdf7 100644 --- a/tools/create_work.C +++ b/tools/create_work.C @@ -54,16 +54,14 @@ #include "backend_lib.h" #include "sched_config.h" -int main(int argc, char** argv) { +int main(int argc, const char** argv) { DB_APP app; DB_WORKUNIT wu; int retval; char wu_template[LARGE_BLOB_SIZE]; char wu_template_file[256], result_template_file[256], result_template_path[1024]; - char keyfile[256]; - char** infiles = NULL; + const char** infiles = NULL; int i, ninfiles; - R_RSA_PRIVATE_KEY key; char download_dir[256], db_name[256], db_passwd[256],db_user[256],db_host[256]; char buf[256]; SCHED_CONFIG config; @@ -71,8 +69,7 @@ int main(int argc, char** argv) { strcpy(result_template_file, ""); strcpy(app.name, ""); strcpy(db_passwd, ""); - strcpy(keyfile, ""); - char* config_dir = "."; + const char* config_dir = "."; i = 1; ninfiles = 0; wu.clear(); @@ -159,7 +156,6 @@ int main(int argc, char** argv) { strcpy(db_user, config.db_user); strcpy(db_host, config.db_host); strcpy(download_dir, config.download_dir); - sprintf(keyfile, "%s/upload_private", config.key_dir); } retval = boinc_db.open(db_name, db_host, db_user, db_passwd); @@ -182,12 +178,6 @@ int main(int argc, char** argv) { wu.appid = app.id; - retval = read_key_file(keyfile, key); - if (retval) { - fprintf(stderr, "create_work: can't read key: %d", retval); - exit(1); - } - strcpy(result_template_path, "./"); strcat(result_template_path, result_template_file); retval = create_work( @@ -197,7 +187,6 @@ int main(int argc, char** argv) { result_template_path, const_cast(infiles), ninfiles, - key, config ); if (retval) { diff --git a/tools/dir_hier_path.C b/tools/dir_hier_path.C index b13801413d..a744a3ed8f 100644 --- a/tools/dir_hier_path.C +++ b/tools/dir_hier_path.C @@ -28,7 +28,7 @@ #include "sched_config.h" #include "sched_util.h" -int main(int argc, char** argv) { +int main(int /*argc*/, char** argv) { SCHED_CONFIG config; char path[256]; int retval;