- Timestamp:
- Aug 5, 2022 11:27:49 AM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 152858
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 5 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r96058 r96059 1806 1806 common/string/nocrt-strtoul.cpp \ 1807 1807 common/string/nocrt-strtoull.cpp \ 1808 common/string/atoi.cpp \ 1808 1809 common/string/strtok_r.cpp \ 1809 1810 r3/nocrt-per-thread-1.cpp \ -
trunk/src/VBox/Runtime/common/string/atoi.cpp
r96053 r96059 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - No-CRT - strtol.3 * IPRT - No-CRT - atoi. 4 4 */ 5 5 … … 33 33 #include <iprt/nocrt/stdlib.h> 34 34 #include <iprt/nocrt/limits.h> 35 #include <iprt/nocrt/errno.h>36 35 #include <iprt/string.h> 37 36 38 37 39 #undef strtol40 long RT_NOCRT(strtol)(const char *psz, char **ppszNext, int iBase)38 #undef atoi 39 int RT_NOCRT(atoi)(const char *psz) 41 40 { 42 #if LONG_BIT == 64 43 int64_t iValue = 0; 44 int rc = RTStrToInt64Ex(psz, ppszNext, (unsigned)iBase, &iValue); 45 #elif LONG_BIT == 32 41 #if INT_MAX == INT32_MAX 46 42 int32_t iValue = 0; 47 int rc = RTStrToInt32Ex(psz, ppszNext, (unsigned)iBase, &iValue);43 int rc = RTStrToInt32Ex(psz, NULL, 10, &iValue); 48 44 #else 49 # error "Unsupported LONG_BIT value"45 # error "Unsupported integer size" 50 46 #endif 51 47 if (rc == VINF_SUCCESS || rc == VWRN_TRAILING_CHARS || rc == VWRN_TRAILING_SPACES) 52 48 return iValue; 53 49 if (rc == VWRN_NUMBER_TOO_BIG) 54 { 55 errno = ERANGE; 56 return iValue < 0 ? LONG_MIN : LONG_MAX; 57 } 58 errno = EINVAL; 50 return iValue < 0 ? INT_MIN : INT_MAX; 59 51 return 0; 60 52 } 53 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(atoi); 61 54 -
trunk/src/VBox/Runtime/common/string/nocrt-strtol.cpp
r96053 r96059 59 59 return 0; 60 60 } 61 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strtol); 61 62 -
trunk/src/VBox/Runtime/common/string/nocrt-strtoll.cpp
r96056 r96059 56 56 return 0; 57 57 } 58 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strtoll); 58 59 -
trunk/src/VBox/Runtime/common/string/nocrt-strtoul.cpp
r96057 r96059 60 60 return 0; 61 61 } 62 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strtoul); 62 63 -
trunk/src/VBox/Runtime/common/string/nocrt-strtoull.cpp
r96058 r96059 57 57 return 0; 58 58 } 59 RT_ALIAS_AND_EXPORT_NOCRT_SYMBOL(strtoull); 59 60
Note:
See TracChangeset
for help on using the changeset viewer.