mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-15 04:59:26 +00:00
ntdll: Add _ui64toa_s.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
c45abb8a7c
commit
4e269f75ec
|
@ -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)
|
||||
|
|
|
@ -1213,6 +1213,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.@)
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue