msvcrt: Implemented _ultow_s.

oldstable
Eric Pouech 2011-11-28 21:53:38 +01:00 committed by Alexandre Julliard
parent a84454aabb
commit d7bc2eff2f
5 changed files with 58 additions and 4 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -1287,6 +1287,60 @@ int CDECL _ultoa_s(MSVCRT_ulong value, char *str, MSVCRT_size_t size, int radix)
return 0;
}
/*********************************************************************
* _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.@)
*/