diff options
Diffstat (limited to 'src/3rdparty/double-conversion/double-conversion/utils.h')
-rw-r--r-- | src/3rdparty/double-conversion/double-conversion/utils.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/3rdparty/double-conversion/double-conversion/utils.h b/src/3rdparty/double-conversion/double-conversion/utils.h index 41078b6c2c..4f4dd71bf7 100644 --- a/src/3rdparty/double-conversion/double-conversion/utils.h +++ b/src/3rdparty/double-conversion/double-conversion/utils.h @@ -34,6 +34,13 @@ #include <cstdlib> #include <cstring> +// For pre-C++11 compatibility +#if __cplusplus >= 201103L +#define DOUBLE_CONVERSION_NULLPTR nullptr +#else +#define DOUBLE_CONVERSION_NULLPTR NULL +#endif + #include <cassert> #ifndef DOUBLE_CONVERSION_ASSERT #define DOUBLE_CONVERSION_ASSERT(condition) \ @@ -241,9 +248,9 @@ inline int StrLength(const char* string) { template <typename T> class Vector { public: - Vector() : start_(NULL), length_(0) {} + Vector() : start_(DOUBLE_CONVERSION_NULLPTR), length_(0) {} Vector(T* data, int len) : start_(data), length_(len) { - DOUBLE_CONVERSION_ASSERT(len == 0 || (len > 0 && data != NULL)); + DOUBLE_CONVERSION_ASSERT(len == 0 || (len > 0 && data != DOUBLE_CONVERSION_NULLPTR)); } // Returns a vector using the same backing storage as this one, @@ -326,7 +333,7 @@ class StringBuilder { void AddSubstring(const char* s, int n) { DOUBLE_CONVERSION_ASSERT(!is_finalized() && position_ + n < buffer_.length()); DOUBLE_CONVERSION_ASSERT(static_cast<size_t>(n) <= strlen(s)); - memmove(&buffer_[position_], s, n); + memmove(&buffer_[position_], s, static_cast<size_t>(n)); position_ += n; } |