Commit d7bc2eff authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

msvcrt: Implemented _ultow_s.

parent a84454aa
......@@ -1202,7 +1202,7 @@
@ cdecl _ultoa(long ptr long) msvcrt._ultoa
@ cdecl _ultoa_s(long ptr long long) msvcrt._ultoa_s
@ cdecl _ultow(long ptr long) msvcrt._ultow
@ stub _ultow_s
@ cdecl _ultow_s(long ptr long long) msvcrt._ultow_s
@ cdecl _umask(long) msvcrt._umask
@ stub _umask_s
@ stub _ungetc_nolock
......
......@@ -1055,7 +1055,7 @@
@ cdecl _ultoa(long ptr long) msvcrt._ultoa
@ cdecl _ultoa_s(long ptr long long) msvcrt._ultoa_s
@ cdecl _ultow(long ptr long) msvcrt._ultow
@ stub _ultow_s
@ cdecl _ultow_s(long ptr long long) msvcrt._ultow_s
@ cdecl _umask(long) msvcrt._umask
@ stub _umask_s
@ stub _ungetc_nolock
......
......@@ -1049,7 +1049,7 @@
@ cdecl _ultoa(long ptr long) msvcrt._ultoa
@ cdecl _ultoa_s(long ptr long long) msvcrt._ultoa_s
@ cdecl _ultow(long ptr long) msvcrt._ultow
@ stub _ultow_s
@ cdecl _ultow_s(long ptr long long) msvcrt._ultow_s
@ cdecl _umask(long) msvcrt._umask
@ stub _umask_s
@ stub _ungetc_nolock
......
......@@ -991,7 +991,7 @@
@ cdecl _ultoa(long ptr long) ntdll._ultoa
@ cdecl _ultoa_s(long ptr long long)
@ cdecl _ultow(long ptr long) ntdll._ultow
# stub _ultow_s(long ptr long long)
@ cdecl _ultow_s(long ptr long long)
@ cdecl _umask(long) MSVCRT__umask
# stub _umask_s(long ptr)
@ cdecl _ungetch(long)
......
......@@ -1288,6 +1288,60 @@ int CDECL _ultoa_s(MSVCRT_ulong value, char *str, MSVCRT_size_t size, int radix)
}
/*********************************************************************
* _ultow_s (MSVCRT.@)
*/
int CDECL _ultow_s(MSVCRT_ulong value, WCHAR *str, MSVCRT_size_t size, int radix)
{
MSVCRT_ulong digit;
WCHAR buffer[33], *pos;
size_t len;
if (!str || !size || radix < 2 || radix > 36)
{
if (str && size)
str[0] = '\0';
*MSVCRT__errno() = MSVCRT_EINVAL;
return MSVCRT_EINVAL;
}
pos = buffer + 32;
*pos = '\0';
do
{
digit = value % radix;
value /= radix;
if (digit < 10)
*--pos = '0' + digit;
else
*--pos = 'a' + digit - 10;
}
while (value != 0);
len = buffer + 33 - pos;
if (len > size)
{
size_t i;
WCHAR *p = str;
/* Copy the temporary buffer backwards up to the available number of
* characters. */
for (pos = buffer + 31, i = 0; i < size; i++)
*p++ = *pos--;
str[0] = '\0';
*MSVCRT__errno() = MSVCRT_ERANGE;
return MSVCRT_ERANGE;
}
memcpy(str, pos, len * sizeof(WCHAR));
return 0;
}
/*********************************************************************
* _i64toa_s (MSVCRT.@)
*/
int CDECL _i64toa_s(__int64 value, char *str, MSVCRT_size_t size, int radix)
......
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