diff --git a/client/app.C b/client/app.C index 1ab21d4eec..356b084aeb 100644 --- a/client/app.C +++ b/client/app.C @@ -94,10 +94,10 @@ ACTIVE_TASK::ACTIVE_TASK() { exit_status = 0; signal = 0; strcpy(slot_dir, ""); - graphics_requested_mode = MODE_HIDE_GRAPHICS; - graphics_request_time = time(0); - graphics_acked_mode = MODE_UNSUPPORTED; - graphics_mode_before_ss = MODE_HIDE_GRAPHICS; + graphics_requested_mode = MODE_HIDE_GRAPHICS; + graphics_request_time = time(0); + graphics_acked_mode = MODE_UNSUPPORTED; + graphics_mode_before_ss = MODE_HIDE_GRAPHICS; } int ACTIVE_TASK::init(RESULT* rp) { @@ -169,8 +169,8 @@ int ACTIVE_TASK::start(bool first_time) { return ERR_FOPEN; } - // make a unique key for core/app shared memory segment - // + // make a unique key for core/app shared memory segment + // #ifdef _WIN32 sprintf(aid.comm_obj_name, "boinc_%d", slot); #else @@ -304,13 +304,13 @@ int ACTIVE_TASK::start(bool first_time) { sprintf(buf, "%s%s", QUIT_PREFIX, aid.comm_obj_name); quitRequestEvent = CreateEvent(0, TRUE, FALSE, buf); - // create core/app share mem segment - // + // create core/app share mem segment + // sprintf(buf, "%s%s", SHM_PREFIX, aid.comm_obj_name); shm_handle = create_shmem(buf, APP_CLIENT_SHMEM_SIZE, - (void **)&app_client_shm.shm - ); - app_client_shm.reset_msgs(); + (void **)&app_client_shm.shm + ); + app_client_shm.reset_msgs(); // NOTE: in Windows, stderr is redirected within boinc_init(); @@ -607,18 +607,18 @@ bool ACTIVE_TASK::read_stderr_file() { } void ACTIVE_TASK::request_graphics_mode(int mode) { - app_client_shm.send_graphics_mode_msg(CORE_APP_GFX_SEG, mode); - graphics_requested_mode = mode; + app_client_shm.send_graphics_mode_msg(CORE_APP_GFX_SEG, mode); + graphics_requested_mode = mode; } void ACTIVE_TASK::check_graphics_mode_ack() { - int mode; - if (app_client_shm.get_graphics_mode_msg(APP_CORE_GFX_SEG, mode)) { - graphics_acked_mode = mode; - if (mode != MODE_FULLSCREEN) { - graphics_mode_before_ss = mode; - } - } + int mode; + if (app_client_shm.get_graphics_mode_msg(APP_CORE_GFX_SEG, mode)) { + graphics_acked_mode = mode; + if (mode != MODE_FULLSCREEN) { + graphics_mode_before_ss = mode; + } + } } // Wait up to wait_time seconds for all processes in this set to exit @@ -831,7 +831,7 @@ int ACTIVE_TASK::get_cpu_time() { // If so read it and return true. // bool ACTIVE_TASK::check_app_status() { - char msg_buf[SHM_SEG_SIZE]; + char msg_buf[SHM_SEG_SIZE]; if (app_client_shm.get_msg(msg_buf, APP_CORE_WORKER_SEG)) { fraction_done = current_cpu_time = checkpoint_cpu_time = 0.0; parse_double(msg_buf, "", fraction_done); @@ -1099,6 +1099,6 @@ void ACTIVE_TASK_SET::check_graphics_mode_ack() { for (i=0; icheck_graphics_mode_ack(); - } + atp->check_graphics_mode_ack(); + } } diff --git a/client/app.h b/client/app.h index 1c373108be..5574a8f568 100644 --- a/client/app.h +++ b/client/app.h @@ -90,8 +90,8 @@ public: int graphics_request_time; // when we sent it int graphics_acked_mode; // most recent mode reported by app int graphics_mode_before_ss; // mode before last screensaver request - void request_graphics_mode(int); - void check_graphics_mode_ack(); + void request_graphics_mode(int); + void check_graphics_mode_ack(); ACTIVE_TASK(); int init(RESULT*); @@ -143,7 +143,7 @@ public: void save_app_modes(); void hide_apps(); void restore_apps(); - void check_graphics_mode_ack(); + void check_graphics_mode_ack(); int write(FILE*); int parse(FILE*, CLIENT_STATE*); diff --git a/client/client_state.C b/client/client_state.C index bd6627a36a..1bfc47d149 100644 --- a/client/client_state.C +++ b/client/client_state.C @@ -201,6 +201,8 @@ int CLIENT_STATE::init() { print_summary(); } + show_message(NULL, "Starting BOINC client", MSG_INFO); + // Read the global preferences file, if it exists. // Do this after reading the state file so we know our venue // diff --git a/client/client_state.h b/client/client_state.h index 9ea68c0254..4ef716c268 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -58,7 +58,7 @@ public: HOST_INFO host_info; GLOBAL_PREFS global_prefs; NET_STATS net_stats; - SS_LOGIC ss_logic; + SS_LOGIC ss_logic; CLIENT_STATE(); int init(); diff --git a/client/client_types.C b/client/client_types.C index 5deada539c..c9d64a9e8a 100644 --- a/client/client_types.C +++ b/client/client_types.C @@ -244,10 +244,10 @@ void PROJECT::copy_state_fields(PROJECT& p) { } char *PROJECT::get_project_name() { - if(!strcmp(project_name, "")) - return master_url; - else - return project_name; + if(!strcmp(project_name, "")) + return master_url; + else + return project_name; } int APP::parse(FILE* in) { diff --git a/client/cs_apps.C b/client/cs_apps.C index 37d1928ee2..829819ee13 100644 --- a/client/cs_apps.C +++ b/client/cs_apps.C @@ -60,6 +60,7 @@ int CLIENT_STATE::cleanup_and_exit() { fprintf(stderr, "error: CLIENT_STATE.exit: write_state_file failed\n"); // don't return here - we'll exit anyway } + show_message(NULL, "Exiting BOINC client", MSG_INFO); return 0; } diff --git a/client/scheduler_op.C b/client/scheduler_op.C index 76589dcdda..4f22a18a1b 100644 --- a/client/scheduler_op.C +++ b/client/scheduler_op.C @@ -177,7 +177,7 @@ void SCHEDULER_OP::backoff(PROJECT* p, char *error_msg ) { int SCHEDULER_OP::start_rpc() { FILE *f; int retval; - char msg_buf[256]; + char msg_buf[256]; safe_strcpy(scheduler_url, project->scheduler_urls[url_index].text); if (log_flags.sched_ops) { diff --git a/client/ss_logic.C b/client/ss_logic.C index 0452b69fa8..3e19947c7f 100644 --- a/client/ss_logic.C +++ b/client/ss_logic.C @@ -36,7 +36,7 @@ void SS_LOGIC::start_ss(time_t new_blank_time) { } void SS_LOGIC::stop_ss() { - if (!do_ss) return; + if (!do_ss) return; do_ss = do_boinc_logo_ss = do_blank = false; delete_curtain(); gstate.active_tasks.restore_apps(); @@ -48,7 +48,7 @@ void SS_LOGIC::stop_ss() { void SS_LOGIC::poll() { ACTIVE_TASK* atp; - gstate.active_tasks.check_graphics_mode_ack(); + gstate.active_tasks.check_graphics_mode_ack(); if (do_ss) { if (blank_time && (time(0) > blank_time)) { @@ -64,11 +64,11 @@ void SS_LOGIC::poll() { atp = gstate.active_tasks.get_app_requested(MODE_FULLSCREEN); if (atp) { if (atp->graphics_acked_mode == MODE_FULLSCREEN) { - do_boinc_logo_ss = false; - } else { + do_boinc_logo_ss = false; + } else { if (time(0)>ack_deadline) { - do_boinc_logo_ss = true; - } + do_boinc_logo_ss = true; + } } } else { atp = gstate.active_tasks.get_graphics_capable_app(); diff --git a/lib/app_ipc.C b/lib/app_ipc.C index e4c08fce78..4a253dc815 100755 --- a/lib/app_ipc.C +++ b/lib/app_ipc.C @@ -6,11 +6,11 @@ #include "app_ipc.h" char* xml_graphics_modes[5] = { - "", - "", - "", - "", - "" + "", + "", + "", + "", + "" }; int write_init_data_file(FILE* f, APP_INIT_DATA& ai) { @@ -115,70 +115,70 @@ int parse_fd_init_file(FILE* f) { } bool APP_CLIENT_SHM::pending_msg(int seg_num) { - if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false; - return (shm[seg_num*SHM_SEG_SIZE]?true:false); + if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false; + return (shm[seg_num*SHM_SEG_SIZE]?true:false); } bool APP_CLIENT_SHM::get_msg(char *msg, int seg_num) { - if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false; + if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false; - // Check if there's an available message + // Check if there's an available message // - if (!shm[seg_num*SHM_SEG_SIZE]) return false; + if (!shm[seg_num*SHM_SEG_SIZE]) return false; - // Copy the message from shared memory + // Copy the message from shared memory // - strncpy(msg, &shm[(seg_num*SHM_SEG_SIZE)+1], SHM_SEG_SIZE-1); + strncpy(msg, &shm[(seg_num*SHM_SEG_SIZE)+1], SHM_SEG_SIZE-1); - // Reset the message status flag + // Reset the message status flag // - shm[seg_num*SHM_SEG_SIZE] = 0; - return true; + shm[seg_num*SHM_SEG_SIZE] = 0; + return true; } bool APP_CLIENT_SHM::send_msg(char *msg,int seg_num) { - if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false; + if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return false; - // Check if there's already a message + // Check if there's already a message // - //if (shm[seg_num*SHM_SEG_SIZE]) return false; + //if (shm[seg_num*SHM_SEG_SIZE]) return false; - // Copy the message into shared memory + // Copy the message into shared memory // - strncpy(&shm[(seg_num*SHM_SEG_SIZE)+1], msg, SHM_SEG_SIZE-1); + strncpy(&shm[(seg_num*SHM_SEG_SIZE)+1], msg, SHM_SEG_SIZE-1); - // Set the message status flag + // Set the message status flag // - shm[seg_num*SHM_SEG_SIZE] = 1; - return true; + shm[seg_num*SHM_SEG_SIZE] = 1; + return true; } void APP_CLIENT_SHM::reset_msgs(void) { - if (shm == NULL) return; - memset(shm, 0, sizeof(char)*NUM_SEGS*SHM_SEG_SIZE); + if (shm == NULL) return; + memset(shm, 0, sizeof(char)*NUM_SEGS*SHM_SEG_SIZE); } void APP_CLIENT_SHM::reset_msg(int seg_num) { - if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return; - memset(&shm[seg_num*SHM_SEG_SIZE], 0, sizeof(char)*SHM_SEG_SIZE); + if (seg_num < 0 || seg_num >= NUM_SEGS || shm == NULL) return; + memset(&shm[seg_num*SHM_SEG_SIZE], 0, sizeof(char)*SHM_SEG_SIZE); } bool APP_CLIENT_SHM::send_graphics_mode_msg(int seg, int mode) { - return send_msg(xml_graphics_modes[mode], seg); + return send_msg(xml_graphics_modes[mode], seg); } bool APP_CLIENT_SHM::get_graphics_mode_msg(int seg, int& mode) { - char buf[SHM_SEG_SIZE]; - int i; + char buf[SHM_SEG_SIZE]; + int i; - if (!get_msg(buf, seg)) return false; - for (i=0; i<5; i++) { - if (match_tag(buf, xml_graphics_modes[i])) { - mode = i; - return true; - } - } - return false; + if (!get_msg(buf, seg)) return false; + for (i=0; i<5; i++) { + if (match_tag(buf, xml_graphics_modes[i])) { + mode = i; + return true; + } + } + return false; } int write_graphics_file(FILE* f, GRAPHICS_INFO* gi) { diff --git a/lib/app_ipc.h b/lib/app_ipc.h index c9c6c2c57b..a96299602e 100755 --- a/lib/app_ipc.h +++ b/lib/app_ipc.h @@ -31,14 +31,14 @@ public: bool pending_msg(int); // returns true a message is waiting // in the specified segment - bool get_msg(char *,int); // returns the message from the specified + bool get_msg(char *,int); // returns the message from the specified // segment and resets the message flag - bool send_msg(char *,int); // if there is not already a message in the segment, + bool send_msg(char *,int); // if there is not already a message in the segment, // writes specified message and sets message flag - bool send_graphics_mode_msg(int seg, int mode); - bool get_graphics_mode_msg(int seg, int& mode); - void reset_msgs(); // resets all messages and clears their flags - void reset_msg(int); // resets specified message and clears its flag + bool send_graphics_mode_msg(int seg, int mode); + bool get_graphics_mode_msg(int seg, int& mode); + void reset_msgs(); // resets all messages and clears their flags + void reset_msg(int); // resets specified message and clears its flag }; #include "boinc_api.h" @@ -61,7 +61,7 @@ int parse_graphics_file(FILE* f, GRAPHICS_INFO* gi); #define MODE_WINDOW 2 #define MODE_FULLSCREEN 3 -#define END_SS_MSG "BOINC_SS_END" +#define END_SS_MSG "BOINC_SS_END" extern char* xml_graphics_modes[5]; diff --git a/lib/util.C b/lib/util.C index c631158fac..0a7d176a85 100755 --- a/lib/util.C +++ b/lib/util.C @@ -129,7 +129,7 @@ void boinc_sleep(double seconds) { ::Sleep((int)(1000*seconds)); #else sleep((int)seconds); - usleep((int)fmod(seconds*1000000,1000000)); + usleep((int)fmod(seconds*1000000,1000000)); #endif } diff --git a/todo b/todo index 433aee682c..7e25b35ba8 100755 --- a/todo +++ b/todo @@ -10,7 +10,6 @@ BUGS (arranged from high to low priority) - show_message should expect \n, discard it if GUI - show "---" for CPU time, %done of results not started yet - Win GUI: line between menus and tabs -- message for client starting or exiting - "show graphics" should not use right-click - win GUI: reduce flicker? - on major version change,