ntdll: Use our own implementation of atoi and atol.
This commit is contained in:
parent
960ae6fedb
commit
ee60c49dd6
|
@ -464,24 +464,6 @@ ULONG __cdecl NTDLL_strtoul( const char *nptr, char **endptr, int base )
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* atoi (NTDLL.@)
|
||||
*/
|
||||
int __cdecl NTDLL_atoi( const char *nptr )
|
||||
{
|
||||
return atoi( nptr );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* atol (NTDLL.@)
|
||||
*/
|
||||
LONG __cdecl NTDLL_atol( const char *nptr )
|
||||
{
|
||||
return atol( nptr );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* _ultoa (NTDLL.@)
|
||||
*
|
||||
|
@ -727,7 +709,7 @@ char * __cdecl _i64toa(
|
|||
* - No check is made for value overflow, only the lower 64 bits are assigned.
|
||||
* - If str is NULL it crashes, as the native function does.
|
||||
*/
|
||||
LONGLONG __cdecl _atoi64( char *str )
|
||||
LONGLONG __cdecl _atoi64( const char *str )
|
||||
{
|
||||
ULONGLONG RunningTotal = 0;
|
||||
char bMinus = 0;
|
||||
|
@ -752,6 +734,24 @@ LONGLONG __cdecl _atoi64( char *str )
|
|||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* atoi (NTDLL.@)
|
||||
*/
|
||||
int __cdecl NTDLL_atoi( const char *nptr )
|
||||
{
|
||||
return _atoi64( nptr );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* atol (NTDLL.@)
|
||||
*/
|
||||
LONG __cdecl NTDLL_atol( const char *nptr )
|
||||
{
|
||||
return _atoi64( nptr );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* sprintf (NTDLL.@)
|
||||
*/
|
||||
|
|
|
@ -893,6 +893,31 @@ static void test_wtoi(void)
|
|||
} /* for */
|
||||
}
|
||||
|
||||
static void test_atoi(void)
|
||||
{
|
||||
int test_num;
|
||||
int result;
|
||||
|
||||
for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
|
||||
result = patoi(str2long[test_num].str);
|
||||
ok(result == str2long[test_num].value,
|
||||
"(test %d): call failed: _atoi(\"%s\") has result %d, expected: %d\n",
|
||||
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_atol(void)
|
||||
{
|
||||
int test_num;
|
||||
int result;
|
||||
|
||||
for (test_num = 0; test_num < NB_STR2LONG; test_num++) {
|
||||
result = patol(str2long[test_num].str);
|
||||
ok(result == str2long[test_num].value,
|
||||
"(test %d): call failed: _atol(\"%s\") has result %d, expected: %d\n",
|
||||
test_num, str2long[test_num].str, result, str2long[test_num].value);
|
||||
}
|
||||
}
|
||||
|
||||
static void test_wtol(void)
|
||||
{
|
||||
|
@ -1095,4 +1120,8 @@ START_TEST(string)
|
|||
test_wtoi64();
|
||||
if (p_wcschr && p_wcsrchr)
|
||||
test_wcsfuncs();
|
||||
if (patoi)
|
||||
test_atoi();
|
||||
if (patol)
|
||||
test_atol();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue