| 1 | /* $Id: wcstring.c,v 1.2 2001-09-05 13:14:08 bird Exp $ */
|
|---|
| 2 | /*
|
|---|
| 3 | * NTDLL wide-char functions
|
|---|
| 4 | *
|
|---|
| 5 | * Copyright 2000 Alexandre Julliard
|
|---|
| 6 | * Copyright 2000 Jon Griffiths
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | #include "config.h"
|
|---|
| 10 |
|
|---|
| 11 | #include <ctype.h>
|
|---|
| 12 | #include <limits.h>
|
|---|
| 13 | #include <stdlib.h>
|
|---|
| 14 | #include <string.h>
|
|---|
| 15 | #include <stdio.h>
|
|---|
| 16 |
|
|---|
| 17 | #ifdef __WIN32OS2__
|
|---|
| 18 | #include <stdarg.h>
|
|---|
| 19 | #include <heapstring.h>
|
|---|
| 20 | #endif
|
|---|
| 21 |
|
|---|
| 22 | #include "windef.h"
|
|---|
| 23 | #include "winbase.h"
|
|---|
| 24 | #include "winnls.h"
|
|---|
| 25 | #include "wine/unicode.h"
|
|---|
| 26 | #include "heap.h"
|
|---|
| 27 | #include "debugtools.h"
|
|---|
| 28 |
|
|---|
| 29 | DEFAULT_DEBUG_CHANNEL(ntdll);
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 | /*********************************************************************
|
|---|
| 33 | * _wcsicmp (NTDLL.@)
|
|---|
| 34 | */
|
|---|
| 35 | INT __cdecl NTDLL__wcsicmp( LPCWSTR str1, LPCWSTR str2 )
|
|---|
| 36 | {
|
|---|
| 37 | return strcmpiW( str1, str2 );
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | /*********************************************************************
|
|---|
| 42 | * _wcslwr (NTDLL.@)
|
|---|
| 43 | */
|
|---|
| 44 | LPWSTR __cdecl NTDLL__wcslwr( LPWSTR str )
|
|---|
| 45 | {
|
|---|
| 46 | return strlwrW( str );
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | /*********************************************************************
|
|---|
| 51 | * _wcsnicmp (NTDLL.@)
|
|---|
| 52 | */
|
|---|
| 53 | INT __cdecl NTDLL__wcsnicmp( LPCWSTR str1, LPCWSTR str2, INT n )
|
|---|
| 54 | {
|
|---|
| 55 | return strncmpiW( str1, str2, n );
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 | /*********************************************************************
|
|---|
| 60 | * _wcsupr (NTDLL.@)
|
|---|
| 61 | */
|
|---|
| 62 | LPWSTR __cdecl NTDLL__wcsupr( LPWSTR str )
|
|---|
| 63 | {
|
|---|
| 64 | return struprW( str );
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | /*********************************************************************
|
|---|
| 69 | * towlower (NTDLL.@)
|
|---|
| 70 | */
|
|---|
| 71 | WCHAR __cdecl NTDLL_towlower( WCHAR ch )
|
|---|
| 72 | {
|
|---|
| 73 | return tolowerW(ch);
|
|---|
| 74 | }
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | /*********************************************************************
|
|---|
| 78 | * towupper (NTDLL.@)
|
|---|
| 79 | */
|
|---|
| 80 | WCHAR __cdecl NTDLL_towupper( WCHAR ch )
|
|---|
| 81 | {
|
|---|
| 82 | return toupperW(ch);
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 |
|
|---|
| 86 | /***********************************************************************
|
|---|
| 87 | * wcscat (NTDLL.@)
|
|---|
| 88 | */
|
|---|
| 89 | LPWSTR __cdecl NTDLL_wcscat( LPWSTR dst, LPCWSTR src )
|
|---|
| 90 | {
|
|---|
| 91 | return strcatW( dst, src );
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 | /*********************************************************************
|
|---|
| 96 | * wcschr (NTDLL.@)
|
|---|
| 97 | */
|
|---|
| 98 | LPWSTR __cdecl NTDLL_wcschr( LPCWSTR str, WCHAR ch )
|
|---|
| 99 | {
|
|---|
| 100 | return strchrW( str, ch );
|
|---|
| 101 | }
|
|---|
| 102 |
|
|---|
| 103 |
|
|---|
| 104 | /*********************************************************************
|
|---|
| 105 | * wcscmp (NTDLL.@)
|
|---|
| 106 | */
|
|---|
| 107 | INT __cdecl NTDLL_wcscmp( LPCWSTR str1, LPCWSTR str2 )
|
|---|
| 108 | {
|
|---|
| 109 | return strcmpW( str1, str2 );
|
|---|
| 110 | }
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 | /***********************************************************************
|
|---|
| 114 | * wcscpy (NTDLL.@)
|
|---|
| 115 | */
|
|---|
| 116 | LPWSTR __cdecl NTDLL_wcscpy( LPWSTR dst, LPCWSTR src )
|
|---|
| 117 | {
|
|---|
| 118 | return strcpyW( dst, src );
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| 121 |
|
|---|
| 122 | /*********************************************************************
|
|---|
| 123 | * wcscspn (NTDLL.@)
|
|---|
| 124 | */
|
|---|
| 125 | INT __cdecl NTDLL_wcscspn( LPCWSTR str, LPCWSTR reject )
|
|---|
| 126 | {
|
|---|
| 127 | LPCWSTR start = str;
|
|---|
| 128 | while (*str)
|
|---|
| 129 | {
|
|---|
| 130 | LPCWSTR p = reject;
|
|---|
| 131 | while (*p && (*p != *str)) p++;
|
|---|
| 132 | if (*p) break;
|
|---|
| 133 | str++;
|
|---|
| 134 | }
|
|---|
| 135 | return str - start;
|
|---|
| 136 | }
|
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 | /***********************************************************************
|
|---|
| 140 | * wcslen (NTDLL.@)
|
|---|
| 141 | */
|
|---|
| 142 | INT __cdecl NTDLL_wcslen( LPCWSTR str )
|
|---|
| 143 | {
|
|---|
| 144 | return strlenW( str );
|
|---|
| 145 | }
|
|---|
| 146 |
|
|---|
| 147 |
|
|---|
| 148 | /*********************************************************************
|
|---|
| 149 | * wcsncat (NTDLL.@)
|
|---|
| 150 | */
|
|---|
| 151 | LPWSTR __cdecl NTDLL_wcsncat( LPWSTR s1, LPCWSTR s2, INT n )
|
|---|
| 152 | {
|
|---|
| 153 | LPWSTR ret = s1;
|
|---|
| 154 | while (*s1) s1++;
|
|---|
| 155 | while (n-- > 0) if (!(*s1++ = *s2++)) return ret;
|
|---|
| 156 | *s1 = 0;
|
|---|
| 157 | return ret;
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 |
|
|---|
| 161 | /*********************************************************************
|
|---|
| 162 | * wcsncmp (NTDLL.@)
|
|---|
| 163 | */
|
|---|
| 164 | INT __cdecl NTDLL_wcsncmp( LPCWSTR str1, LPCWSTR str2, INT n )
|
|---|
| 165 | {
|
|---|
| 166 | return strncmpW( str1, str2, n );
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 | /*********************************************************************
|
|---|
| 171 | * wcsncpy (NTDLL.@)
|
|---|
| 172 | */
|
|---|
| 173 | LPWSTR __cdecl NTDLL_wcsncpy( LPWSTR s1, LPCWSTR s2, INT n )
|
|---|
| 174 | {
|
|---|
| 175 | return strncpyW( s1, s2, n );
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 |
|
|---|
| 179 | /*********************************************************************
|
|---|
| 180 | * wcspbrk (NTDLL.@)
|
|---|
| 181 | */
|
|---|
| 182 | LPWSTR __cdecl NTDLL_wcspbrk( LPCWSTR str, LPCWSTR accept )
|
|---|
| 183 | {
|
|---|
| 184 | LPCWSTR p;
|
|---|
| 185 | while (*str)
|
|---|
| 186 | {
|
|---|
| 187 | for (p = accept; *p; p++) if (*p == *str) return (LPWSTR)str;
|
|---|
| 188 | str++;
|
|---|
| 189 | }
|
|---|
| 190 | return NULL;
|
|---|
| 191 | }
|
|---|
| 192 |
|
|---|
| 193 |
|
|---|
| 194 | /*********************************************************************
|
|---|
| 195 | * wcsrchr (NTDLL.@)
|
|---|
| 196 | */
|
|---|
| 197 | LPWSTR __cdecl NTDLL_wcsrchr( LPWSTR str, WCHAR ch )
|
|---|
| 198 | {
|
|---|
| 199 | LPWSTR last = NULL;
|
|---|
| 200 | while (*str)
|
|---|
| 201 | {
|
|---|
| 202 | if (*str == ch) last = str;
|
|---|
| 203 | str++;
|
|---|
| 204 | }
|
|---|
| 205 | return last;
|
|---|
| 206 | }
|
|---|
| 207 |
|
|---|
| 208 |
|
|---|
| 209 | /*********************************************************************
|
|---|
| 210 | * wcsspn (NTDLL.@)
|
|---|
| 211 | */
|
|---|
| 212 | INT __cdecl NTDLL_wcsspn( LPCWSTR str, LPCWSTR accept )
|
|---|
| 213 | {
|
|---|
| 214 | LPCWSTR start = str;
|
|---|
| 215 | while (*str)
|
|---|
| 216 | {
|
|---|
| 217 | LPCWSTR p = accept;
|
|---|
| 218 | while (*p && (*p != *str)) p++;
|
|---|
| 219 | if (!*p) break;
|
|---|
| 220 | str++;
|
|---|
| 221 | }
|
|---|
| 222 | return str - start;
|
|---|
| 223 | }
|
|---|
| 224 |
|
|---|
| 225 |
|
|---|
| 226 | /*********************************************************************
|
|---|
| 227 | * wcsstr (NTDLL.@)
|
|---|
| 228 | */
|
|---|
| 229 | LPWSTR __cdecl NTDLL_wcsstr( LPCWSTR str, LPCWSTR sub )
|
|---|
| 230 | {
|
|---|
| 231 | return strstrW( str, sub );
|
|---|
| 232 | }
|
|---|
| 233 |
|
|---|
| 234 |
|
|---|
| 235 | /*********************************************************************
|
|---|
| 236 | * wcstok (NTDLL.@)
|
|---|
| 237 | */
|
|---|
| 238 | LPWSTR __cdecl NTDLL_wcstok( LPWSTR str, LPCWSTR delim )
|
|---|
| 239 | {
|
|---|
| 240 | static LPWSTR next = NULL;
|
|---|
| 241 | LPWSTR ret;
|
|---|
| 242 |
|
|---|
| 243 | if (!str)
|
|---|
| 244 | if (!(str = next)) return NULL;
|
|---|
| 245 |
|
|---|
| 246 | while (*str && NTDLL_wcschr( delim, *str )) str++;
|
|---|
| 247 | if (!*str) return NULL;
|
|---|
| 248 | ret = str++;
|
|---|
| 249 | while (*str && !NTDLL_wcschr( delim, *str )) str++;
|
|---|
| 250 | if (*str) *str++ = 0;
|
|---|
| 251 | next = str;
|
|---|
| 252 | return ret;
|
|---|
| 253 | }
|
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 | /*********************************************************************
|
|---|
| 257 | * wcstombs (NTDLL.@)
|
|---|
| 258 | */
|
|---|
| 259 | INT __cdecl NTDLL_wcstombs( LPSTR dst, LPCWSTR src, INT n )
|
|---|
| 260 | {
|
|---|
| 261 | INT ret;
|
|---|
| 262 | if (n <= 0) return 0;
|
|---|
| 263 | ret = WideCharToMultiByte( CP_ACP, 0, src, -1, dst, dst ? n : 0, NULL, NULL );
|
|---|
| 264 | if (!ret) return n; /* overflow */
|
|---|
| 265 | return ret - 1; /* do not count terminating NULL */
|
|---|
| 266 | }
|
|---|
| 267 |
|
|---|
| 268 |
|
|---|
| 269 | /*********************************************************************
|
|---|
| 270 | * mbstowcs (NTDLL.@)
|
|---|
| 271 | */
|
|---|
| 272 | INT __cdecl NTDLL_mbstowcs( LPWSTR dst, LPCSTR src, INT n )
|
|---|
| 273 | {
|
|---|
| 274 | INT ret;
|
|---|
| 275 | if (n <= 0) return 0;
|
|---|
| 276 | ret = MultiByteToWideChar( CP_ACP, 0, src, -1, dst, dst ? n : 0 );
|
|---|
| 277 | if (!ret) return n; /* overflow */
|
|---|
| 278 | return ret - 1; /* do not count terminating NULL */
|
|---|
| 279 | }
|
|---|
| 280 |
|
|---|
| 281 |
|
|---|
| 282 | /*********************************************************************
|
|---|
| 283 | * wcstol (NTDLL.@)
|
|---|
| 284 | * Like strtol, but for wide character strings.
|
|---|
| 285 | */
|
|---|
| 286 | INT __cdecl NTDLL_wcstol(LPWSTR s,LPWSTR *end,INT base)
|
|---|
| 287 | {
|
|---|
| 288 | LPSTR sA = HEAP_strdupWtoA(GetProcessHeap(),0,s),endA;
|
|---|
| 289 | INT ret = strtol(sA,&endA,base);
|
|---|
| 290 |
|
|---|
| 291 | HeapFree(GetProcessHeap(),0,sA);
|
|---|
| 292 | if (end) *end = s+(endA-sA); /* pointer magic checked. */
|
|---|
| 293 | return ret;
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 |
|
|---|
| 297 | /*********************************************************************
|
|---|
| 298 | * iswctype (NTDLL.@)
|
|---|
| 299 | */
|
|---|
| 300 | INT __cdecl NTDLL_iswctype( WCHAR wc, WCHAR wct )
|
|---|
| 301 | {
|
|---|
| 302 | return (get_char_typeW(wc) & 0xfff) & wct;
|
|---|
| 303 | }
|
|---|
| 304 |
|
|---|
| 305 |
|
|---|
| 306 | /*********************************************************************
|
|---|
| 307 | * iswalpha (NTDLL.@)
|
|---|
| 308 | */
|
|---|
| 309 | INT __cdecl NTDLL_iswalpha( WCHAR wc )
|
|---|
| 310 | {
|
|---|
| 311 | return get_char_typeW(wc) & C1_ALPHA;
|
|---|
| 312 | }
|
|---|
| 313 |
|
|---|
| 314 |
|
|---|
| 315 | /*********************************************************************
|
|---|
| 316 | * _ultow (NTDLL.@)
|
|---|
| 317 | * Like _ultoa, but for wide character strings.
|
|---|
| 318 | */
|
|---|
| 319 | LPWSTR __cdecl _ultow(ULONG value, LPWSTR string, INT radix)
|
|---|
| 320 | {
|
|---|
| 321 | WCHAR tmp[33];
|
|---|
| 322 | LPWSTR tp = tmp;
|
|---|
| 323 | LPWSTR sp;
|
|---|
| 324 | LONG i;
|
|---|
| 325 | ULONG v = value;
|
|---|
| 326 |
|
|---|
| 327 | if (radix > 36 || radix <= 1)
|
|---|
| 328 | return 0;
|
|---|
| 329 |
|
|---|
| 330 | while (v || tp == tmp)
|
|---|
| 331 | {
|
|---|
| 332 | i = v % radix;
|
|---|
| 333 | v = v / radix;
|
|---|
| 334 | if (i < 10)
|
|---|
| 335 | *tp++ = i + '0';
|
|---|
| 336 | else
|
|---|
| 337 | *tp++ = i + 'a' - 10;
|
|---|
| 338 | }
|
|---|
| 339 |
|
|---|
| 340 | sp = string;
|
|---|
| 341 | while (tp > tmp)
|
|---|
| 342 | *sp++ = *--tp;
|
|---|
| 343 | *sp = 0;
|
|---|
| 344 | return string;
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | /*********************************************************************
|
|---|
| 348 | * _wtol (NTDLL.@)
|
|---|
| 349 | * Like atol, but for wide character strings.
|
|---|
| 350 | */
|
|---|
| 351 | LONG __cdecl _wtol(LPWSTR string)
|
|---|
| 352 | {
|
|---|
| 353 | char buffer[30];
|
|---|
| 354 | NTDLL_wcstombs( buffer, string, sizeof(buffer) );
|
|---|
| 355 | return atol( buffer );
|
|---|
| 356 | }
|
|---|
| 357 |
|
|---|
| 358 | /*********************************************************************
|
|---|
| 359 | * _wtoi (NTDLL.@)
|
|---|
| 360 | */
|
|---|
| 361 | INT __cdecl _wtoi(LPWSTR string)
|
|---|
| 362 | {
|
|---|
| 363 | return _wtol(string);
|
|---|
| 364 | }
|
|---|
| 365 |
|
|---|
| 366 | /* INTERNAL: Wide char snprintf
|
|---|
| 367 | * If you fix a bug in this function, fix it in msvcrt/wcs.c also!
|
|---|
| 368 | */
|
|---|
| 369 | static int __cdecl NTDLL_vsnwprintf(WCHAR *str, unsigned int len,
|
|---|
| 370 | const WCHAR *format, va_list valist)
|
|---|
| 371 | {
|
|---|
| 372 | unsigned int written = 0;
|
|---|
| 373 | const WCHAR *iter = format;
|
|---|
| 374 | char bufa[256], fmtbufa[64], *fmta;
|
|---|
| 375 |
|
|---|
| 376 | TRACE("(%d,%s)\n",len,debugstr_w(format));
|
|---|
| 377 |
|
|---|
| 378 | while (*iter)
|
|---|
| 379 | {
|
|---|
| 380 | while (*iter && *iter != (WCHAR)L'%')
|
|---|
| 381 | {
|
|---|
| 382 | if (written++ >= len)
|
|---|
| 383 | return -1;
|
|---|
| 384 | *str++ = *iter++;
|
|---|
| 385 | }
|
|---|
| 386 | if (*iter == (WCHAR)L'%')
|
|---|
| 387 | {
|
|---|
| 388 | fmta = fmtbufa;
|
|---|
| 389 | *fmta++ = *iter++;
|
|---|
| 390 | while (*iter == (WCHAR)L'0' ||
|
|---|
| 391 | *iter == (WCHAR)L'+' ||
|
|---|
| 392 | *iter == (WCHAR)L'-' ||
|
|---|
| 393 | *iter == (WCHAR)L' ' ||
|
|---|
| 394 | *iter == (WCHAR)L'0' ||
|
|---|
| 395 | *iter == (WCHAR)L'*' ||
|
|---|
| 396 | *iter == (WCHAR)L'#')
|
|---|
| 397 | {
|
|---|
| 398 | if (*iter == (WCHAR)L'*')
|
|---|
| 399 | {
|
|---|
| 400 | char *buffiter = bufa;
|
|---|
| 401 | int fieldlen = va_arg(valist, int);
|
|---|
| 402 | sprintf(buffiter, "%d", fieldlen);
|
|---|
| 403 | while (*buffiter)
|
|---|
| 404 | *fmta++ = *buffiter++;
|
|---|
| 405 | }
|
|---|
| 406 | else
|
|---|
| 407 | *fmta++ = *iter;
|
|---|
| 408 | iter++;
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | while (isdigit(*iter))
|
|---|
| 412 | *fmta++ = *iter++;
|
|---|
| 413 |
|
|---|
| 414 | if (*iter == (WCHAR)L'.')
|
|---|
| 415 | {
|
|---|
| 416 | *fmta++ = *iter++;
|
|---|
| 417 | if (*iter == (WCHAR)L'*')
|
|---|
| 418 | {
|
|---|
| 419 | char *buffiter = bufa;
|
|---|
| 420 | int fieldlen = va_arg(valist, int);
|
|---|
| 421 | sprintf(buffiter, "%d", fieldlen);
|
|---|
| 422 | while (*buffiter)
|
|---|
| 423 | *fmta++ = *buffiter++;
|
|---|
| 424 | }
|
|---|
| 425 | else
|
|---|
| 426 | while (isdigit(*iter))
|
|---|
| 427 | *fmta++ = *iter++;
|
|---|
| 428 | }
|
|---|
| 429 | if (*iter == (WCHAR)L'h' ||
|
|---|
| 430 | *iter == (WCHAR)L'l')
|
|---|
| 431 | {
|
|---|
| 432 | *fmta++ = *iter++;
|
|---|
| 433 | *fmta++ = *iter++;
|
|---|
| 434 | }
|
|---|
| 435 |
|
|---|
| 436 | switch (*iter)
|
|---|
| 437 | {
|
|---|
| 438 | case (WCHAR)L's':
|
|---|
| 439 | {
|
|---|
| 440 | static const WCHAR none[] = { '(', 'n', 'u', 'l', 'l', ')', 0 };
|
|---|
| 441 | const WCHAR *wstr = va_arg(valist, const WCHAR *);
|
|---|
| 442 | const WCHAR *striter = wstr ? wstr : none;
|
|---|
| 443 | while (*striter)
|
|---|
| 444 | {
|
|---|
| 445 | if (written++ >= len)
|
|---|
| 446 | return -1;
|
|---|
| 447 | *str++ = *striter++;
|
|---|
| 448 | }
|
|---|
| 449 | iter++;
|
|---|
| 450 | break;
|
|---|
| 451 | }
|
|---|
| 452 |
|
|---|
| 453 | case (WCHAR)L'c':
|
|---|
| 454 | if (written++ >= len)
|
|---|
| 455 | return -1;
|
|---|
| 456 | *str++ = (WCHAR)va_arg(valist, int);
|
|---|
| 457 | iter++;
|
|---|
| 458 | break;
|
|---|
| 459 |
|
|---|
| 460 | default:
|
|---|
| 461 | {
|
|---|
| 462 | /* For non wc types, use system sprintf and append to wide char output */
|
|---|
| 463 | /* FIXME: for unrecognised types, should ignore % when printing */
|
|---|
| 464 | char *bufaiter = bufa;
|
|---|
| 465 | if (*iter == (WCHAR)L'p')
|
|---|
| 466 | sprintf(bufaiter, "%08lX", va_arg(valist, long));
|
|---|
| 467 | else
|
|---|
| 468 | {
|
|---|
| 469 | *fmta++ = *iter;
|
|---|
| 470 | *fmta = '\0';
|
|---|
| 471 | if (*iter == (WCHAR)L'f')
|
|---|
| 472 | sprintf(bufaiter, fmtbufa, va_arg(valist, double));
|
|---|
| 473 | else
|
|---|
| 474 | sprintf(bufaiter, fmtbufa, va_arg(valist, void *));
|
|---|
| 475 | }
|
|---|
| 476 | while (*bufaiter)
|
|---|
| 477 | {
|
|---|
| 478 | if (written++ >= len)
|
|---|
| 479 | return -1;
|
|---|
| 480 | *str++ = *bufaiter++;
|
|---|
| 481 | }
|
|---|
| 482 | iter++;
|
|---|
| 483 | break;
|
|---|
| 484 | }
|
|---|
| 485 | }
|
|---|
| 486 | }
|
|---|
| 487 | }
|
|---|
| 488 | if (written >= len)
|
|---|
| 489 | return -1;
|
|---|
| 490 | *str++ = (WCHAR)L'\0';
|
|---|
| 491 | return (int)written;
|
|---|
| 492 | }
|
|---|
| 493 |
|
|---|
| 494 |
|
|---|
| 495 | /***********************************************************************
|
|---|
| 496 | * _snwprintf (NTDLL.@)
|
|---|
| 497 | */
|
|---|
| 498 | int __cdecl _snwprintf(WCHAR *str, unsigned int len, const WCHAR *format, ...)
|
|---|
| 499 | {
|
|---|
| 500 | int retval;
|
|---|
| 501 | va_list valist;
|
|---|
| 502 | va_start(valist, format);
|
|---|
| 503 | retval = NTDLL_vsnwprintf(str, len, format, valist);
|
|---|
| 504 | va_end(valist);
|
|---|
| 505 | return retval;
|
|---|
| 506 | }
|
|---|
| 507 |
|
|---|
| 508 |
|
|---|
| 509 | /***********************************************************************
|
|---|
| 510 | * swprintf (NTDLL.@)
|
|---|
| 511 | */
|
|---|
| 512 | int __cdecl NTDLL_swprintf(WCHAR *str, const WCHAR *format, ...)
|
|---|
| 513 | {
|
|---|
| 514 | int retval;
|
|---|
| 515 | va_list valist;
|
|---|
| 516 | va_start(valist, format);
|
|---|
| 517 | retval = NTDLL_vsnwprintf(str, INT_MAX, format, valist);
|
|---|
| 518 | va_end(valist);
|
|---|
| 519 | return retval;
|
|---|
| 520 | }
|
|---|