diff --git a/checkin_notes b/checkin_notes index ef1e5b8ebc..1a41c56c89 100755 --- a/checkin_notes +++ b/checkin_notes @@ -7448,3 +7448,18 @@ David 11 July 2006 server_types.h show_shmem.C validator.C + +David 11 July 2006 + - core client: fix bug where the first log flag in the + list was getting skipped over. + This was due to a design flaw in the new XML parsing code. + To work around this, I changed the format of + the cc_config.xml file so that options are + enclosed in ... + + client/ + app.C + cs_statefile.C + log_flags.C,h + lib/ + parse.C diff --git a/client/app.C b/client/app.C index e689af3423..c9168eaebb 100644 --- a/client/app.C +++ b/client/app.C @@ -452,6 +452,7 @@ int ACTIVE_TASK::parse(MIOFILE& fin) { else if (parse_double(buf, "", x)) continue; else if (match_tag(buf, "")) continue; else if (parse_int(buf, "", n)) continue; + else if (parse_int(buf, "", n)) continue; else { if (log_flags.unparsed_xml) { msg_printf(0, MSG_ERROR, diff --git a/client/cs_statefile.C b/client/cs_statefile.C index 55952f818d..f01c94d87a 100644 --- a/client/cs_statefile.C +++ b/client/cs_statefile.C @@ -96,6 +96,8 @@ int CLIENT_STATE::parse_state_file() { while (fgets(buf, 256, f)) { if (match_tag(buf, "")) { break; + } else if (match_tag(buf, "")) { + continue; } else if (match_tag(buf, "")) { PROJECT temp_project; retval = temp_project.parse_state(mf); diff --git a/client/log_flags.C b/client/log_flags.C index fcbd25251f..3b7430d360 100644 --- a/client/log_flags.C +++ b/client/log_flags.C @@ -94,6 +94,26 @@ CONFIG::CONFIG() { save_stats_days = 30; } +int CONFIG::parse_options(FILE* f) { + char tag[256], contents[1024]; + while (get_tag(f, tag, contents)) { + if (!strcmp(tag, "/options")) { + return 0; + } else if (!strcmp(tag, "save_stats_days")) { + save_stats_days = get_int(contents); + } else if (!strcmp(tag, "dont_check_file_sizes")) { + dont_check_file_sizes = get_bool(contents); + } else if (!strcmp(tag, "ncpus")) { + ncpus = get_int(contents); + } else { + msg_printf(NULL, MSG_ERROR, "Unparsed tag in %s: %s\n", + CONFIG_FILE, tag + ); + } + } + return ERR_XML_PARSE; +} + int CONFIG::parse(FILE* f) { char tag[256], contents[1024]; @@ -103,17 +123,13 @@ int CONFIG::parse(FILE* f) { if (strstr(tag, "?xml")) get_tag(f, tag); if (strcmp(tag, "cc_config")) return ERR_XML_PARSE; - while (get_tag(f, tag, contents)) { + while (get_tag(f, tag)) { if (!strcmp(tag, "/cc_config")) return 0; if (!strcmp(tag, "log_flags")) { log_flags.parse(f); continue; - } else if (!strcmp(tag, "save_stats_days")) { - save_stats_days = get_int(contents); - } else if (!strcmp(tag, "dont_check_file_sizes")) { - dont_check_file_sizes = get_bool(contents); - } else if (!strcmp(tag, "ncpus")) { - ncpus = get_int(contents); + } else if (!strcmp(tag, "options")) { + parse_options(f); } else { msg_printf(NULL, MSG_ERROR, "Unparsed tag in %s: %s\n", CONFIG_FILE, tag diff --git a/client/log_flags.h b/client/log_flags.h index 016da62b74..86c20ca788 100644 --- a/client/log_flags.h +++ b/client/log_flags.h @@ -73,6 +73,7 @@ struct CONFIG { int ncpus; CONFIG(); int parse(FILE*); + int parse_options(FILE*); }; extern LOG_FLAGS log_flags; diff --git a/lib/parse.C b/lib/parse.C index 558dd70b9d..d204bca325 100644 --- a/lib/parse.C +++ b/lib/parse.C @@ -408,6 +408,14 @@ int skip_unrecognized(char* buf, FILE* in) { } // Get next XML element or tag. +// +// NOTE: this can't be used for XML docs that have +// nested elements and data elements at the same level, i.e. +// +// 1 +// +// asdf +// // If it's a close tag, or the contents pointer is NULL, just return the tag. // Otherwise return the contents also. //