Changeset 96056 in vbox for trunk/src/VBox/Runtime/common/string
- Timestamp:
- Aug 5, 2022 11:03:58 AM (2 years ago)
- Location:
- trunk/src/VBox/Runtime/common/string
- Files:
-
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/string/nocrt-strtoll.cpp
r96053 r96056 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - No-CRT - strtol .3 * IPRT - No-CRT - strtoll. 4 4 */ 5 5 … … 37 37 38 38 39 #undef strtol 40 long RT_NOCRT(strtol)(const char *psz, char **ppszNext, int iBase)39 #undef strtoll 40 long long RT_NOCRT(strtoll)(const char *psz, char **ppszNext, int iBase) 41 41 { 42 #if L ONG_BIT == 6442 #if LLONG_BIT == 64 43 43 int64_t iValue = 0; 44 44 int rc = RTStrToInt64Ex(psz, ppszNext, (unsigned)iBase, &iValue); 45 #elif LONG_BIT == 3246 int32_t iValue = 0;47 int rc = RTStrToInt32Ex(psz, ppszNext, (unsigned)iBase, &iValue);48 45 #else 49 # error "Unsupported L ONG_BIT value"46 # error "Unsupported LLONG_BIT value" 50 47 #endif 51 48 if (rc == VINF_SUCCESS || rc == VWRN_TRAILING_CHARS || rc == VWRN_TRAILING_SPACES) -
trunk/src/VBox/Runtime/common/string/nocrt-strtoul.cpp
r96053 r96056 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - No-CRT - strto l.3 * IPRT - No-CRT - strtoul. 4 4 */ 5 5 … … 37 37 38 38 39 #undef strto l40 long RT_NOCRT(strto l)(const char *psz, char **ppszNext, int iBase)39 #undef strtoul 40 long RT_NOCRT(strtoul)(const char *psz, char **ppszNext, int iBase) 41 41 { 42 #if LONG_BIT == 6443 int64_t iValue = 0;44 int rc = RTStrTo Int64Ex(psz, ppszNext, (unsigned)iBase, &iValue);45 #elif LONG_BIT == 3246 int32_t iValue = 0;47 int rc = RTStrTo Int32Ex(psz, ppszNext, (unsigned)iBase, &iValue);42 #if ULONG_BIT == 64 43 uint64_t uValue = 0; 44 int rc = RTStrToUInt64Ex(psz, ppszNext, (unsigned)iBase, &uiValue); 45 #elif ULONG_BIT == 32 46 int32_t uValue = 0; 47 int rc = RTStrToUInt32Ex(psz, ppszNext, (unsigned)iBase, &uiValue); 48 48 #else 49 49 # error "Unsupported LONG_BIT value" 50 50 #endif 51 if (rc == VINF_SUCCESS || rc == VWRN_TRAILING_CHARS || rc == VWRN_TRAILING_SPACES )52 return iValue;51 if (rc == VINF_SUCCESS || rc == VWRN_TRAILING_CHARS || rc == VWRN_TRAILING_SPACES || rc == VWRN_NEGATIVE_UNSIGNED) 52 return uValue; 53 53 if (rc == VWRN_NUMBER_TOO_BIG) 54 54 { 55 55 errno = ERANGE; 56 return iValue < 0 ? LONG_MIN :LONG_MAX;56 return ULONG_MAX; 57 57 } 58 58 errno = EINVAL;
Note:
See TracChangeset
for help on using the changeset viewer.