From 4bf3f7f51a5781079324311246e996aeb8975186 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Sun, 3 Feb 2013 10:22:32 -0800 Subject: [PATCH 1/7] - client: fix copy_element_contents() to remove assumption that the end tag is on a line by itself. (this broke things if gui_urls.xml didn't end with a CRLF). --- lib/parse.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/parse.cpp b/lib/parse.cpp index 824975a717..381358c821 100644 --- a/lib/parse.cpp +++ b/lib/parse.cpp @@ -229,14 +229,23 @@ int copy_element_contents(FILE* in, const char* end_tag, char* p, int len) { } int copy_element_contents(FILE* in, const char* end_tag, string& str) { - char buf[256]; + int c; + size_t end_tag_len = strlen(end_tag); + size_t n = 0; str = ""; - while (fgets(buf, 256, in)) { - if (strstr(buf, end_tag)) { - return 0; + while (1) { + c = fgetc(in); + if (c == EOF) break; + if (n >= end_tag_len) { + const char* p = str.c_str() + n - end_tag_len; + if (!strcmp(p, end_tag)) { + str.erase(n-end_tag_len, end_tag_len); + return 0; + } } - str += buf; + str += c; + n++; } return ERR_XML_PARSE; } From 06eadde310976082d8b821cf67e1a0bfb59415a9 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Feb 2013 14:40:34 -0800 Subject: [PATCH 2/7] - client (Unix): check whether VBoxManager is executable by us before trying to run it. Otherwise we get lots of msgs in stderr. --- client/hostinfo_unix.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/hostinfo_unix.cpp b/client/hostinfo_unix.cpp index 67157b830f..7685873f49 100644 --- a/client/hostinfo_unix.cpp +++ b/client/hostinfo_unix.cpp @@ -1315,6 +1315,9 @@ int HOST_INFO::get_virtualbox_version() { if (boinc_file_exists(path)) { #if LINUX_LIKE_SYSTEM + if (access(path, X_OK)) { + return 0; + } safe_strcpy(cmd, path); safe_strcat(cmd, " --version"); #elif defined( __APPLE__) From bc38f557e1951f9c6d3afa09156571ed01732e86 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Feb 2013 14:53:18 -0800 Subject: [PATCH 3/7] - admin web: fix spurious error in manage user page --- html/ops/manage_user.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/ops/manage_user.php b/html/ops/manage_user.php index 2ff10ff65e..a5f0e0729d 100644 --- a/html/ops/manage_user.php +++ b/html/ops/manage_user.php @@ -37,6 +37,7 @@ db_init(); $is_admin = true; $Nbf = sizeof($special_user_bitfield); +$q = null; // Delete a user (or at least try to) // @@ -132,7 +133,9 @@ $id = get_int("userid", true); if (!$id) { $id = post_int("userid", true); } +if (!$id) error_page("No ID given"); $user = lookup_user_id($id); +if (!$user) error_page("No such user: $id"); // but clear if page was reset (forcing search form) From 876113ddd5e07b88a4432a2f6427920589781bae Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Feb 2013 15:07:51 -0800 Subject: [PATCH 4/7] - PHP comment tweak --- html/inc/forum.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/html/inc/forum.inc b/html/inc/forum.inc index 9edd658816..ce5e740bb3 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -596,10 +596,11 @@ function show_post( echo tra("Credit: %1", number_format($user->total_credit)) ."
"; echo tra("RAC: %1", number_format($user->expavg_credit))."
"; } + // to use this feature: // - get flags from http://www.famfamfam.com/lab/icons/flags/famfamfam_flag_icons.zip // - put the .png's in html/user/flags/ - // - put define(COUNTRY_FLAGS, 1) in your html/project/project.inc + // - put define("COUNTRY_FLAGS", 1); in your html/project/project.inc // if (defined("COUNTRY_FLAGS")) { if (array_key_exists($user->country, $country_to_iso3166_2)) { From 8d71408978293250cf7220d9b271b115a379f5b6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Feb 2013 15:51:15 -0800 Subject: [PATCH 5/7] Manager: right-justify task deadline in advanced view --- clientgui/ViewWork.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clientgui/ViewWork.cpp b/clientgui/ViewWork.cpp index e538255924..037b903b75 100644 --- a/clientgui/ViewWork.cpp +++ b/clientgui/ViewWork.cpp @@ -233,7 +233,7 @@ CViewWork::CViewWork(wxNotebook* pNotebook) : m_pListPane->InsertColumn(COLUMN_STATUS, _("Status"), wxLIST_FORMAT_LEFT, 135); m_pListPane->InsertColumn(COLUMN_CPUTIME, _("Elapsed"), wxLIST_FORMAT_RIGHT, 80); m_pListPane->InsertColumn(COLUMN_TOCOMPLETION, _("Remaining (estimated)"), wxLIST_FORMAT_RIGHT, 100); - m_pListPane->InsertColumn(COLUMN_REPORTDEADLINE, _("Deadline"), wxLIST_FORMAT_LEFT, 150); + m_pListPane->InsertColumn(COLUMN_REPORTDEADLINE, _("Deadline"), wxLIST_FORMAT_RIGHT, 150); m_pListPane->InsertColumn(COLUMN_APPLICATION, _("Application"), wxLIST_FORMAT_LEFT, 95); m_pListPane->InsertColumn(COLUMN_NAME, _("Name"), wxLIST_FORMAT_LEFT, 285); From 6352f9ca9d7ff85d2e9038c9a52ad31b7d1bcab6 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 11 Feb 2013 16:36:20 -0800 Subject: [PATCH 6/7] - client (Android): forget hysteresis policy; don't compute if < 95% charged. --- client/cs_prefs.cpp | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/client/cs_prefs.cpp b/client/cs_prefs.cpp index 07c420cbd2..c684bb0b6a 100644 --- a/client/cs_prefs.cpp +++ b/client/cs_prefs.cpp @@ -277,24 +277,12 @@ int CLIENT_STATE::check_suspend_processing() { // on some devices, running jobs can drain the battery even // while it's recharging. - // So use the following hysteresis policy: - // start computing when the batter is 95% charged. - // stop computing if it falls below 90%. - // Repeat. + // So compute only if 95% charged or more. // - static bool hyst_state = true; int cp = host_info.battery_charge_pct; - if (cp >= 0) { - if (cp < 90) { - hyst_state = true; - return SUSPEND_REASON_BATTERY_CHARGING; - } + if (cp >= 0) if (cp < 95) { - if (hyst_state) { - return SUSPEND_REASON_BATTERY_CHARGING; - } - } else { - hyst_state = false; + return SUSPEND_REASON_BATTERY_CHARGING; } } #endif From dbb669fc10816728112ca1b8715cf7d6c62cb825 Mon Sep 17 00:00:00 2001 From: Charlie Fenton Date: Mon, 11 Feb 2013 18:53:03 -0800 Subject: [PATCH 7/7] Fix wild card in Exclusive Apps dialog for Linux (from Gianfranco Costamagna) --- clientgui/DlgAdvPreferences.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clientgui/DlgAdvPreferences.cpp b/clientgui/DlgAdvPreferences.cpp index 4ec5951543..909b16f3a0 100644 --- a/clientgui/DlgAdvPreferences.cpp +++ b/clientgui/DlgAdvPreferences.cpp @@ -800,9 +800,9 @@ void CDlgAdvPreferences::OnAddExclusiveApp(wxCommandEvent&) { wxT("C:/Program Files"), wxT(""), wxT("*.exe"), wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_CHANGE_DIR|wxFD_MULTIPLE|wxFD_CHANGE_DIR); #else -//TODO: fill in the default directory and wildcard for Linux +//TODO: fill in the default directory for Linux wxFileDialog picker(this, _("Applications to add"), - wxT("/"), wxT(""), wxT("*.*"), + wxT("/"), wxT(""), wxT("*"), wxFD_OPEN|wxFD_FILE_MUST_EXIST|wxFD_CHANGE_DIR|wxFD_MULTIPLE|wxFD_CHANGE_DIR); #endif if (picker.ShowModal() != wxID_OK) return;