From 431da99db5012608abcb0d8893ad2ddd4668ef2a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 3 Nov 2006 19:24:21 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=11464 --- Makefile.incl | 2 +- checkin_notes | 14 ++++++++++++ client/acct_mgr.C | 50 +++++++++++++++++++++++++----------------- client/acct_mgr.h | 3 +-- doc/compile.php | 2 +- doc/create_project.php | 2 +- doc/example.php | 35 ++++++++++++++++++++++------- lib/boinc_cmd.C | 14 ++++++------ lib/parse.C | 12 +++++----- lib/parse.h | 12 +++++----- 10 files changed, 94 insertions(+), 52 deletions(-) diff --git a/Makefile.incl b/Makefile.incl index 386c063b75..390ae01290 100644 --- a/Makefile.incl +++ b/Makefile.incl @@ -25,7 +25,7 @@ AM_CPPFLAGS = \ AM_CFLAGS = $(AM_CPPFLAGS) AM_CXXFLAGS = $(AM_CPPFLAGS) -AM_LDFLAGS = +AM_LDFLAGS = -L../lib # dependencies to make sure libs gets compiled before # programs linking to them: diff --git a/checkin_notes b/checkin_notes index c3e043cecb..5856a29156 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12137,3 +12137,17 @@ David 3 Nov 2006 clientgui/ MainDocument.cpp,h ViewResources.cpp,h + +David 3 Nov 2006 + - build fix for Gentoo + + Makefile.incl + +David 3 Nov 2006 + - fix gcc compile warnings + + client/ + acct_mgr.C,h + lib/ + boinc_cmd.C + parse.C,h diff --git a/client/acct_mgr.C b/client/acct_mgr.C index cccf8036e8..7ad14ec2c5 100644 --- a/client/acct_mgr.C +++ b/client/acct_mgr.C @@ -506,6 +506,35 @@ ACCT_MGR_INFO::ACCT_MGR_INFO() { clear(); } +int ACCT_MGR_INFO::parse_login_file(FILE* p) { + char tag[1024]; + bool is_tag; + MIOFILE mf; + int retval; + + mf.init_file(p); + XML_PARSER xp(&mf); + if (!xp.parse_start("acct_mgr_login")) { + // + } + while (!xp.get(tag, sizeof(tag), is_tag)) { + if (!is_tag) { + printf("unexpected text: %s\n", tag); + continue; + } + if (!strcmp(tag, "/acct_mgr_login")) break; + else if (xp.parse_str(tag, "login", login_name, 256)) continue; + else if (xp.parse_str(tag, "password_hash", password_hash, 256)) continue; + else if (xp.parse_str(tag, "previous_host_cpid", previous_host_cpid, sizeof(previous_host_cpid))) continue; + else if (xp.parse_double(tag, "next_rpc_time", next_rpc_time)) continue; + else if (!strcmp(tag, "opaque")) { + retval = xp.element_contents("", opaque, sizeof(opaque)); + continue; + } + } + return 0; +} + int ACCT_MGR_INFO::init() { char tag[1024]; bool is_tag; @@ -539,26 +568,7 @@ int ACCT_MGR_INFO::init() { p = fopen(ACCT_MGR_LOGIN_FILENAME, "r"); if (p) { - mf.init_file(p); - XML_PARSER xp(&mf); - if (!xp.parse_start("acct_mgr_login")) { - // - } - while (!xp.get(tag, sizeof(tag), is_tag)) { - if (!is_tag) { - printf("unexpected text: %s\n", tag); - continue; - } - if (!strcmp(tag, "/acct_mgr_login")) break; - else if (xp.parse_str(tag, "login", login_name, 256)) continue; - else if (xp.parse_str(tag, "password_hash", password_hash, 256)) continue; - else if (xp.parse_str(tag, "previous_host_cpid", previous_host_cpid, sizeof(previous_host_cpid))) continue; - else if (xp.parse_double(tag, "next_rpc_time", next_rpc_time)) continue; - else if (!strcmp(tag, "opaque")) { - retval = xp.element_contents("", opaque, sizeof(opaque)); - continue; - } - } + parse_login_file(p); fclose(p); } return 0; diff --git a/client/acct_mgr.h b/client/acct_mgr.h index d3301a7465..a7d2512687 100644 --- a/client/acct_mgr.h +++ b/client/acct_mgr.h @@ -51,8 +51,7 @@ struct ACCT_MGR_INFO { bool password_error; ACCT_MGR_INFO(); - int parse_url(MIOFILE&); - int parse_login(MIOFILE&); + int parse_login_file(FILE*); int write_info(); int init(); void clear(); diff --git a/doc/compile.php b/doc/compile.php index 5c1bae7776..ebe2249e34 100644 --- a/doc/compile.php +++ b/doc/compile.php @@ -7,12 +7,12 @@ echo "

Platform-specific cookbooks

  • Application development diff --git a/doc/example.php b/doc/example.php index 47edbf2f64..f8ba4ad4f7 100644 --- a/doc/example.php +++ b/doc/example.php @@ -5,9 +5,17 @@ page_head("Example applications"); echo " Example applications are contained -in a separate CVS module, boinc_samples -(check this out in the same parent directory as boinc, -and the relative paths will work). +in a separate CVS module, boinc_samples. +To build these applications: + + The example applications are:

    -The boinc_samples tree includes project files for -building the app on Windows (VS 2003) and Mac (xcode). -It also includes a Makefile for building on Linux. -For upper_case, -this produces a separate .so containing the graphics part. +The boinc_samples tree includes project files for the following platforms: +

    "; diff --git a/lib/boinc_cmd.C b/lib/boinc_cmd.C index 023ffd7058..b8094f193a 100644 --- a/lib/boinc_cmd.C +++ b/lib/boinc_cmd.C @@ -448,16 +448,16 @@ int main(int argc, char** argv) { retval = rpc.set_global_prefs_override(s); printf("retval: %d\n", retval); } else if (!strcmp(cmd, "--test3")) { - GLOBAL_PREFS p; - memset(&p, 0, sizeof(p)); - retval = rpc.get_global_prefs_override_struct(p); - printf("retval %d max %d\n", retval, p.max_cpus); + GLOBAL_PREFS gp; + memset(&gp, 0, sizeof(gp)); + retval = rpc.get_global_prefs_override_struct(gp); + printf("retval %d max %d\n", retval, gp.max_cpus); } else if (!strcmp(cmd, "--test4")) { - GLOBAL_PREFS p; + GLOBAL_PREFS gp; GLOBAL_PREFS_MASK m; - p.max_cpus = 2; + gp.max_cpus = 2; m.max_cpus = true; - retval = rpc.set_global_prefs_override_struct(p, m); + retval = rpc.set_global_prefs_override_struct(gp, m); printf("retval %d\n", retval); } else if (!strcmp(cmd, "--quit")) { retval = rpc.quit(); diff --git a/lib/parse.C b/lib/parse.C index fb88a6d692..4009eb7965 100644 --- a/lib/parse.C +++ b/lib/parse.C @@ -500,7 +500,7 @@ bool XML_PARSER::get(char* buf, int len, bool& is_tag) { // and return true. // bool XML_PARSER::parse_str( - char* parsed_tag, char* start_tag, char* buf, int len + char* parsed_tag, const char* start_tag, char* buf, int len ) { bool is_tag, eof; char end_tag[256], tag[256], tmp[64000]; @@ -546,7 +546,7 @@ bool XML_PARSER::parse_str( } bool XML_PARSER::parse_string( - char* parsed_tag, char* start_tag, string& str + char* parsed_tag, const char* start_tag, string& str ) { char buf[8192]; bool flag = parse_str(parsed_tag, start_tag, buf, sizeof(buf)); @@ -557,7 +557,7 @@ bool XML_PARSER::parse_string( // Same, for integers // -bool XML_PARSER::parse_int(char* parsed_tag, char* start_tag, int& i) { +bool XML_PARSER::parse_int(char* parsed_tag, const char* start_tag, int& i) { char buf[256], *end; bool is_tag, eof; char end_tag[256], tag[256]; @@ -581,7 +581,7 @@ bool XML_PARSER::parse_int(char* parsed_tag, char* start_tag, int& i) { // Same, for doubles // -bool XML_PARSER::parse_double(char* parsed_tag, char* start_tag, double& x) { +bool XML_PARSER::parse_double(char* parsed_tag, const char* start_tag, double& x) { char buf[256], *end; bool is_tag, eof; char end_tag[256], tag[256]; @@ -605,7 +605,7 @@ bool XML_PARSER::parse_double(char* parsed_tag, char* start_tag, double& x) { // Same, for bools // -bool XML_PARSER::parse_bool(char* parsed_tag, char* start_tag, bool& b) { +bool XML_PARSER::parse_bool(char* parsed_tag, const char* start_tag, bool& b) { char buf[256], *end; bool is_tag, eof; char end_tag[256], tag[256]; @@ -640,7 +640,7 @@ bool XML_PARSER::parse_bool(char* parsed_tag, char* start_tag, bool& b) { // parse a start tag (optionally preceded by ) // -bool XML_PARSER::parse_start(char* start_tag) { +bool XML_PARSER::parse_start(const char* start_tag) { char tag[256]; bool eof, is_tag; diff --git a/lib/parse.h b/lib/parse.h index efd3b37d16..c2b52b969b 100644 --- a/lib/parse.h +++ b/lib/parse.h @@ -43,12 +43,12 @@ class XML_PARSER { public: XML_PARSER(MIOFILE*); bool get(char*, int, bool&); - bool parse_start(char*); - bool parse_str(char*, char*, char*, int); - bool parse_string(char*, char*, std::string&); - bool parse_int(char*, char*, int&); - bool parse_double(char*, char*, double&); - bool parse_bool(char*, char*, bool&); + bool parse_start(const char*); + bool parse_str(char*, const char*, char*, int); + bool parse_string(char*, const char*, std::string&); + bool parse_int(char*, const char*, int&); + bool parse_double(char*, const char*, double&); + bool parse_bool(char*, const char*, bool&); int element_contents(const char*, char*, int); };