| Index: core/src/fxcrt/fx_basic_gcc.cpp
|
| diff --git a/core/src/fxcrt/fx_basic_gcc.cpp b/core/src/fxcrt/fx_basic_gcc.cpp
|
| index d905d6b498464cd4db47119deac8df2b8d61ad93..55531388d3f2af999c98b1124e75935db7ae03f2 100644
|
| --- a/core/src/fxcrt/fx_basic_gcc.cpp
|
| +++ b/core/src/fxcrt/fx_basic_gcc.cpp
|
| @@ -23,10 +23,11 @@ T FXSYS_StrToInt(const FX_CHAR* str) {
|
| }
|
| T num = 0;
|
| while (*str && std::isdigit(*str)) {
|
| - if (num > (std::numeric_limits<T>::max() - 9) / 10)
|
| + T val = FXSYS_toDecimalDigit(*str);
|
| + if (num > (std::numeric_limits<T>::max() - val) / 10)
|
| break;
|
|
|
| - num = num * 10 + FXSYS_toDecimalDigit(*str);
|
| + num = num * 10 + val;
|
| str++;
|
| }
|
| return neg ? -num : num;
|
| @@ -44,10 +45,11 @@ T FXSYS_StrToInt(const FX_WCHAR* str) {
|
| }
|
| T num = 0;
|
| while (*str && std::iswdigit(*str)) {
|
| - if (num > (std::numeric_limits<T>::max() - 9) / 10)
|
| + T val = FXSYS_toDecimalDigitWide(*str);
|
| + if (num > (std::numeric_limits<T>::max() - val) / 10)
|
| break;
|
|
|
| - num = num * 10 + FXSYS_toDecimalDigitWide(*str);
|
| + num = num * 10 + val;
|
| str++;
|
| }
|
| return neg ? -num : num;
|
| @@ -93,6 +95,9 @@ extern "C" {
|
| int32_t FXSYS_atoi(const FX_CHAR* str) {
|
| return FXSYS_StrToInt<int32_t>(str);
|
| }
|
| +uint32_t FXSYS_atoui(const FX_CHAR* str) {
|
| + return FXSYS_StrToInt<uint32_t>(str);
|
| +}
|
| int32_t FXSYS_wtoi(const FX_WCHAR* str) {
|
| return FXSYS_StrToInt<int32_t>(str);
|
| }
|
|
|