mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 09:32:32 +01:00
Fixed build on vs2k8
stoll() was introduced in vs2010 so we use _strtoi64() in parseLL() instead.
This commit is contained in:
parent
b133d42c47
commit
e9c784dcd5
12
util/text.h
12
util/text.h
@ -125,6 +125,7 @@ namespace mongo {
|
||||
ret = strtoll( n, &endPtr, 10 );
|
||||
uassert( 13305, "could not convert string to long long", *endPtr == 0 && errno == 0 );
|
||||
#else
|
||||
#if _MSC_VER>=1600 // 1600 is VS2k10 1500 is VS2k8
|
||||
size_t endLen = 0;
|
||||
try {
|
||||
ret = stoll( n, &endLen, 10 );
|
||||
@ -132,7 +133,16 @@ namespace mongo {
|
||||
endLen = 0;
|
||||
}
|
||||
uassert( 13306, "could not convert string to long long", endLen != 0 && n[ endLen ] == 0 );
|
||||
#endif
|
||||
#else // stoll() wasn't introduced until VS 2010.
|
||||
char* endPtr = (char *)&n[strlen(n) - 1];
|
||||
try {
|
||||
ret = _strtoi64( n, &endPtr, 10 );
|
||||
} catch ( ... ) {
|
||||
endPtr = 0;
|
||||
}
|
||||
uassert( 13310, "could not convert string to long long", *endPtr == 0 );
|
||||
#endif // _MSC_VER >= 16
|
||||
#endif // !defined(_WIN32)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user