From 6e1414a07f6df8c01c33a170226995abe03541eb Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 15 Nov 2011 00:11:12 +0000 Subject: [PATCH] - scheduler: increase buffer for global prefs from 8K to 64K - lay the groundwork for changing it to std::string svn path=/trunk/boinc/; revision=24595 --- checkin_notes | 9 +++++++++ lib/parse.cpp | 23 +++++++++++++++++++++++ lib/parse.h | 1 + sched/sched_types.cpp | 2 +- 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/checkin_notes b/checkin_notes index e0da49d484..2a2017d3c3 100644 --- a/checkin_notes +++ b/checkin_notes @@ -8462,3 +8462,12 @@ David 14 Nov 2011 client/ log_flags.cpp + +David 14 Nov 2011 + - scheduler: increase buffer for global prefs from 8K to 64K + - lay the groundwork for changing it to std::string + + sched/ + sched_types.cpp + lib/ + parse.cpp,h diff --git a/lib/parse.cpp b/lib/parse.cpp index 8c3f8a012f..404b520561 100644 --- a/lib/parse.cpp +++ b/lib/parse.cpp @@ -963,6 +963,29 @@ int XML_PARSER::element_contents(const char* end_tag, char* buf, int buflen) { return retval; } +#if 0 +int XML_PARSER::element_contents(const char* end_tag, string& buf) { + int retval=0; + while (1) { + int c = f->_getc(); + if (c == EOF) { + retval = ERR_XML_PARSE; + break; + } + buf += c; + char* p = strstr(buf.c_str(), end_tag); + if (p) { + int k = strlen(end_tag); + int n = buf.length(); + buf.erase(n-k, k); + break; + } + } + strip_whitespace(buf); + return retval; +} +#endif + // We got an unexpected tag. // If it's an end tag, do nothing. // Otherwise skip until the end tag, if any diff --git a/lib/parse.h b/lib/parse.h index 716c6a2e0a..125f7d995b 100644 --- a/lib/parse.h +++ b/lib/parse.h @@ -60,6 +60,7 @@ public: bool parse_ulonglong(const char*, unsigned long long&); bool parse_bool(const char*, bool&); int element_contents(const char*, char*, int); + int element_contents(const char*, std::string&); int copy_element(std::string&); void skip_unexpected(const char*, bool verbose, const char*); void skip_unexpected(bool verbose=false, const char* msg="") { diff --git a/sched/sched_types.cpp b/sched/sched_types.cpp index 36afbd5802..6002a738c9 100644 --- a/sched/sched_types.cpp +++ b/sched/sched_types.cpp @@ -280,7 +280,7 @@ const char* SCHEDULER_REQUEST::parse(XML_PARSER& xp) { if (xp.parse_double("duration_correction_factor", host.duration_correction_factor)) continue; if (xp.match_tag("global_preferences")) { strcpy(global_prefs_xml, "\n"); - char buf[8192]; + char buf[BLOB_SIZE]; retval = xp.element_contents( "", buf, sizeof(buf) );