3535
3636#include < cctype>
3737#include < cmath>
38- #include < cstdlib>
3938#include < cstring>
4039#include < cstdint>
4140#include < algorithm>
4241
42+ #if defined(__ANDROID__)
43+ #include < stdlib.h>
44+ #else
45+ #include < cstdlib>
46+ #endif
47+
4348namespace sjson
4449{
50+ namespace impl
51+ {
52+ inline unsigned long long int strtoull (const char * str, char ** endptr, int base)
53+ {
54+ #if defined(__ANDROID__)
55+ return ::strtoull (str, endptr, base);
56+ #else
57+ return std::strtoull (str, endptr, base);
58+ #endif
59+ }
60+
61+ inline long long int strtoll (const char * str, char ** endptr, int base)
62+ {
63+ #if defined(__ANDROID__)
64+ return ::strtoll (str, endptr, base);
65+ #else
66+ return std::strtoll (str, endptr, base);
67+ #endif
68+ }
69+ }
70+
4571 class Parser
4672 {
4773 public:
@@ -749,7 +775,7 @@ namespace sjson
749775 char * last_used_symbol = nullptr ;
750776 if (std::is_unsigned<IntegralType>::value)
751777 {
752- uint64_t raw_value = std ::strtoull (slice, &last_used_symbol, base);
778+ const uint64_t raw_value = impl ::strtoull (slice, &last_used_symbol, base);
753779 value = static_cast <IntegralType>(raw_value);
754780
755781 if (static_cast <uint64_t >(value) != raw_value)
@@ -760,7 +786,7 @@ namespace sjson
760786 }
761787 else
762788 {
763- int64_t raw_value = std ::strtoll (slice, &last_used_symbol, base);
789+ const int64_t raw_value = impl ::strtoll (slice, &last_used_symbol, base);
764790 value = static_cast <IntegralType>(raw_value);
765791
766792 if (static_cast <int64_t >(value) != raw_value)
0 commit comments