From 7767ca1eb85f7415e8cd972d83d69ea8ca866084 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 7 Nov 2006 17:40:55 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11492 --- checkin_notes | 21 +++++++++++++++++++++ lib/gui_rpc_client_ops.C | 2 +- lib/miofile.C | 9 ++++++--- lib/miofile.h | 4 ++-- lib/parse.C | 13 +++++++++---- lib/parse.h | 2 +- sched/handle_request.C | 6 +++--- sched/sched_array.C | 8 ++++---- sched/sched_locality.C | 2 +- sched/sched_send.C | 11 ++++------- sched/sched_send.h | 2 +- sched/server_types.C | 2 +- sched/server_types.h | 2 +- sched/validate_util.C | 25 +++++-------------------- 14 files changed, 60 insertions(+), 49 deletions(-) diff --git a/checkin_notes b/checkin_notes index 5f6f687989..df8259e178 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12362,3 +12362,24 @@ Rom 6 Nov 2006 clientgui/ sg_DlgPreferences.cpp + +David 7 Nov 2006 + - validate_util.C: fix tag ("file_info", not "file") + - MIOFILE: when we're reading from a buffer, + make it a const char* instead of char*. + Doing this requires limiting ungetc() to push only + the character that was previously read (which is OK). + - scheduler: removed SCHED_SHMEM& arg from wu_is_infeasible() + - fix compile warnings + + lib/ + gui_rpc_client_ops.C + miofile.C,h + parse.C,h + sched/ + handle_request.C + sched_array.C + sched_locality.C + sched_send.C,h + server_types.C,h + validate_util.C diff --git a/lib/gui_rpc_client_ops.C b/lib/gui_rpc_client_ops.C index e8b77b53ad..e20a90b216 100644 --- a/lib/gui_rpc_client_ops.C +++ b/lib/gui_rpc_client_ops.C @@ -2113,7 +2113,7 @@ int RPC_CLIENT::get_global_prefs_override_struct(GLOBAL_PREFS& prefs) { retval = get_global_prefs_override(s); if (retval) return retval; - mf.init_buf_read((char*)s.c_str()); + mf.init_buf_read(s.c_str()); XML_PARSER xp(&mf); prefs.parse(xp, "", found_venue); return 0; diff --git a/lib/miofile.C b/lib/miofile.C index 8db2b90ab0..9439df1b8c 100644 --- a/lib/miofile.C +++ b/lib/miofile.C @@ -50,7 +50,7 @@ void MIOFILE::init_file(FILE* _f) { f = _f; } -void MIOFILE::init_buf_read(char* _buf) { +void MIOFILE::init_buf_read(const char* _buf) { buf = _buf; } @@ -99,9 +99,12 @@ int MIOFILE::_ungetc(int c) { #else return ungetc(c, f); #endif + } else { + buf--; + // NOTE: we assume that the char being pushed + // is what's already there + //*buf = c; } - buf--; - *buf = c; return c; } diff --git a/lib/miofile.h b/lib/miofile.h index e9da7abdb6..f137811645 100644 --- a/lib/miofile.h +++ b/lib/miofile.h @@ -49,13 +49,13 @@ class MIOFILE { MFILE* mf; FILE* f; char* wbuf; - char* buf; + const char* buf; public: MIOFILE(); ~MIOFILE(); void init_mfile(MFILE*); void init_file(FILE*); - void init_buf_read(char*); + void init_buf_read(const char*); void init_buf_write(char*); int printf(const char* format, ...); char* fgets(char*, int); diff --git a/lib/parse.C b/lib/parse.C index 4009eb7965..6fd8ad9c47 100644 --- a/lib/parse.C +++ b/lib/parse.C @@ -275,17 +275,22 @@ bool str_replace(char* str, const char* substr, const char* replacement) { // then return the contents of that element. // Otherwise strip out all elements // -void extract_venue(char* in, char* venue_name, char* out) { - char* p, *q; +void extract_venue(const char* in, const char* venue_name, char* out) { + const char* p, *q; + char* wp; char buf[256]; sprintf(buf, "", venue_name); p = strstr(in, buf); if (p) { + // prefs contain the specified venue + // p += strlen(buf); strcpy(out, p); - q = strstr(out, "", (int&)master_mod_time); + parse_int(sreq.global_prefs_xml, "", master_mod_time); } if (have_db_prefs) { - parse_int(reply.user.global_prefs, "", (int&)db_mod_time); + parse_int(reply.user.global_prefs, "", db_mod_time); } // decide which prefs to use for sched decisions diff --git a/sched/sched_array.C b/sched/sched_array.C index 5e862698bd..55ed0c7741 100644 --- a/sched/sched_array.C +++ b/sched/sched_array.C @@ -82,15 +82,15 @@ void scan_work_array( // If we are looking for beta results and result is not a beta result // then move on // - APP* app = ss.lookup_app(wu_result.workunit.appid); + app = ss.lookup_app(wu_result.workunit.appid); if (app == NULL) continue; // this should never happen if (reply.wreq.beta_only) { if (!app->beta) { continue; } log_messages.printf(SCHED_MSG_LOG::MSG_DEBUG, - "[HOST#%d] beta work found. Result id %d \n", - reply.host.id + "[HOST#%d] beta work found. [RESULT#%d]\n", + reply.host.id, wu_result.resultid ); } else { if (app->beta) { @@ -128,7 +128,7 @@ void scan_work_array( // don't send if host can't handle it // wu = wu_result.workunit; - if (wu_is_infeasible(wu, sreq, reply, ss)) { + if (wu_is_infeasible(wu, sreq, reply)) { log_messages.printf( SCHED_MSG_LOG::MSG_DEBUG, "[HOST#%d] [WU#%d %s] WU is infeasible\n", reply.host.id, wu.id, wu.name diff --git a/sched/sched_locality.C b/sched/sched_locality.C index 9c723c3ec5..655f454bb7 100644 --- a/sched/sched_locality.C +++ b/sched/sched_locality.C @@ -287,7 +287,7 @@ static int possibly_send_result( // why the WU is not feasible. These are defined in sched_send.h. // INFEASIBLE_MEM, INFEASIBLE_DISK, INFEASIBLE_CPU. // - if (wu_is_infeasible(wu, sreq, reply, ss)) { + if (wu_is_infeasible(wu, sreq, reply)) { return ERR_INSUFFICIENT_RESOURCE; } diff --git a/sched/sched_send.C b/sched/sched_send.C index 5b207c79c3..6efee92554 100644 --- a/sched/sched_send.C +++ b/sched/sched_send.C @@ -237,14 +237,11 @@ static double estimate_wallclock_duration( if (reply.host.cpu_efficiency) { ewd /= reply.host.cpu_efficiency; } -#ifdef EINSTEIN_AT_HOME log_messages.printf( SCHED_MSG_LOG::MSG_DEBUG, "est cpu dur %f; running_frac %f; rsf %f; est %f\n", ecd, running_frac, request.resource_share_fraction, ewd ); -#endif - return ewd; } @@ -309,9 +306,10 @@ static int get_host_info(SCHEDULER_REPLY& reply) { int find_preferred_app_index(SCHEDULER_REPLY& reply, int appid) { int result = -1; - for (int i=0; i", buf, sizeof(buf))) { - return ERR_XML_PARSE; - } - dir_hier_path(buf, config.upload_dir, config.uldl_dir_fanout, path); - path_str = path; - return 0; -} -#endif - static int parse_filename(XML_PARSER& xp, string& name) { char tag[256]; bool is_tag, found=false; while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) continue; - if (!strcmp(tag, "/file")) { + if (!strcmp(tag, "/file_info")) { return found?0:ERR_XML_PARSE; } if (xp.parse_string(tag, "name", name)) { @@ -73,11 +58,11 @@ int get_output_file_path(RESULT const& result, string& path_str) { bool is_tag; string name; MIOFILE mf; - mf.init_buf_read((char*)(result.xml_doc_out)); + mf.init_buf_read(result.xml_doc_out); XML_PARSER xp(&mf); while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) continue; - if (!strcmp(tag, "file")) { + if (!strcmp(tag, "file_info")) { int retval = parse_filename(xp, name); if (retval) return retval; dir_hier_path(name.c_str(), config.upload_dir, config.uldl_dir_fanout, path); @@ -93,12 +78,12 @@ int get_output_file_paths(RESULT const& result, vector& paths) { bool is_tag; MIOFILE mf; string name; - mf.init_buf_read((char*)(result.xml_doc_out)); + mf.init_buf_read(result.xml_doc_out); XML_PARSER xp(&mf); paths.clear(); while (!xp.get(tag, sizeof(tag), is_tag)) { if (!is_tag) continue; - if (!strcmp(tag, "file")) { + if (!strcmp(tag, "file_info")) { int retval = parse_filename(xp, name); if (retval) return retval; dir_hier_path(name.c_str(), config.upload_dir, config.uldl_dir_fanout, path);