client: fix Linux compile erros

svn path=/trunk/boinc/; revision=24042
This commit is contained in:
Charlie Fenton 2011-08-25 08:18:12 +00:00
parent f30f4eb3b1
commit 1ab3080e8f
2 changed files with 9 additions and 4 deletions

View File

@ -5065,7 +5065,9 @@ David 24 Aug 2011
app_start.cpp
Charlie 25 Aug 2011
- client: fix Linux compile warnings.
- client: fix Linux compile erros and warnings.
client/
coproc_detect.cpp
lib/
parse.h

View File

@ -78,9 +78,12 @@ inline bool match_tag(const std::string &s, const char* tag) {
return match_tag(s.c_str(), tag);
}
//TODO: use strtoull() when available
#ifdef _WIN32
#define strtoull _strtoui64
#elif !defined(__APPLE__)
#define boinc_strtoull _strtoui64
#elif defined(__APPLE__)
#define boinc_strtoull strtoull
#else
inline unsigned long long strtoull(const char *s, char **, int) {
char buf[64];
char *p;
@ -141,7 +144,7 @@ inline bool parse_ulong(const char* buf, const char* tag, unsigned long& x) {
inline bool parse_cl_ulong(const char* buf, const char* tag, cl_ulong& x) {
const char* p = strstr(buf, tag);
if (!p) return false;
unsigned long long y = strtoull(p+strlen(tag), NULL, 0); // this parses 0xabcd correctly
unsigned long long y = boinc_strtoull(p+strlen(tag), NULL, 0); // this parses 0xabcd correctly
if (errno == ERANGE) return false;
x = y;
return true;