diff --git a/include/cybozu/atoi.hpp b/include/cybozu/atoi.hpp index a22853a..3930571 100644 --- a/include/cybozu/atoi.hpp +++ b/include/cybozu/atoi.hpp @@ -7,7 +7,6 @@ */ #include -#include #include #include @@ -173,7 +172,7 @@ public: } inline operator int() const { - return atoi_local::convertToInt(b_, p_, size_, "2147483648", INT_MIN, 214748364, '8'); + return atoi_local::convertToInt(b_, p_, size_, "2147483648", /*INT_MIN*/-2147483648, 214748364, '8'); } inline operator unsigned int() const { @@ -181,7 +180,7 @@ public: } inline operator long long() const { - return atoi_local::convertToInt(b_, p_, size_, "9223372036854775808", LLONG_MIN, 922337203685477580LL, '8'); + return atoi_local::convertToInt(b_, p_, size_, "9223372036854775808", CYBOZU_LLONG_MIN, 922337203685477580LL, '8'); } inline operator unsigned long long() const { diff --git a/include/cybozu/exception.hpp b/include/cybozu/exception.hpp index f5b044f..a9668ba 100644 --- a/include/cybozu/exception.hpp +++ b/include/cybozu/exception.hpp @@ -203,7 +203,6 @@ public: } /** convert NativeErrNo to string(maybe UTF8) - @param err [in] errno @note Linux : same as ConvertErrorNoToString Windows : for Win32 API(use en-us) */ diff --git a/include/cybozu/inttype.hpp b/include/cybozu/inttype.hpp index 62856bd..f74a1d1 100644 --- a/include/cybozu/inttype.hpp +++ b/include/cybozu/inttype.hpp @@ -72,6 +72,9 @@ #endif #endif +// LLONG_MIN in limits.h is not defined in some env. +#define CYBOZU_LLONG_MIN (-9223372036854775807ll-1) + #define CYBOZU_CPP_VERSION_CPP03 0 #define CYBOZU_CPP_VERSION_TR1 1 #define CYBOZU_CPP_VERSION_CPP11 2 @@ -88,7 +91,7 @@ #define CYBOZU_CPP_VERSION CYBOZU_CPP_VERSION_CPP17 #elif (__cplusplus >= 201402) #define CYBOZU_CPP_VERSION CYBOZU_CPP_VERSION_CPP14 -#elif (__cplusplus >= 201103) || (_MSC_VER >= 1500) || defined(__GXX_EXPERIMENTAL_CXX0X__) +#elif (__cplusplus >= 201103) || (defined(_MSC_VER) && _MSC_VER >= 1500) || defined(__GXX_EXPERIMENTAL_CXX0X__) #if defined(_MSC_VER) && (_MSC_VER <= 1600) #define CYBOZU_CPP_VERSION CYBOZU_CPP_VERSION_TR1 #else @@ -150,8 +153,10 @@ #if CYBOZU_CPP_VERSION >= CYBOZU_CPP_VERSION_CPP11 #define CYBOZU_NOEXCEPT noexcept + #define CYBOZU_NULLPTR nullptr #else #define CYBOZU_NOEXCEPT throw() + #define CYBOZU_NULLPTR 0 #endif namespace cybozu { template diff --git a/include/cybozu/itoa.hpp b/include/cybozu/itoa.hpp index 072e5b8..9686938 100644 --- a/include/cybozu/itoa.hpp +++ b/include/cybozu/itoa.hpp @@ -5,7 +5,6 @@ @author MITSUNARI Shigeo(@herumi) */ -#include #ifndef CYBOZU_DONT_USE_STRING #include #endif @@ -122,7 +121,7 @@ size_t uintToBin(char *buf, size_t bufSize, UT x) template size_t intToDec(char *buf, size_t bufSize, T x) { - if (x == LLONG_MIN) { + if (x == CYBOZU_LLONG_MIN) { const char minStr[] = "-9223372036854775808"; const size_t minStrLen = sizeof(minStr) - 1; if (bufSize < minStrLen) {