mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc/; revision=5315
This commit is contained in:
parent
55cb78adc4
commit
867a2fc1fe
|
@ -23981,3 +23981,13 @@ Janus 4 Feb 2005
|
||||||
html/inc/
|
html/inc/
|
||||||
sanitize_html.php
|
sanitize_html.php
|
||||||
|
|
||||||
|
Rom 4 Feb 2005
|
||||||
|
- Bug Fix: Surround the calls to atol and atof in parse_int and parse_double
|
||||||
|
with setlocale calls so that we can parse numerical types from the core
|
||||||
|
client even while the manager is configured for a different locale.
|
||||||
|
|
||||||
|
lib/
|
||||||
|
boinc_win.h
|
||||||
|
parse.C
|
||||||
|
|
||||||
|
|
|
@ -89,6 +89,7 @@
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <locale>
|
||||||
#else
|
#else
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
@ -100,6 +101,7 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// C++ headers
|
// C++ headers
|
||||||
|
@ -113,7 +115,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <locale>
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <locale>
|
||||||
#include <string>
|
#include <string>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -62,7 +63,10 @@ bool match_tag(const std::string &s, const char* tag) {
|
||||||
bool parse_int(const char* buf, const char* tag, int& x) {
|
bool parse_int(const char* buf, const char* tag, int& x) {
|
||||||
char* p = strstr(buf, tag);
|
char* p = strstr(buf, tag);
|
||||||
if (!p) return false;
|
if (!p) return false;
|
||||||
|
std::string strLocale = setlocale(LC_NUMERIC, NULL);
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
x = strtol(p+strlen(tag), 0, 0); // this parses 0xabcd correctly
|
x = strtol(p+strlen(tag), 0, 0); // this parses 0xabcd correctly
|
||||||
|
setlocale(LC_NUMERIC, strLocale.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +75,10 @@ bool parse_int(const char* buf, const char* tag, int& x) {
|
||||||
bool parse_double(const char* buf, const char* tag, double& x) {
|
bool parse_double(const char* buf, const char* tag, double& x) {
|
||||||
char* p = strstr(buf, tag);
|
char* p = strstr(buf, tag);
|
||||||
if (!p) return false;
|
if (!p) return false;
|
||||||
|
std::string strLocale = setlocale(LC_NUMERIC, NULL);
|
||||||
|
setlocale(LC_NUMERIC, "C");
|
||||||
x = atof(p+strlen(tag));
|
x = atof(p+strlen(tag));
|
||||||
|
setlocale(LC_NUMERIC, strLocale.c_str());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue