Commit df038ec5 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Added _ui64toa_s implementation.

parent 100e925c
......@@ -994,7 +994,7 @@
@ extern _tzname msvcrt._tzname
@ cdecl _tzset() msvcrt._tzset
@ cdecl _ui64toa(long long ptr long) msvcrt._ui64toa
@ stub _ui64toa_s
@ cdecl _ui64toa_s(long ptr long long) msvcrt._ui64toa_s
@ cdecl _ui64tow(long long ptr long) msvcrt._ui64tow
@ stub _ui64tow_s
@ cdecl _ultoa(long ptr long) msvcrt._ultoa
......
......@@ -981,7 +981,7 @@
@ extern _tzname msvcrt._tzname
@ cdecl _tzset() msvcrt._tzset
@ cdecl _ui64toa(long long ptr long) msvcrt._ui64toa
@ stub _ui64toa_s
@ cdecl _ui64toa_s(long ptr long long) msvcrt._ui64toa_s
@ cdecl _ui64tow(long long ptr long) msvcrt._ui64tow
@ stub _ui64tow_s
@ cdecl _ultoa(long ptr long) msvcrt._ultoa
......
......@@ -932,7 +932,7 @@
@ extern _tzname MSVCRT__tzname
@ cdecl _tzset() MSVCRT__tzset
@ cdecl _ui64toa(long long ptr long) ntdll._ui64toa
# stub _ui64toa_s
@ cdecl _ui64toa_s(long ptr long long) MSVCRT__ui64toa_s
@ cdecl _ui64tow(long long ptr long) ntdll._ui64tow
# stub _ui64tow_s
@ cdecl _ultoa(long ptr long) ntdll._ultoa
......
......@@ -624,3 +624,41 @@ unsigned __int64 CDECL MSVCRT_strtoui64(const char *nptr, char **endptr, int bas
{
return MSVCRT_strtoui64_l(nptr, endptr, base, NULL);
}
/*********************************************************************
* _ui64toa_s (MSVCRT.@)
*/
int CDECL MSVCRT__ui64toa_s(unsigned __int64 value, char *str,
MSVCRT_size_t size, int radix)
{
char buffer[65], *pos;
int digit;
if(!str || radix<2 || radix>36) {
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
*MSVCRT__errno() = MSVCRT_EINVAL;
return MSVCRT_EINVAL;
}
pos = buffer+64;
*pos = '\0';
do {
digit = value%radix;
value /= radix;
if(digit < 10)
*--pos = '0'+digit;
else
*--pos = 'a'+digit-10;
}while(value != 0);
if(buffer-pos+65 > size) {
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
*MSVCRT__errno() = MSVCRT_EINVAL;
return MSVCRT_EINVAL;
}
memcpy(str, pos, buffer-pos+65);
return 0;
}
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