Enable long long support for C++11 and for MSVC 2008+

git-svn-id: http://pugixml.googlecode.com/svn/trunk@967 99668b35-9821-0410-8761-19e4c4f06640
This commit is contained in:
Arseny Kapoulkine 2014-02-08 21:59:14 +00:00
parent 44d3ae5e90
commit 2bd99cff86
2 changed files with 29 additions and 4 deletions

View File

@ -3394,10 +3394,18 @@ PUGI__NS_BEGIN
int base = get_integer_base(value); int base = get_integer_base(value);
#ifdef PUGIXML_WCHAR_MODE #ifdef PUGIXML_WCHAR_MODE
#ifdef PUGI__MSVC_CRT_VERSION
return _wcstoi64(value, 0, base);
#else
return wcstoll(value, 0, base); return wcstoll(value, 0, base);
#endif
#else
#ifdef PUGI__MSVC_CRT_VERSION
return _strtoi64(value, 0, base);
#else #else
return strtoll(value, 0, base); return strtoll(value, 0, base);
#endif #endif
#endif
} }
PUGI__FN unsigned long long get_value_ullong(const char_t* value, unsigned long long def) PUGI__FN unsigned long long get_value_ullong(const char_t* value, unsigned long long def)
@ -3407,10 +3415,18 @@ PUGI__NS_BEGIN
int base = get_integer_base(value); int base = get_integer_base(value);
#ifdef PUGIXML_WCHAR_MODE #ifdef PUGIXML_WCHAR_MODE
#ifdef PUGI__MSVC_CRT_VERSION
return _wcstoui64(value, 0, base);
#else
return wcstoull(value, 0, base); return wcstoull(value, 0, base);
#endif
#else
#ifdef PUGI__MSVC_CRT_VERSION
return _strtoui64(value, 0, base);
#else #else
return strtoull(value, 0, base); return strtoull(value, 0, base);
#endif #endif
#endif
} }
#endif #endif

View File

@ -63,6 +63,15 @@
# define PUGIXML_FUNCTION PUGIXML_API # define PUGIXML_FUNCTION PUGIXML_API
#endif #endif
// If the platform is known to have long long support, enable long long functions
#ifndef PUGIXML_HAS_LONG_LONG
# if defined(__cplusplus) && __cplusplus >= 201103
# define PUGIXML_HAS_LONG_LONG
# elif defined(_MSC_VER) && _MSC_VER >= 1400
# define PUGIXML_HAS_LONG_LONG
# endif
#endif
// Character interface macros // Character interface macros
#ifdef PUGIXML_WCHAR_MODE #ifdef PUGIXML_WCHAR_MODE
# define PUGIXML_TEXT(t) L ## t # define PUGIXML_TEXT(t) L ## t