Commit 4e269f75 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Add _ui64toa_s.

parent c45abb8a
......@@ -1531,9 +1531,11 @@
@ cdecl _tolower(long)
@ cdecl _toupper(long)
@ cdecl _ui64toa(int64 ptr long)
@ cdecl _ui64toa_s(int64 ptr long long)
@ cdecl _ui64tow(int64 ptr long)
@ cdecl _ui64tow_s(int64 ptr long long)
@ cdecl _ultoa(long ptr long)
@ cdecl _ultoa_s(long ptr long long)
@ cdecl _ultow(long ptr long)
@ cdecl _ultow_s(long ptr long long)
@ cdecl -norelay _vsnprintf(ptr long str ptr)
......
......@@ -1214,6 +1214,51 @@ char * __cdecl _i64toa(
/*********************************************************************
* _ui64toa_s (NTDLL.@)
*/
errno_t __cdecl _ui64toa_s( unsigned __int64 value, char *str, size_t size, int radix )
{
char buffer[65], *pos;
if (!str || !size) return EINVAL;
if (radix < 2 || radix > 36)
{
str[0] = 0;
return EINVAL;
}
pos = buffer + 64;
*pos = 0;
do {
int digit = value % radix;
value = value / radix;
if (digit < 10)
*--pos = '0' + digit;
else
*--pos = 'a' + digit - 10;
} while (value != 0);
if (buffer - pos + 65 > size)
{
str[0] = 0;
return ERANGE;
}
memcpy( str, pos, buffer - pos + 65 );
return 0;
}
/*********************************************************************
* _ultoa_s (NTDLL.@)
*/
errno_t __cdecl _ultoa_s( __msvcrt_ulong value, char *str, size_t size, int radix )
{
return _ui64toa_s( value, str, size, radix );
}
/*********************************************************************
* _atoi64 (NTDLL.@)
*
* Convert a string to a large integer.
......
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