Commit ee60c49d authored by Lei Zhang's avatar Lei Zhang Committed by Alexandre Julliard

ntdll: Use our own implementation of atoi and atol.

parent 960ae6fe
......@@ -465,24 +465,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.@)
*
* Convert an unsigned long integer to a string.
......@@ -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;
......@@ -753,6 +735,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.@)
*/
int __cdecl NTDLL_sprintf( char *str, const char *format, ... )
......
......@@ -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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment