ReactOS 0.4.17-dev-301-g9127a53
wcs.c
Go to the documentation of this file.
1/*
2 * msvcrt.dll wide-char functions
3 *
4 * Copyright 1999 Alexandre Julliard
5 * Copyright 2000 Jon Griffiths
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#define _NO_CRT_STDIO_INLINE
23#include <limits.h>
24#include <locale.h>
25#include <math.h>
26#include <assert.h>
27#include <wchar.h>
28#include <wctype.h>
29#include "msvcrt.h"
30#include "winnls.h"
31#include "wtypes.h"
32#include "wine/debug.h"
33
35
36#ifdef _MSC_VER
37#pragma function(_wcsset,wcscat,wcscmp,wcscpy,wcslen)
38#ifdef __REACTOS__
39#if defined(_M_ARM) || _MSC_VER >= 1932 // VS2022 version 17.2 and later
40#pragma function(wcsncmp,wcsncpy)
41#endif
42#endif
43#endif
44
45typedef struct
46{
47 enum { LEN_DEFAULT, LEN_SHORT, LEN_LONG } IntegerLength;
48 BOOLEAN IntegerDouble, IntegerNative, LeftAlign, Alternate, PadZero;
50 int FieldLength, Precision;
51 char Sign, Format;
52} pf_flags;
53
55
56#include "printf.h"
57#define PRINTF_WIDE
58#include "printf.h"
59#undef PRINTF_WIDE
60
61#if _MSVCR_VER>=80
62
63/*********************************************************************
64 * _get_printf_count_output (MSVCR80.@)
65 */
67{
68 return n_format_enabled ? 1 : 0;
69}
70
71/*********************************************************************
72 * _set_printf_count_output (MSVCR80.@)
73 */
75{
78 return old ? 1 : 0;
79}
80
81#endif /* _MSVCR_VER>=80 */
82
83/*********************************************************************
84 * _wcsdup (MSVCRT.@)
85 */
86wchar_t* CDECL _wcsdup( const wchar_t* str )
87{
88 wchar_t* ret = NULL;
89 if (str)
90 {
91 size_t size = (wcslen(str) + 1) * sizeof(wchar_t);
92 ret = malloc( size );
93 if (ret) memcpy( ret, str, size );
94 }
95 return ret;
96}
97
98/*********************************************************************
99 * _towlower_l (MSVCRT.@)
100 */
102{
104 wchar_t ret;
105
106 if(!locale)
108 else
109 locinfo = locale->locinfo;
110
111 if(!locinfo->lc_handle[LC_CTYPE]) {
112 if(c >= 'A' && c <= 'Z')
113 return c + 'a' - 'A';
114 return c;
115 }
116
117 if(!LCMapStringW(locinfo->lc_handle[LC_CTYPE], LCMAP_LOWERCASE, &c, 1, &ret, 1))
118 return c;
119 return ret;
120}
121
122/*********************************************************************
123 * towlower (MSVCRT.@)
124 */
126{
127 return _towlower_l(c, NULL);
128}
129
130INT CDECL _wcsicmp_l(const wchar_t *str1, const wchar_t *str2, _locale_t locale)
131{
132 _locale_tstruct tmp = {0};
133 wchar_t c1, c2;
134
136 return _NLSCMPERROR;
137
138 if(!locale)
140
141 do
142 {
143 c1 = _towlower_l(*str1++, locale);
144 c2 = _towlower_l(*str2++, locale);
145 } while(c1 && (c1 == c2));
146
148 return c1 - c2;
149}
150
151/*********************************************************************
152 * towctrans (MSVCR120.@)
153 */
155{
156 if(category == 1)
157 return _towupper_l(c, NULL);
158 return _towlower_l(c, NULL);
159}
160
161/*********************************************************************
162 * _wcsicmp (MSVCRT.@)
163 */
164INT CDECL _wcsicmp( const wchar_t* str1, const wchar_t* str2 )
165{
166 return _wcsicmp_l(str1, str2, NULL);
167}
168
169/*********************************************************************
170 * _wcsnicmp_l (MSVCRT.@)
171 */
172INT CDECL _wcsnicmp_l(const wchar_t *str1, const wchar_t *str2,
173 size_t n, _locale_t locale)
174{
175 _locale_tstruct tmp = {0};
176 wchar_t c1, c2;
177
178 if (!n)
179 return 0;
180
182 return _NLSCMPERROR;
183
184 if(!locale)
186
187 do
188 {
189 c1 = _towlower_l(*str1++, locale);
190 c2 = _towlower_l(*str2++, locale);
191 } while(--n && c1 && (c1 == c2));
192
194 return c1 - c2;
195}
196
197/*********************************************************************
198 * _wcsnicmp (MSVCRT.@)
199 */
200INT CDECL _wcsnicmp(const wchar_t *str1, const wchar_t *str2, size_t n)
201{
202 return _wcsnicmp_l(str1, str2, n, NULL);
203}
204
205/*********************************************************************
206 * _wcsicoll_l (MSVCRT.@)
207 */
208int CDECL _wcsicoll_l(const wchar_t* str1, const wchar_t* str2, _locale_t locale)
209{
211
212 if(!locale)
214 else
215 locinfo = locale->locinfo;
216
217 if(!locinfo->lc_handle[LC_COLLATE])
218 {
219 wchar_t c1, c2;
220
221 do
222 {
223 c1 = *str1++;
224 if (c1 >= 'A' && c1 <= 'Z')
225 c1 += 'a' - 'A';
226
227 c2 = *str2++;
228 if (c2 >= 'A' && c2 <= 'Z')
229 c2 += 'a' - 'A';
230 } while(c1 && (c1 == c2));
231 return c1 - c2;
232 }
233
235 str1, -1, str2, -1)-CSTR_EQUAL;
236}
237
238/*********************************************************************
239 * _wcsicoll (MSVCRT.@)
240 */
241INT CDECL _wcsicoll( const wchar_t* str1, const wchar_t* str2 )
242{
243 return _wcsicoll_l(str1, str2, NULL);
244}
245
246/*********************************************************************
247 * _wcsnicoll_l (MSVCRT.@)
248 */
249int CDECL _wcsnicoll_l(const wchar_t* str1, const wchar_t* str2,
250 size_t count, _locale_t locale)
251{
253
254 if(!locale)
256 else
257 locinfo = locale->locinfo;
258
259 if(!locinfo->lc_handle[LC_COLLATE])
260 {
261 wchar_t c1, c2;
262
263 if (!count)
264 return 0;
265
266 do
267 {
268 c1 = *str1++;
269 if (c1 >= 'A' && c1 <= 'Z')
270 c1 += 'a' - 'A';
271
272 c2 = *str2++;
273 if (c2 >= 'A' && c2 <= 'Z')
274 c2 += 'a' - 'A';
275 } while(--count && c1 && (c1 == c2));
276 return c1 - c2;
277 }
278
282}
283
284/*********************************************************************
285 * _wcsnicoll (MSVCRT.@)
286 */
287INT CDECL _wcsnicoll( const wchar_t* str1, const wchar_t* str2, size_t count )
288{
289 return _wcsnicoll_l(str1, str2, count, NULL);
290}
291
292/*********************************************************************
293 * _wcsnset (MSVCRT.@)
294 */
295wchar_t* CDECL _wcsnset( wchar_t* str, wchar_t c, size_t n )
296{
297 wchar_t* ret = str;
298 while ((n-- > 0) && *str) *str++ = c;
299 return ret;
300}
301
302/*********************************************************************
303 * _wcsnset_s (MSVCRT.@)
304 */
305int CDECL _wcsnset_s( wchar_t *str, size_t size, wchar_t c, size_t count )
306{
307 size_t i;
308
309 if(!str && !size && !count) return 0;
310 if(!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL;
311 if(!MSVCRT_CHECK_PMT(size > 0)) return EINVAL;
312
313 for(i=0; i<size-1 && i<count; i++) {
314 if(!str[i]) return 0;
315 str[i] = c;
316 }
317 for(; i<size; i++)
318 if(!str[i]) return 0;
319
320 str[0] = 0;
322 *_errno() = EINVAL;
323 return EINVAL;
324}
325
326/*********************************************************************
327 * _wcsrev (MSVCRT.@)
328 */
329wchar_t* CDECL _wcsrev( wchar_t* str )
330{
331 wchar_t* ret = str;
332 wchar_t* end = str + wcslen(str) - 1;
333 while (end > str)
334 {
335 wchar_t t = *end;
336 *end-- = *str;
337 *str++ = t;
338 }
339 return ret;
340}
341
342/*********************************************************************
343 * _wcsset_s (MSVCRT.@)
344 */
345int CDECL _wcsset_s( wchar_t *str, size_t n, wchar_t c )
346{
347 wchar_t *p = str;
348
349 if(!MSVCRT_CHECK_PMT(str != NULL)) return EINVAL;
350 if(!MSVCRT_CHECK_PMT(n)) return EINVAL;
351
352 while(*p && --n) *p++ = c;
353 if(!n) {
354 str[0] = 0;
356 *_errno() = EINVAL;
357 return EINVAL;
358 }
359 return 0;
360}
361
362/*********************************************************************
363 * _wcsset (MSVCRT.@)
364 */
365wchar_t* CDECL _wcsset( wchar_t* str, wchar_t c )
366{
367 wchar_t* ret = str;
368 while (*str) *str++ = c;
369 return ret;
370}
371
372/******************************************************************
373 * _wcsupr_s_l (MSVCRT.@)
374 */
375int CDECL _wcsupr_s_l( wchar_t* str, size_t n, _locale_t locale )
376{
377 _locale_tstruct tmp = {0};
378 wchar_t* ptr = str;
379
380 if (!str || !n)
381 {
382 if (str) *str = '\0';
383 *_errno() = EINVAL;
384 return EINVAL;
385 }
386
387 if(!locale)
389
390 while (n--)
391 {
392 if (!*ptr)
393 {
395 return 0;
396 }
398 ptr++;
399 }
400
402
403 /* MSDN claims that the function should return and set errno to
404 * ERANGE, which doesn't seem to be true based on the tests. */
405 *str = '\0';
406 *_errno() = EINVAL;
407 return EINVAL;
408}
409
410/******************************************************************
411 * _wcsupr_s (MSVCRT.@)
412 *
413 */
414INT CDECL _wcsupr_s( wchar_t* str, size_t n )
415{
416 return _wcsupr_s_l( str, n, NULL );
417}
418
419/******************************************************************
420 * _wcsupr_l (MSVCRT.@)
421 */
422wchar_t* CDECL _wcsupr_l( wchar_t *str, _locale_t locale )
423{
424 _wcsupr_s_l( str, -1, locale);
425 return str;
426}
427
428/******************************************************************
429 * _wcsupr (MSVCRT.@)
430 */
431wchar_t* CDECL _wcsupr( wchar_t *str )
432{
433 return _wcsupr_l(str, NULL);
434}
435
436/******************************************************************
437 * _wcslwr_s_l (MSVCRT.@)
438 */
439int CDECL _wcslwr_s_l( wchar_t* str, size_t n, _locale_t locale )
440{
441 _locale_tstruct tmp = {0};
442 wchar_t* ptr = str;
443
444 if (!str || !n)
445 {
446 if (str) *str = '\0';
447 *_errno() = EINVAL;
448 return EINVAL;
449 }
450
451 if(!locale)
453
454 while (n--)
455 {
456 if (!*ptr)
457 {
459 return 0;
460 }
462 ptr++;
463 }
464
466
467 /* MSDN claims that the function should return and set errno to
468 * ERANGE, which doesn't seem to be true based on the tests. */
469 *str = '\0';
470 *_errno() = EINVAL;
471 return EINVAL;
472}
473
474/******************************************************************
475 * _wcslwr_s (MSVCRT.@)
476 */
477int CDECL _wcslwr_s( wchar_t* str, size_t n )
478{
479 return _wcslwr_s_l(str, n, NULL);
480}
481
482/******************************************************************
483 * _wcslwr_l (MSVCRT.@)
484 */
485wchar_t* CDECL _wcslwr_l( wchar_t* str, _locale_t locale )
486{
487 _wcslwr_s_l(str, -1, locale);
488 return str;
489}
490
491/******************************************************************
492 * _wcslwr (MSVCRT.@)
493 */
494wchar_t* CDECL _wcslwr( wchar_t* str )
495{
496 _wcslwr_s_l(str, -1, NULL);
497 return str;
498}
499
500/*********************************************************************
501 * wcscspn (MSVCRT.@)
502 */
503size_t __cdecl wcscspn(const wchar_t *str, const wchar_t *reject)
504{
505 const wchar_t *ptr;
506 for (ptr = str; *ptr; ptr++) if (wcschr( reject, *ptr )) break;
507 return ptr - str;
508}
509
510/*********************************************************************
511 * wcsspn (MSVCRT.@)
512 */
513size_t __cdecl wcsspn(const wchar_t *str, const wchar_t *accept)
514{
515 const wchar_t *ptr;
516 for (ptr = str; *ptr; ptr++) if (!wcschr( accept, *ptr )) break;
517 return ptr - str;
518}
519
520/*********************************************************************
521 * wcsncmp (MSVCRT.@)
522 */
523int CDECL wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t n)
524{
525 if (!n)
526 return 0;
527 while(--n && *str1 && (*str1 == *str2))
528 {
529 str1++;
530 str2++;
531 }
532 return *str1 - *str2;
533}
534
535/*********************************************************************
536 * _wcsncoll_l (MSVCRT.@)
537 */
538int CDECL _wcsncoll_l(const wchar_t* str1, const wchar_t* str2,
539 size_t count, _locale_t locale)
540{
542
543 if(!locale)
545 else
546 locinfo = locale->locinfo;
547
548 if(!locinfo->lc_handle[LC_COLLATE])
549 return wcsncmp(str1, str2, count);
553}
554
555/*********************************************************************
556 * _wcsncoll (MSVCRT.@)
557 */
558int CDECL _wcsncoll(const wchar_t* str1, const wchar_t* str2, size_t count)
559{
560 return _wcsncoll_l(str1, str2, count, NULL);
561}
562
563static wchar_t strtod_wstr_get(void *ctx)
564{
565 const wchar_t **p = ctx;
566 if (!**p) return WEOF;
567 return *(*p)++;
568}
569
570static void strtod_wstr_unget(void *ctx)
571{
572 const wchar_t **p = ctx;
573 (*p)--;
574}
575
576/*********************************************************************
577 * _wcstod_l (MSVCRT.@)
578 */
579double CDECL _wcstod_l(const wchar_t* str, wchar_t** end,
581{
583 const wchar_t *beg, *p;
584 struct fpnum fp;
585 double ret;
586 int err;
587
588 if (!MSVCRT_CHECK_PMT(str != NULL)) {
589 if (end) *end = NULL;
590 return 0;
591 }
592
593 if (!locale)
595 else
596 locinfo = locale->locinfo;
597
598 p = str;
599 while(_iswspace_l(*p, locale))
600 p++;
601 beg = p;
602
604 if (end) *end = (p == beg ? (wchar_t*)str : (wchar_t*)p);
605
606 err = fpnum_double(&fp, &ret);
607 if(err) *_errno() = err;
608 return ret;
609}
610
611/*********************************************************************
612 * wcsrtombs_l (INTERNAL)
613 */
614static size_t wcsrtombs_l(char *mbstr, const wchar_t **wcstr,
615 size_t count, _locale_t locale)
616{
618 size_t tmp = 0;
619 BOOL used_default = FALSE;
620 BOOL *pused_default;
621
622 if(!locale)
624 else
625 locinfo = locale->locinfo;
626
627 if(!locinfo->lc_codepage) {
628 size_t i;
629
630 if(!mbstr)
631 return wcslen(*wcstr);
632
633 for(i=0; i<count; i++) {
634 if((*wcstr)[i] > 255) {
635 *_errno() = EILSEQ;
636 return -1;
637 }
638
639 mbstr[i] = (*wcstr)[i];
640 if(!(*wcstr)[i]) break;
641 }
642
643 if(i < count) *wcstr = NULL;
644 else *wcstr += i;
645 return i;
646 }
647
648 pused_default = (locinfo->lc_codepage != CP_UTF8 ? &used_default : NULL);
649
650 if(!mbstr) {
652 *wcstr, -1, NULL, 0, NULL, pused_default);
653 if(!tmp || used_default) {
654 *_errno() = EILSEQ;
655 return -1;
656 }
657 return tmp-1;
658 }
659
660 while(**wcstr) {
661 char buf[3];
662 size_t i, size;
663
665 *wcstr, 1, buf, 3, NULL, pused_default);
666 if(!size || used_default) {
667 *_errno() = EILSEQ;
668 return -1;
669 }
670 if(tmp+size > count)
671 return tmp;
672
673 for(i=0; i<size; i++)
674 mbstr[tmp++] = buf[i];
675 (*wcstr)++;
676 }
677
678 if(tmp < count) {
679 mbstr[tmp] = '\0';
680 *wcstr = NULL;
681 }
682 return tmp;
683}
684
685/*********************************************************************
686 * _wcstombs_l (MSVCRT.@)
687 */
688size_t CDECL _wcstombs_l(char *mbstr, const wchar_t *wcstr,
689 size_t count, _locale_t locale)
690{
691 return wcsrtombs_l(mbstr, &wcstr, count, locale);
692}
693
694/*********************************************************************
695 * wcstombs (MSVCRT.@)
696 */
697size_t CDECL wcstombs(char *mbstr, const wchar_t *wcstr,
698 size_t count)
699{
700 return wcsrtombs_l(mbstr, &wcstr, count, NULL);
701}
702
703/*********************************************************************
704 * wcsrtombs (MSVCRT.@)
705 */
706size_t CDECL wcsrtombs(char *mbstr, const wchar_t **wcstr,
707 size_t count, mbstate_t *mbstate)
708{
709 if(mbstate)
710 *mbstate = 0;
711
712 return wcsrtombs_l(mbstr, wcstr, count, NULL);
713}
714
715/*********************************************************************
716 * wcsrtombs_s_l (INTERNAL)
717 */
718static int wcsrtombs_s_l(size_t *ret, char *mbstr, size_t size,
719 const wchar_t **wcstr, size_t count, _locale_t locale)
720{
721 size_t conv;
722 int err;
723
724 if(!mbstr && !size && wcstr) {
725 conv = wcsrtombs_l(NULL, wcstr, 0, locale);
726 if(ret)
727 *ret = conv+1;
728 if(conv == -1)
729 return *_errno();
730 return 0;
731 }
732
733 if (!MSVCRT_CHECK_PMT(mbstr != NULL)) return EINVAL;
734 if (size) mbstr[0] = '\0';
735 if (!MSVCRT_CHECK_PMT(wcstr != NULL)) return EINVAL;
736 if (!MSVCRT_CHECK_PMT(*wcstr != NULL)) return EINVAL;
737
738 if(count==_TRUNCATE || size<count)
739 conv = size;
740 else
741 conv = count;
742
743 err = 0;
744 conv = wcsrtombs_l(mbstr, wcstr, conv, locale);
745 if(conv == -1) {
746 conv = 0;
747 if(size)
748 mbstr[0] = '\0';
749 err = *_errno();
750 }else if(conv < size)
751 mbstr[conv++] = '\0';
752 else if(conv==size && (count==_TRUNCATE || mbstr[conv-1]=='\0')) {
753 mbstr[conv-1] = '\0';
754 if(count==_TRUNCATE)
755 err = STRUNCATE;
756 }else {
757 MSVCRT_INVALID_PMT("mbstr[size] is too small", ERANGE);
758 conv = 0;
759 if(size)
760 mbstr[0] = '\0';
761 err = ERANGE;
762 }
763
764 if(ret)
765 *ret = conv;
766 return err;
767}
768
769/*********************************************************************
770 * _wcstombs_s_l (MSVCRT.@)
771 */
772int CDECL _wcstombs_s_l(size_t *ret, char *mbstr, size_t size,
773 const wchar_t *wcstr, size_t count, _locale_t locale)
774{
775 return wcsrtombs_s_l(ret, mbstr, size, &wcstr,count, locale);
776}
777
778/*********************************************************************
779 * wcstombs_s (MSVCRT.@)
780 */
781int CDECL wcstombs_s(size_t *ret, char *mbstr, size_t size,
782 const wchar_t *wcstr, size_t count)
783{
784 return wcsrtombs_s_l(ret, mbstr, size, &wcstr, count, NULL);
785}
786
787/*********************************************************************
788 * wcsrtombs_s (MSVCRT.@)
789 */
790int CDECL wcsrtombs_s(size_t *ret, char *mbstr, size_t size,
791 const wchar_t **wcstr, size_t count, mbstate_t *mbstate)
792{
793 if(mbstate)
794 *mbstate = 0;
795
796 return wcsrtombs_s_l(ret, mbstr, size, wcstr, count, NULL);
797}
798
799/*********************************************************************
800 * wcstod (MSVCRT.@)
801 */
802double CDECL wcstod(const wchar_t* lpszStr, wchar_t** end)
803{
804 return _wcstod_l(lpszStr, end, NULL);
805}
806
807/*********************************************************************
808 * _wtof (MSVCRT.@)
809 */
810double CDECL _wtof(const wchar_t *str)
811{
812 return _wcstod_l(str, NULL, NULL);
813}
814
815/*********************************************************************
816 * _wtof_l (MSVCRT.@)
817 */
818double CDECL _wtof_l(const wchar_t *str, _locale_t locale)
819{
820 return _wcstod_l(str, NULL, locale);
821}
822
823#if _MSVCR_VER>=120
824
825/*********************************************************************
826 * _wcstof_l (MSVCR120.@)
827 */
828float CDECL _wcstof_l( const wchar_t *str, wchar_t **end, _locale_t locale )
829{
830 double ret = _wcstod_l(str, end, locale);
831 if (ret && isfinite(ret)) {
832 float f = ret;
833 if (!f || !isfinite(f))
834 *_errno() = ERANGE;
835 }
836 return ret;
837}
838
839/*********************************************************************
840 * wcstof (MSVCR120.@)
841 */
842float CDECL wcstof( const wchar_t *str, wchar_t **end )
843{
844 return _wcstof_l(str, end, NULL);
845}
846
847#endif /* _MSVCR_VER>=120 */
848
849/*********************************************************************
850 * arg_clbk_valist (INTERNAL)
851 */
853{
855
856 if(type == VT_I8)
857 ret.get_longlong = va_arg(*valist, LONGLONG);
858 else if(type == VT_INT)
859 ret.get_int = va_arg(*valist, int);
860 else if(type == VT_R8)
861 ret.get_double = va_arg(*valist, double);
862 else if(type == VT_PTR)
863 ret.get_ptr = va_arg(*valist, void*);
864 else {
865 ERR("Incorrect type\n");
866 ret.get_int = 0;
867 }
868
869 return ret;
870}
871
872/*********************************************************************
873 * arg_clbk_positional (INTERNAL)
874 */
876{
878 return args[pos];
879}
880
881#if _MSVCR_VER < 140
882
883/*********************************************************************
884 * _vsnprintf (MSVCRT.@)
885 */
886int CDECL _vsnprintf( char *str, size_t len, const char *format, va_list valist )
887{
888 static const char nullbyte = '\0';
889 struct _str_ctx_a ctx = {len, str};
890 int ret;
891
892 ret = pf_printf_a(puts_clbk_str_a, &ctx, format, NULL, 0,
894 puts_clbk_str_a(&ctx, 1, &nullbyte);
895 return ret;
896}
897
898#else
899
900static int puts_clbk_str_c99_a(void *ctx, int len, const char *str)
901{
902 struct _str_ctx_a *out = ctx;
903
904 if(!out->buf)
905 return len;
906
907 if(out->len < len) {
908 memmove(out->buf, str, out->len);
909 out->buf += out->len;
910 out->len = 0;
911 return len;
912 }
913
914 memmove(out->buf, str, len);
915 out->buf += len;
916 out->len -= len;
917 return len;
918}
919
920/*********************************************************************
921 * __stdio_common_vsprintf (UCRTBASE.@)
922 */
923int CDECL __stdio_common_vsprintf( unsigned __int64 options, char *str, size_t len, const char *format,
925{
926 static const char nullbyte = '\0';
927 struct _str_ctx_a ctx = {len, str};
928 int ret;
929
931 FIXME("options %#I64x not handled\n", options);
932 ret = pf_printf_a(puts_clbk_str_c99_a,
934 puts_clbk_str_a(&ctx, 1, &nullbyte);
935
936 if(!str)
937 return ret;
939 return ret>len ? -1 : ret;
940 if(ret>=len) {
941 if(len) str[len-1] = 0;
943 return ret;
944 return len > 0 ? -2 : -1;
945 }
946 return ret;
947}
948
949#endif /* _MSVCR_VER>=140 */
950
951/*********************************************************************
952 * _vsnprintf_l (MSVCRT.@)
953 */
954int CDECL _vsnprintf_l( char *str, size_t len, const char *format,
956{
957 static const char nullbyte = '\0';
958 struct _str_ctx_a ctx = {len, str};
959 int ret;
960
961 ret = pf_printf_a(puts_clbk_str_a, &ctx, format, locale, 0,
963 puts_clbk_str_a(&ctx, 1, &nullbyte);
964 return ret;
965}
966
967/*********************************************************************
968 * _vsprintf_l (MSVCRT.@)
969 */
970int CDECL _vsprintf_l( char *str, const char *format,
972{
974}
975
976/*********************************************************************
977 * _sprintf_l (MSVCRT.@)
978 */
979int WINAPIV _sprintf_l(char *str, const char *format,
980 _locale_t locale, ...)
981{
982 int retval;
986 va_end(valist);
987 return retval;
988}
989
990static int CDECL vsnprintf_s_l_opt( char *str, size_t sizeOfBuffer,
991 size_t count, const char *format, DWORD options,
993{
994 static const char nullbyte = '\0';
995 struct _str_ctx_a ctx;
996 int len, ret;
997
998 if(sizeOfBuffer<count+1 || count==-1)
1000 else
1001 len = count+1;
1002
1003 ctx.len = len;
1004 ctx.buf = str;
1007 puts_clbk_str_a(&ctx, 1, &nullbyte);
1008
1009 if(ret<0 || ret==len) {
1011 MSVCRT_INVALID_PMT("str[sizeOfBuffer] is too small", ERANGE);
1012 memset(str, 0, sizeOfBuffer);
1013 } else
1014 str[len-1] = '\0';
1015
1016 return -1;
1017 }
1018
1019 return ret;
1020}
1021
1022static int vsnwprintf_s_l_opt( wchar_t *str, size_t sizeOfBuffer,
1023 size_t count, const wchar_t *format, DWORD options,
1025{
1026 struct _str_ctx_w ctx;
1027 int len, ret;
1028
1029 len = sizeOfBuffer;
1030 if(count!=-1 && len>count+1)
1031 len = count+1;
1032
1033 ctx.len = len;
1034 ctx.buf = str;
1037 puts_clbk_str_w(&ctx, 1, L"");
1038
1039 if(ret<0 || ret==len) {
1041 MSVCRT_INVALID_PMT("str[sizeOfBuffer] is too small", ERANGE);
1042 memset(str, 0, sizeOfBuffer*sizeof(wchar_t));
1043 } else
1044 str[len-1] = '\0';
1045
1046 return -1;
1047 }
1048
1049 return ret;
1050}
1051
1052/*********************************************************************
1053 * _vsnprintf_s_l (MSVCRT.@)
1054 */
1056 size_t count, const char *format,
1058{
1060}
1061
1062/*********************************************************************
1063 * _vsprintf_s_l (MSVCRT.@)
1064 */
1065int CDECL _vsprintf_s_l( char *str, size_t count, const char *format,
1067{
1069}
1070
1071/*********************************************************************
1072 * _sprintf_s_l (MSVCRT.@)
1073 */
1074int WINAPIV _sprintf_s_l( char *str, size_t count, const char *format,
1075 _locale_t locale, ...)
1076{
1077 int retval;
1081 va_end(valist);
1082 return retval;
1083}
1084
1085/*********************************************************************
1086 * _vsnprintf_s (MSVCRT.@)
1087 */
1089 size_t count, const char *format, va_list valist )
1090{
1092}
1093
1094/*********************************************************************
1095 * _vsnprintf_c_l (MSVCRT.@)
1096 */
1097int CDECL _vsnprintf_c_l(char *str, size_t len, const char *format,
1099{
1101}
1102
1103/*********************************************************************
1104 * _vsnprintf_c (MSVCRT.@)
1105 */
1106int CDECL _vsnprintf_c(char *str, size_t len,
1107 const char *format, va_list valist)
1108{
1109 return _vsnprintf_c_l(str, len, format, NULL, valist);
1110}
1111
1112#if _MSVCR_VER>=140
1113
1114/*********************************************************************
1115 * __stdio_common_vsnprintf_s (UCRTBASE.@)
1116 */
1118 char *str, size_t sizeOfBuffer, size_t count,
1119 const char *format, _locale_t locale, va_list valist )
1120{
1122 FIXME("options %#I64x not handled\n", options);
1124}
1125
1126/*********************************************************************
1127 * __stdio_common_vsnwprintf_s (UCRTBASE.@)
1128 */
1130 wchar_t *str, size_t sizeOfBuffer, size_t count,
1131 const wchar_t *format, _locale_t locale, va_list valist )
1132{
1134 FIXME("options %#I64x not handled\n", options);
1136}
1137
1138/*********************************************************************
1139 * __stdio_common_vswprintf_s (UCRTBASE.@)
1140 */
1142 wchar_t *str, size_t count, const wchar_t *format,
1144{
1146}
1147
1148/*********************************************************************
1149 * __stdio_common_vsprintf_s (UCRTBASE.@)
1150 */
1152 char *str, size_t count, const char *format,
1154{
1156 FIXME("options %#I64x not handled\n", options);
1158}
1159
1160#endif /* _MSVCR_VER>=140 */
1161
1162/*********************************************************************
1163 * vsprintf (MSVCRT.@)
1164 */
1165int CDECL vsprintf( char *str, const char *format, va_list valist)
1166{
1167 return vsnprintf(str, INT_MAX, format, valist);
1168}
1169
1170/*********************************************************************
1171 * vsprintf_s (MSVCRT.@)
1172 */
1173int CDECL vsprintf_s( char *str, size_t num, const char *format, va_list valist)
1174{
1175 return vsnprintf(str, num, format, valist);
1176}
1177
1178/*********************************************************************
1179 * _vscprintf (MSVCRT.@)
1180 */
1182{
1183 return _vsnprintf_l( NULL, INT_MAX, format, NULL, valist );
1184}
1185
1186/*********************************************************************
1187 * _vscprintf_l (MSVCRT.@)
1188 */
1189int CDECL _vscprintf_l(const char *format,
1191{
1193}
1194
1195/*********************************************************************
1196 * _vscprintf_p_l (MSVCRT.@)
1197 */
1200{
1201 printf_arg args_ctx[_ARGMAX+1];
1202 struct _str_ctx_a puts_ctx = {INT_MAX, NULL};
1203 int ret;
1204
1205 memset(args_ctx, 0, sizeof(args_ctx));
1206
1207 ret = create_positional_ctx_a(args_ctx, format, args);
1208 if(ret < 0) {
1210 *_errno() = EINVAL;
1211 return ret;
1212 } else if(ret == 0) {
1213 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1216 } else {
1217 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1219 arg_clbk_positional, args_ctx, NULL);
1220 }
1221
1222 return ret;
1223}
1224
1225/*********************************************************************
1226 * _vscprintf_p (MSVCR80.@)
1227 */
1228int CDECL _vscprintf_p(const char *format, va_list argptr)
1229{
1230 return _vscprintf_p_l(format, NULL, argptr);
1231}
1232
1233/*********************************************************************
1234 * _snprintf (MSVCRT.@)
1235 */
1236int WINAPIV _snprintf(char *str, size_t len, const char *format, ...)
1237{
1238 int retval;
1242 va_end(valist);
1243 return retval;
1244}
1245
1246/*********************************************************************
1247 * _snprintf_l (MSVCRT.@)
1248 */
1249int WINAPIV _snprintf_l(char *str, size_t count, const char *format,
1250 _locale_t locale, ...)
1251{
1252 int retval;
1256 va_end(valist);
1257 return retval;
1258}
1259
1260/*********************************************************************
1261 * _snprintf_c_l (MSVCRT.@)
1262 */
1263int WINAPIV _snprintf_c_l(char *str, size_t count, const char *format,
1264 _locale_t locale, ...)
1265{
1266 int retval;
1270 va_end(valist);
1271 return retval;
1272}
1273
1274/*********************************************************************
1275 * _snprintf_c (MSVCRT.@)
1276 */
1277int WINAPIV _snprintf_c(char *str, size_t count, const char *format, ...)
1278{
1279 int retval;
1283 va_end(valist);
1284 return retval;
1285}
1286
1287/*********************************************************************
1288 * _snprintf_s_l (MSVCRT.@)
1289 */
1290int WINAPIV _snprintf_s_l(char *str, size_t len, size_t count,
1291 const char *format, _locale_t locale, ...)
1292{
1293 int retval;
1297 va_end(valist);
1298 return retval;
1299}
1300
1301/*********************************************************************
1302 * _snprintf_s (MSVCRT.@)
1303 */
1304int WINAPIV _snprintf_s(char *str, size_t len, size_t count,
1305 const char *format, ...)
1306{
1307 int retval;
1311 va_end(valist);
1312 return retval;
1313}
1314
1315/*********************************************************************
1316 * _scprintf (MSVCRT.@)
1317 */
1318int WINAPIV _scprintf(const char *format, ...)
1319{
1320 int retval;
1324 va_end(valist);
1325 return retval;
1326}
1327
1328/*********************************************************************
1329 * _scprintf_l (MSVCRT.@)
1330 */
1332{
1333 int retval;
1337 va_end(valist);
1338 return retval;
1339}
1340
1341/*********************************************************************
1342 * _scprintf_p (MSVCRT.@)
1343 */
1344int WINAPIV _scprintf_p(const char *format, ...)
1345{
1346 int retval;
1350 va_end(valist);
1351 return retval;
1352}
1353
1354/*********************************************************************
1355 * _scprintf_p_l (MSVCRT.@)
1356 */
1358{
1359 int retval;
1363 va_end(valist);
1364 return retval;
1365}
1366
1367/*********************************************************************
1368 * _vsnwprintf (MSVCRT.@)
1369 */
1370int CDECL _vsnwprintf(wchar_t *str, size_t len,
1371 const wchar_t *format, va_list valist)
1372{
1373 struct _str_ctx_w ctx = {len, str};
1374 int ret;
1375
1376 ret = pf_printf_w(puts_clbk_str_w, &ctx, format, NULL, 0,
1378 puts_clbk_str_w(&ctx, 1, L"");
1379 return ret;
1380}
1381
1382/*********************************************************************
1383 * _vsnwprintf_l (MSVCRT.@)
1384 */
1385int CDECL _vsnwprintf_l(wchar_t *str, size_t len, const wchar_t *format,
1387{
1388 struct _str_ctx_w ctx = {len, str};
1389 int ret;
1390
1391 ret = pf_printf_w(puts_clbk_str_w, &ctx, format, locale, 0,
1393 puts_clbk_str_w(&ctx, 1, L"");
1394 return ret;
1395}
1396
1397/*********************************************************************
1398 * _vswprintf_c_l (MSVCRT.@)
1399 */
1400int CDECL _vswprintf_c_l(wchar_t *str, size_t len, const wchar_t *format,
1402{
1404}
1405
1406/*********************************************************************
1407 * _vswprintf_c (MSVCRT.@)
1408 */
1409int CDECL _vswprintf_c(wchar_t *str, size_t len,
1410 const wchar_t *format, va_list valist)
1411{
1412 return _vswprintf_c_l(str, len, format, NULL, valist);
1413}
1414
1415static int vswprintf_p_l_opt(wchar_t *buffer, size_t length,
1416 const wchar_t *format, DWORD options, _locale_t locale, va_list args)
1417{
1418 printf_arg args_ctx[_ARGMAX+1];
1419 struct _str_ctx_w puts_ctx = {length, buffer};
1420 int ret;
1421
1422 memset(args_ctx, 0, sizeof(args_ctx));
1423
1424 ret = create_positional_ctx_w(args_ctx, format, args);
1425 if(ret < 0) {
1427 *_errno() = EINVAL;
1428 return ret;
1429 } else if(ret == 0)
1432 else
1433 ret = pf_printf_w(puts_clbk_str_w, &puts_ctx, format, locale,
1435 arg_clbk_positional, args_ctx, NULL);
1436
1437 puts_clbk_str_w(&puts_ctx, 1, L"");
1438 return ret;
1439}
1440
1441/*********************************************************************
1442 * _vswprintf_p_l (MSVCRT.@)
1443 */
1444int CDECL _vswprintf_p_l(wchar_t *buffer, size_t length,
1445 const wchar_t *format, _locale_t locale, va_list args)
1446{
1448}
1449
1450#if _MSVCR_VER>=80
1451/*********************************************************************
1452 * _vswprintf_p (MSVCR80.@)
1453 */
1454int CDECL _vswprintf_p(wchar_t *buffer, size_t length,
1455 const wchar_t *format, va_list args)
1456{
1458}
1459#endif
1460
1461#if _MSVCR_VER>=140
1462/*********************************************************************
1463 * __stdio_common_vswprintf_p (UCRTBASE.@)
1464 */
1466 wchar_t *str, size_t count, const wchar_t *format,
1468{
1470 FIXME("options %#I64x not handled\n", options);
1472}
1473#endif
1474
1475/*********************************************************************
1476 * _vsnwprintf_s_l (MSVCRT.@)
1477 */
1479 size_t count, const wchar_t *format,
1481{
1483}
1484
1485/*********************************************************************
1486 * _vsnwprintf_s (MSVCRT.@)
1487 */
1489 size_t count, const wchar_t *format, va_list valist)
1490{
1492 format, NULL, valist);
1493}
1494
1495/*********************************************************************
1496 * _snwprintf (MSVCRT.@)
1497 */
1498int WINAPIV _snwprintf( wchar_t *str, size_t len, const wchar_t *format, ...)
1499{
1500 int retval;
1504 va_end(valist);
1505 return retval;
1506}
1507
1508/*********************************************************************
1509 * _snwprintf_l (MSVCRT.@)
1510 */
1511int WINAPIV _snwprintf_l( wchar_t *str, size_t len, const wchar_t *format,
1512 _locale_t locale, ...)
1513{
1514 int retval;
1518 va_end(valist);
1519 return retval;
1520}
1521
1522/*********************************************************************
1523 * _snwprintf_s (MSVCRT.@)
1524 */
1525int WINAPIV _snwprintf_s( wchar_t *str, size_t len, size_t count,
1526 const wchar_t *format, ...)
1527{
1528 int retval;
1532 va_end(valist);
1533 return retval;
1534}
1535
1536/*********************************************************************
1537 * _snwprintf_s_l (MSVCRT.@)
1538 */
1539int WINAPIV _snwprintf_s_l( wchar_t *str, size_t len, size_t count,
1540 const wchar_t *format, _locale_t locale, ... )
1541{
1542 int retval;
1546 va_end(valist);
1547 return retval;
1548}
1549
1550#if _MSVCR_VER>=140
1551
1552static int puts_clbk_str_c99_w(void *ctx, int len, const wchar_t *str)
1553{
1554 struct _str_ctx_w *out = ctx;
1555
1556 if(!out->buf)
1557 return len;
1558
1559 if(out->len < len) {
1560 memcpy(out->buf, str, out->len*sizeof(wchar_t));
1561 out->buf += out->len;
1562 out->len = 0;
1563 return len;
1564 }
1565
1566 memcpy(out->buf, str, len*sizeof(wchar_t));
1567 out->buf += len;
1568 out->len -= len;
1569 return len;
1570}
1571
1572/*********************************************************************
1573 * __stdio_common_vswprintf (UCRTBASE.@)
1574 */
1576 wchar_t *str, size_t len, const wchar_t *format,
1578{
1579 struct _str_ctx_w ctx = {len, str};
1580 int ret;
1581
1583 FIXME("options %#I64x not handled\n", options);
1584 ret = pf_printf_w(puts_clbk_str_c99_w,
1586 puts_clbk_str_w(&ctx, 1, L"");
1587
1588 if(!str)
1589 return ret;
1591 return ret>len ? -1 : ret;
1592 if(ret>=len) {
1593 if(len) str[len-1] = 0;
1595 return ret;
1596 return len > 0 ? -2 : -1;
1597 }
1598 return ret;
1599}
1600
1601#endif /* _MSVCR_VER>=140 */
1602
1603/*********************************************************************
1604 * sprintf (MSVCRT.@)
1605 */
1606int WINAPIV sprintf( char *str, const char *format, ... )
1607{
1608 va_list ap;
1609 int r;
1610
1611 va_start( ap, format );
1612 r = vsnprintf( str, INT_MAX, format, ap );
1613 va_end( ap );
1614 return r;
1615}
1616
1617/*********************************************************************
1618 * sprintf_s (MSVCRT.@)
1619 */
1620int WINAPIV sprintf_s( char *str, size_t num, const char *format, ... )
1621{
1622 va_list ap;
1623 int r;
1624
1625 va_start( ap, format );
1626 r = vsnprintf( str, num, format, ap );
1627 va_end( ap );
1628 return r;
1629}
1630
1631/*********************************************************************
1632 * _scwprintf_l (MSVCRT.@)
1633 */
1634int WINAPIV _scwprintf_l( const wchar_t *format, _locale_t locale, ... )
1635{
1636 va_list ap;
1637 int r;
1638
1639 va_start( ap, locale );
1641 va_end( ap );
1642 return r;
1643}
1644
1645/*********************************************************************
1646 * _scwprintf_p_l (MSVCRT.@)
1647 */
1648int WINAPIV _scwprintf_p_l( const wchar_t *format, _locale_t locale, ... )
1649{
1650 va_list ap;
1651 int r;
1652
1653 va_start( ap, locale );
1655 va_end( ap );
1656 return r;
1657}
1658
1659#if _MSVCR_VER>=80
1660/*********************************************************************
1661 * _scwprintf_p (MSVCRT.@)
1662 */
1663int WINAPIV _scwprintf_p( const wchar_t *format, ... )
1664{
1665 va_list ap;
1666 int r;
1667
1668 va_start( ap, format );
1670 va_end( ap );
1671 return r;
1672}
1673#endif
1674
1675/*********************************************************************
1676 * _scwprintf (MSVCRT.@)
1677 */
1678int WINAPIV _scwprintf( const wchar_t *format, ... )
1679{
1680 va_list ap;
1681 int r;
1682
1683 va_start( ap, format );
1685 va_end( ap );
1686 return r;
1687}
1688
1689/*********************************************************************
1690 * swprintf (MSVCRT.@)
1691 */
1692int WINAPIV _swprintf( wchar_t *str, const wchar_t *format, ... )
1693{
1694 va_list ap;
1695 int r;
1696
1697 va_start( ap, format );
1698 r = _vsnwprintf( str, INT_MAX, format, ap );
1699 va_end( ap );
1700 return r;
1701}
1702
1703/*********************************************************************
1704 * swprintf_s (MSVCRT.@)
1705 */
1707 const wchar_t *format, ... )
1708{
1709 va_list ap;
1710 int r;
1711
1712 va_start(ap, format);
1714 va_end(ap);
1715
1716 return r;
1717}
1718
1719/*********************************************************************
1720 * _swprintf_s_l (MSVCRT.@)
1721 */
1723 const wchar_t *format, _locale_t locale, ... )
1724{
1725 va_list ap;
1726 int r;
1727
1728 va_start(ap, locale);
1730 va_end(ap);
1731
1732 return r;
1733}
1734
1735/*********************************************************************
1736 * _swprintf_c_l (MSVCRT.@)
1737 */
1738int WINAPIV _swprintf_c_l(wchar_t *str, size_t len,
1739 const wchar_t *format, _locale_t locale, ... )
1740{
1741 va_list ap;
1742 int r;
1743
1744 va_start(ap, locale);
1746 va_end(ap);
1747
1748 return r;
1749}
1750
1751/*********************************************************************
1752 * _swprintf_c (MSVCRT.@)
1753 */
1754int WINAPIV _swprintf_c(wchar_t *str, size_t len,
1755 const wchar_t *format, ... )
1756{
1757 va_list ap;
1758 int r;
1759
1760 va_start(ap, format);
1761 r = _vswprintf_c(str, len, format, ap);
1762 va_end(ap);
1763
1764 return r;
1765}
1766
1767/*********************************************************************
1768 * _vswprintf (MSVCRT.@)
1769 */
1770int CDECL _vswprintf( wchar_t* str, const wchar_t* format, va_list args )
1771{
1772 return _vsnwprintf( str, INT_MAX, format, args );
1773}
1774
1775/*********************************************************************
1776 * _vswprintf (MSVCRT.@)
1777 */
1778int CDECL _vswprintf_l( wchar_t* str, const wchar_t* format,
1780{
1781 return _vsnwprintf_l( str, INT_MAX, format, locale, args );
1782}
1783
1784/*********************************************************************
1785 * _vscwprintf (MSVCRT.@)
1786 */
1787int CDECL _vscwprintf( const wchar_t *format, va_list args )
1788{
1789 return _vsnwprintf( NULL, INT_MAX, format, args );
1790}
1791
1792/*********************************************************************
1793 * _vscwprintf_l (MSVCRT.@)
1794 */
1796{
1798}
1799
1800/*********************************************************************
1801 * _vscwprintf_p_l (MSVCRT.@)
1802 */
1804{
1806}
1807
1808#if _MSVCR_VER>=80
1809/*********************************************************************
1810 * _vscwprintf_p (MSVCR80.@)
1811 */
1812int CDECL _vscwprintf_p(const wchar_t *format, va_list args)
1813{
1815}
1816#endif
1817
1818/*********************************************************************
1819 * vswprintf_s (MSVCRT.@)
1820 */
1822 const wchar_t* format, va_list args)
1823{
1825}
1826
1827/*********************************************************************
1828 * _vswprintf_s_l (MSVCRT.@)
1829 */
1831 const wchar_t* format, _locale_t locale, va_list args)
1832{
1834 format, locale, args );
1835}
1836
1837static int vsprintf_p_l_opt(char *buffer, size_t length, const char *format,
1839{
1840 static const char nullbyte = '\0';
1841 printf_arg args_ctx[_ARGMAX+1];
1842 struct _str_ctx_a puts_ctx = {length, buffer};
1843 int ret;
1844
1845 memset(args_ctx, 0, sizeof(args_ctx));
1846
1847 ret = create_positional_ctx_a(args_ctx, format, args);
1848 if(ret < 0) {
1850 *_errno() = EINVAL;
1851 return ret;
1852 } else if(ret == 0)
1853 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1855 else
1856 ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale,
1858 arg_clbk_positional, args_ctx, NULL);
1859
1860 puts_clbk_str_a(&puts_ctx, 1, &nullbyte);
1861 return ret;
1862}
1863
1864/*********************************************************************
1865 * _vsprintf_p_l (MSVCRT.@)
1866 */
1867int CDECL _vsprintf_p_l(char *buffer, size_t length, const char *format,
1869{
1871}
1872
1873/*********************************************************************
1874 * _vsprintf_p (MSVCRT.@)
1875 */
1876int CDECL _vsprintf_p(char *buffer, size_t length,
1877 const char *format, va_list args)
1878{
1880}
1881
1882#if _MSVCR_VER>=140
1883/*********************************************************************
1884 * __stdio_common_vsprintf_p (UCRTBASE.@)
1885 */
1886int CDECL __stdio_common_vsprintf_p(unsigned __int64 options, char *buffer, size_t length,
1887 const char *format, _locale_t locale, va_list args)
1888{
1890 FIXME("options %#I64x not handled\n", options);
1892}
1893#endif
1894
1895/*********************************************************************
1896 * _sprintf_p_l (MSVCRT.@)
1897 */
1899 const char *format, _locale_t locale, ...)
1900{
1902 int r;
1903
1906 va_end(valist);
1907
1908 return r;
1909}
1910
1911/*********************************************************************
1912 * __swprintf_l (MSVCRT.@)
1913 */
1914int WINAPIV __swprintf_l( wchar_t *str, const wchar_t *format,
1915 _locale_t locale, ...)
1916{
1917 int retval;
1921 va_end(valist);
1922 return retval;
1923}
1924
1925#if _MSVCR_VER>=80
1926/*********************************************************************
1927 * _sprintf_p (MSVCR80.@)
1928 */
1929int WINAPIV _sprintf_p(char *buffer, size_t length, const char *format, ...)
1930{
1932 int r;
1933
1936 va_end(valist);
1937
1938 return r;
1939}
1940#endif
1941
1942/*********************************************************************
1943 * _swprintf_p (MSVCRT.@)
1944 */
1945int WINAPIV _swprintf_p(wchar_t *buffer, size_t length,
1946 const wchar_t *format, ...)
1947{
1949 int r;
1950
1953 va_end(valist);
1954
1955 return r;
1956}
1957
1958/*********************************************************************
1959 * _swprintf_p_l (MSVCRT.@)
1960 */
1961int WINAPIV _swprintf_p_l(wchar_t *buffer, size_t length,
1962 const wchar_t *format, _locale_t locale, ...)
1963{
1965 int r;
1966
1969 va_end(valist);
1970
1971 return r;
1972}
1973
1974/*********************************************************************
1975 * wcscmp (MSVCRT.@)
1976 */
1977int CDECL wcscmp(const wchar_t *str1, const wchar_t *str2)
1978{
1979 while (*str1 && (*str1 == *str2))
1980 {
1981 str1++;
1982 str2++;
1983 }
1984
1985 if (*str1 < *str2)
1986 return -1;
1987 if (*str1 > *str2)
1988 return 1;
1989 return 0;
1990}
1991
1992/*********************************************************************
1993 * _wcscoll_l (MSVCRT.@)
1994 */
1995int CDECL _wcscoll_l(const wchar_t* str1, const wchar_t* str2, _locale_t locale)
1996{
1998
1999 if(!locale)
2000 locinfo = get_locinfo();
2001 else
2002 locinfo = locale->locinfo;
2003
2004 if(!locinfo->lc_handle[LC_COLLATE])
2005 return wcscmp(str1, str2);
2007 str1, -1, str2, -1)-CSTR_EQUAL;
2008}
2009
2010/*********************************************************************
2011 * wcscoll (MSVCRT.@)
2012 */
2013int CDECL wcscoll( const wchar_t* str1, const wchar_t* str2 )
2014{
2015 return _wcscoll_l(str1, str2, NULL);
2016}
2017
2018/*********************************************************************
2019 * wcspbrk (MSVCRT.@)
2020 */
2021wchar_t* CDECL wcspbrk( const wchar_t* str, const wchar_t* accept )
2022{
2023 const wchar_t* p;
2024
2025 while (*str)
2026 {
2027 for (p = accept; *p; p++) if (*p == *str) return (wchar_t*)str;
2028 str++;
2029 }
2030 return NULL;
2031}
2032
2033/*********************************************************************
2034 * wcstok_s (MSVCRT.@)
2035 */
2036wchar_t * CDECL wcstok_s( wchar_t *str, const wchar_t *delim,
2037 wchar_t **next_token )
2038{
2039 wchar_t *ret;
2040
2041 if (!MSVCRT_CHECK_PMT(delim != NULL)) return NULL;
2042 if (!MSVCRT_CHECK_PMT(next_token != NULL)) return NULL;
2043 if (!MSVCRT_CHECK_PMT(str != NULL || *next_token != NULL)) return NULL;
2044
2045 if (!str) str = *next_token;
2046
2047 while (*str && wcschr( delim, *str )) str++;
2048 if (!*str) ret = NULL;
2049 else
2050 {
2051 ret = str++;
2052 while (*str && !wcschr( delim, *str )) str++;
2053 if (*str) *str++ = 0;
2054 }
2055 *next_token = str;
2056 return ret;
2057}
2058
2059/*********************************************************************
2060 * wcstok (MSVCRT.@)
2061 */
2062#if _MSVCR_VER>=140
2063wchar_t * CDECL wcstok( wchar_t *str, const wchar_t *delim, wchar_t **ctx )
2064{
2065 if (!ctx)
2066 ctx = &msvcrt_get_thread_data()->wcstok_next;
2067 return wcstok_s(str, delim, ctx);
2068}
2069#else
2070wchar_t * CDECL wcstok( wchar_t *str, const wchar_t *delim )
2071{
2072 return wcstok_s(str, delim, &msvcrt_get_thread_data()->wcstok_next);
2073}
2074#endif
2075
2076/*********************************************************************
2077 * _wctomb_s_l (MSVCRT.@)
2078 */
2079int CDECL _wctomb_s_l(int *len, char *mbchar, size_t size,
2080 wchar_t wch, _locale_t locale)
2081{
2083 BOOL error = FALSE;
2084 BOOL *perror;
2085 int mblen;
2086
2087 if(!mbchar && size>0) {
2088 if(len)
2089 *len = 0;
2090 return 0;
2091 }
2092
2093 if(len)
2094 *len = -1;
2095
2097 return EINVAL;
2098
2099 if(!locale)
2100 locinfo = get_locinfo();
2101 else
2102 locinfo = locale->locinfo;
2103
2104 if(!locinfo->lc_codepage) {
2105 if(wch > 0xff) {
2106 if(mbchar && size>0)
2107 memset(mbchar, 0, size);
2108 *_errno() = EILSEQ;
2109 return EILSEQ;
2110 }
2111
2112 if(!MSVCRT_CHECK_PMT_ERR(size >= 1, ERANGE))
2113 return ERANGE;
2114
2115 *mbchar = wch;
2116 if(len)
2117 *len = 1;
2118 return 0;
2119 }
2120
2121 perror = (locinfo->lc_codepage != CP_UTF8 ? &error : NULL);
2122 mblen = WideCharToMultiByte(locinfo->lc_codepage, 0, &wch, 1, mbchar, size, NULL, perror);
2123 if(!mblen || error) {
2125 if(mbchar && size>0)
2126 memset(mbchar, 0, size);
2127
2128 MSVCRT_INVALID_PMT("insufficient buffer size", ERANGE);
2129 return ERANGE;
2130 }
2131
2132 *_errno() = EILSEQ;
2133 return EILSEQ;
2134 }
2135
2136 if(len)
2137 *len = mblen;
2138 return 0;
2139}
2140
2141/*********************************************************************
2142 * wctomb_s (MSVCRT.@)
2143 */
2144int CDECL wctomb_s(int *len, char *mbchar, size_t size, wchar_t wch)
2145{
2146 return _wctomb_s_l(len, mbchar, size, wch, NULL);
2147}
2148
2149/*********************************************************************
2150 * _wctomb_l (MSVCRT.@)
2151 */
2152int CDECL _wctomb_l(char *dst, wchar_t ch, _locale_t locale)
2153{
2154 int len;
2155#ifdef __REACTOS__
2156 int maxlen;
2157 if (locale)
2158 maxlen = locale->locinfo->mb_cur_max;
2159 else
2160 maxlen = get_locinfo()->mb_cur_max;
2161 if (_wctomb_s_l(&len, dst, maxlen, ch, locale) != 0)
2162 return -1;
2163#else
2165#endif
2166 return len;
2167}
2168
2169/*********************************************************************
2170 * wctomb (MSVCRT.@)
2171 */
2172INT CDECL wctomb( char *dst, wchar_t ch )
2173{
2174 return _wctomb_l(dst, ch, NULL);
2175}
2176
2177/*********************************************************************
2178 * wctob (MSVCRT.@)
2179 */
2181{
2182 char out;
2183 BOOL error = FALSE;
2184 BOOL *perror;
2185 UINT codepage = get_locinfo()->lc_codepage;
2186
2187 perror = (codepage != CP_UTF8 ? &error : NULL);
2188
2189 if(!codepage) {
2190 if (wchar < 0xff)
2191 return (signed char)wchar;
2192 else
2193 return EOF;
2194 } else if(WideCharToMultiByte( codepage, 0, &wchar, 1, &out, 1, NULL, perror ) && !error)
2195 return (INT)out;
2196 return EOF;
2197}
2198
2199/*********************************************************************
2200 * wcrtomb_s (MSVCRT.@)
2201 */
2202INT CDECL wcrtomb_s(size_t *len, char *mbchar,
2203 size_t size, wchar_t wch, mbstate_t *s)
2204{
2205 int ilen, ret;
2206
2207 if (s) *s = 0;
2208 ret = wctomb_s(&ilen, mbchar, size, wch);
2209 if (len) *len = ilen;
2210 return ret;
2211}
2212
2213/*********************************************************************
2214 * wcrtomb (MSVCRT.@)
2215 */
2216size_t CDECL wcrtomb( char *dst, wchar_t ch, mbstate_t *s)
2217{
2218 if(s)
2219 *s = 0;
2220 return wctomb(dst, ch);
2221}
2222
2223/*********************************************************************
2224 * _iswctype_l (MSVCRT.@)
2225 */
2227{
2228 WORD ct;
2229
2230 if (wc == WEOF) return 0;
2231 if (wc < 256) return MSVCRT__pwctype[wc] & type;
2232
2233 if (!GetStringTypeW(CT_CTYPE1, &wc, 1, &ct))
2234 {
2235 ERR("GetStringTypeW failed for %x\n", wc);
2236 return 0;
2237 }
2238 return ct & type;
2239}
2240
2241/*********************************************************************
2242 * iswctype (MSVCRT.@)
2243 */
2245{
2246 return _iswctype_l( wc, type, NULL );
2247}
2248
2249/*********************************************************************
2250 * _iswalnum_l (MSVCRT.@)
2251 */
2253{
2254 return _iswctype_l( wc, _ALPHA | _DIGIT, locale );
2255}
2256
2257/*********************************************************************
2258 * iswalnum (MSVCRT.@)
2259 */
2260INT CDECL iswalnum( wchar_t wc )
2261{
2262 return _iswalnum_l( wc, NULL );
2263}
2264
2265/*********************************************************************
2266 * iswalpha_l (MSVCRT.@)
2267 */
2269{
2270 return _iswctype_l( wc, _ALPHA, locale );
2271}
2272
2273/*********************************************************************
2274 * iswalpha (MSVCRT.@)
2275 */
2276INT CDECL iswalpha( wchar_t wc )
2277{
2278 return _iswalpha_l( wc, NULL );
2279}
2280
2281/*********************************************************************
2282 * _iswcntrl_l (MSVCRT.@)
2283 */
2285{
2286 return _iswctype_l( wc, _CONTROL, locale );
2287}
2288
2289/*********************************************************************
2290 * iswcntrl (MSVCRT.@)
2291 */
2292INT CDECL iswcntrl( wchar_t wc )
2293{
2294 return _iswcntrl_l( wc, NULL );
2295}
2296
2297/*********************************************************************
2298 * _iswdigit_l (MSVCRT.@)
2299 */
2301{
2302 return _iswctype_l( wc, _DIGIT, locale );
2303}
2304
2305/*********************************************************************
2306 * iswdigit (MSVCRT.@)
2307 */
2308INT CDECL iswdigit( wchar_t wc )
2309{
2310 return _iswdigit_l( wc, NULL );
2311}
2312
2313/*********************************************************************
2314 * _iswgraph_l (MSVCRT.@)
2315 */
2317{
2318 return _iswctype_l( wc, _ALPHA | _DIGIT | _PUNCT, locale );
2319}
2320
2321/*********************************************************************
2322 * iswgraph (MSVCRT.@)
2323 */
2324INT CDECL iswgraph( wchar_t wc )
2325{
2326 return _iswgraph_l( wc, NULL );
2327}
2328
2329/*********************************************************************
2330 * _iswlower_l (MSVCRT.@)
2331 */
2333{
2334 return _iswctype_l( wc, _LOWER, locale );
2335}
2336
2337/*********************************************************************
2338 * iswlower (MSVCRT.@)
2339 */
2340INT CDECL iswlower( wchar_t wc )
2341{
2342 return _iswlower_l( wc, NULL );
2343}
2344
2345/*********************************************************************
2346 * _iswprint_l (MSVCRT.@)
2347 */
2349{
2350 return _iswctype_l( wc, _ALPHA | _BLANK | _DIGIT | _PUNCT, locale );
2351}
2352
2353/*********************************************************************
2354 * iswprint (MSVCRT.@)
2355 */
2356INT CDECL iswprint( wchar_t wc )
2357{
2358 return _iswprint_l( wc, NULL );
2359}
2360
2361/*********************************************************************
2362 * _iswpunct_l (MSVCRT.@)
2363 */
2365{
2366 return _iswctype_l( wc, _PUNCT, locale );
2367}
2368
2369/*********************************************************************
2370 * iswpunct (MSVCRT.@)
2371 */
2372INT CDECL iswpunct( wchar_t wc )
2373{
2374 return _iswpunct_l( wc, NULL );
2375}
2376
2377/*********************************************************************
2378 * _iswspace_l (MSVCRT.@)
2379 */
2381{
2382 return _iswctype_l( wc, _SPACE, locale );
2383}
2384
2385/*********************************************************************
2386 * iswspace (MSVCRT.@)
2387 */
2388INT CDECL iswspace( wchar_t wc )
2389{
2390 return _iswspace_l( wc, NULL );
2391}
2392
2393/*********************************************************************
2394 * _iswupper_l (MSVCRT.@)
2395 */
2397{
2398 return _iswctype_l( wc, _UPPER, locale );
2399}
2400
2401/*********************************************************************
2402 * iswupper (MSVCRT.@)
2403 */
2404INT CDECL iswupper( wchar_t wc )
2405{
2406 return _iswupper_l( wc, NULL );
2407}
2408
2409/*********************************************************************
2410 * _iswxdigit_l (MSVCRT.@)
2411 */
2413{
2414 return _iswctype_l( wc, _HEX, locale );
2415}
2416
2417/*********************************************************************
2418 * iswxdigit (MSVCRT.@)
2419 */
2420INT CDECL iswxdigit( wchar_t wc )
2421{
2422 return _iswxdigit_l( wc, NULL );
2423}
2424
2425/*********************************************************************
2426 * _iswblank_l (MSVCRT.@)
2427 */
2429{
2430 return wc == '\t' || _iswctype_l( wc, _BLANK, locale );
2431}
2432
2433/*********************************************************************
2434 * iswblank (MSVCRT.@)
2435 */
2436INT CDECL iswblank( wchar_t wc )
2437{
2438 return wc == '\t' || _iswctype_l( wc, _BLANK, NULL );
2439}
2440
2441/*********************************************************************
2442 * wcscpy_s (MSVCRT.@)
2443 */
2444INT CDECL wcscpy_s( wchar_t* wcDest, size_t numElement, const wchar_t *wcSrc)
2445{
2446 size_t size = 0;
2447
2448 if(!MSVCRT_CHECK_PMT(wcDest)) return EINVAL;
2449 if(!MSVCRT_CHECK_PMT(numElement)) return EINVAL;
2450
2452 {
2453 wcDest[0] = 0;
2454 return EINVAL;
2455 }
2456
2457 size = wcslen(wcSrc) + 1;
2458
2459 if(!MSVCRT_CHECK_PMT_ERR(size <= numElement, ERANGE))
2460 {
2461 wcDest[0] = 0;
2462 return ERANGE;
2463 }
2464
2465 memmove( wcDest, wcSrc, size*sizeof(WCHAR) );
2466
2467 return 0;
2468}
2469
2470/***********************************************************************
2471 * wcscpy (MSVCRT.@)
2472 */
2473wchar_t* __cdecl wcscpy( wchar_t *dst, const wchar_t *src )
2474{
2475 WCHAR *p = dst;
2476 while ((*p++ = *src++));
2477 return dst;
2478}
2479
2480/******************************************************************
2481 * wcsncpy (MSVCRT.@)
2482 */
2483wchar_t* __cdecl wcsncpy( wchar_t* s1, const wchar_t *s2, size_t n )
2484{
2485 size_t i;
2486
2487 for(i=0; i<n; i++)
2488 if(!(s1[i] = s2[i])) break;
2489 for(; i<n; i++)
2490 s1[i] = 0;
2491 return s1;
2492}
2493
2494/******************************************************************
2495 * wcsncpy_s (MSVCRT.@)
2496 */
2497INT CDECL wcsncpy_s( wchar_t *dst, size_t elem, const wchar_t *src, size_t count )
2498{
2499 WCHAR *p = dst;
2500 BOOL truncate = (count == _TRUNCATE);
2501
2502 if (!count)
2503 {
2504 if (dst && elem) *dst = 0;
2505 return 0;
2506 }
2507
2508 if (!MSVCRT_CHECK_PMT(dst != NULL)) return EINVAL;
2509 if (!MSVCRT_CHECK_PMT(elem != 0)) return EINVAL;
2510 if (!MSVCRT_CHECK_PMT(src != NULL))
2511 {
2512 *dst = 0;
2513 return EINVAL;
2514 }
2515
2516 while (elem && count && *src)
2517 {
2518 *p++ = *src++;
2519 elem--;
2520 count--;
2521 }
2522 if (!elem && truncate)
2523 {
2524 *(p-1) = 0;
2525 return STRUNCATE;
2526 }
2527 else if (!elem)
2528 {
2529 *dst = 0;
2530 return ERANGE;
2531 }
2532 *p = 0;
2533 return 0;
2534}
2535
2536/******************************************************************
2537 * wcscat_s (MSVCRT.@)
2538 *
2539 */
2540INT CDECL wcscat_s(wchar_t* dst, size_t elem, const wchar_t* src)
2541{
2542 wchar_t* ptr = dst;
2543
2544 if (!dst || elem == 0) return EINVAL;
2545 if (!src)
2546 {
2547 dst[0] = '\0';
2548 return EINVAL;
2549 }
2550
2551 /* seek to end of dst string (or elem if no end of string is found */
2552 while (ptr < dst + elem && *ptr != '\0') ptr++;
2553 while (ptr < dst + elem)
2554 {
2555 if ((*ptr++ = *src++) == '\0') return 0;
2556 }
2557 /* not enough space */
2558 dst[0] = '\0';
2559 return ERANGE;
2560}
2561
2562/***********************************************************************
2563 * wcscat (MSVCRT.@)
2564 */
2565wchar_t* __cdecl wcscat( wchar_t *dst, const wchar_t *src )
2566{
2567 wcscpy( dst + wcslen(dst), src );
2568 return dst;
2569}
2570
2571/*********************************************************************
2572 * wcsncat_s (MSVCRT.@)
2573 */
2574errno_t CDECL wcsncat_s(wchar_t *dst, size_t elem, const wchar_t *src, size_t count)
2575{
2576 size_t i, j;
2577
2578 if (!MSVCRT_CHECK_PMT(dst != NULL)) return EINVAL;
2579 if (!MSVCRT_CHECK_PMT(elem > 0)) return EINVAL;
2580 if (count == 0) return 0;
2581 if (!MSVCRT_CHECK_PMT(src != NULL))
2582 {
2583 *dst = 0;
2584 return EINVAL;
2585 }
2586
2587 for (i = 0; i < elem; i++) if (!dst[i]) break;
2588
2589 if (i == elem)
2590 {
2591 MSVCRT_INVALID_PMT("dst[elem] is not NULL terminated\n", EINVAL);
2592 *dst = 0;
2593 return EINVAL;
2594 }
2595
2596 for (j = 0; (j + i) < elem; j++)
2597 {
2598 if(count == _TRUNCATE && j + i == elem - 1)
2599 {
2600 dst[j + i] = '\0';
2601 return STRUNCATE;
2602 }
2603 if(j == count || (dst[j + i] = src[j]) == '\0')
2604 {
2605 dst[j + i] = '\0';
2606 return 0;
2607 }
2608 }
2609
2610 MSVCRT_INVALID_PMT("dst[elem] is too small", ERANGE);
2611 dst[0] = '\0';
2612 return ERANGE;
2613}
2614
2615/*********************************************************************
2616 * wcsncat (NTDLL.@)
2617 */
2618wchar_t * __cdecl wcsncat(wchar_t *s1, const wchar_t *s2, size_t n)
2619{
2620 wchar_t *ret = s1;
2621 while (*s1) s1++;
2622 while (n-- > 0) if (!(*s1++ = *s2++)) return ret;
2623 *s1 = 0;
2624 return ret;
2625}
2626
2627/*********************************************************************
2628 * wctoint (INTERNAL)
2629 */
2630static int wctoint(WCHAR c, int base)
2631{
2632 int v = -1;
2633 if ('0' <= c && c <= '9')
2634 v = c - '0';
2635 else if ('A' <= c && c <= 'Z')
2636 v = c - 'A' + 10;
2637 else if ('a' <= c && c <= 'z')
2638 v = c - 'a' + 10;
2639 else {
2640 /* NOTE: MAP_FOLDDIGITS supports too many things. */
2641 /* Unicode points that contain digits 0-9; keep this sorted! */
2642 static const WCHAR zeros[] = {
2643 0x660, 0x6f0, 0x966, 0x9e6, 0xa66, 0xae6, 0xb66, 0xc66, 0xce6,
2644 0xd66, 0xe50, 0xed0, 0xf20, 0x1040, 0x17e0, 0x1810, 0xff10
2645 };
2646 int i;
2647 for (i = 0; i < ARRAY_SIZE(zeros) && c >= zeros[i]; ++i) {
2648 if (zeros[i] <= c && c <= zeros[i] + 9) {
2649 v = c - zeros[i];
2650 break;
2651 }
2652 }
2653 }
2654 return v < base ? v : -1;
2655}
2656
2657/*********************************************************************
2658 * _wcstoi64_l (MSVCRT.@)
2659 */
2660__int64 CDECL _wcstoi64_l(const wchar_t *nptr,
2661 wchar_t **endptr, int base, _locale_t locale)
2662{
2663 BOOL negative = FALSE, empty = TRUE;
2664 __int64 ret = 0;
2665
2666 TRACE("(%s %p %d %p)\n", debugstr_w(nptr), endptr, base, locale);
2667
2668 if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
2669 if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
2670 if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
2671
2672 if(endptr)
2673 *endptr = (wchar_t*)nptr;
2674
2675 while(_iswspace_l(*nptr, locale)) nptr++;
2676
2677 if(*nptr == '-') {
2678 negative = TRUE;
2679 nptr++;
2680 } else if(*nptr == '+')
2681 nptr++;
2682
2683 if((base==0 || base==16) && wctoint(*nptr, 1)==0 && (nptr[1]=='x' || nptr[1]=='X')) {
2684 base = 16;
2685 nptr += 2;
2686 }
2687
2688 if(base == 0) {
2689 if(wctoint(*nptr, 1)==0)
2690 base = 8;
2691 else
2692 base = 10;
2693 }
2694
2695 while(*nptr) {
2696 int v = wctoint(*nptr, base);
2697 if(v<0)
2698 break;
2699
2700 if(negative)
2701 v = -v;
2702
2703 nptr++;
2704 empty = FALSE;
2705
2706 if(!negative && (ret>I64_MAX/base || ret*base>I64_MAX-v)) {
2707 ret = I64_MAX;
2708 *_errno() = ERANGE;
2709 } else if(negative && (ret<I64_MIN/base || ret*base<I64_MIN-v)) {
2710 ret = I64_MIN;
2711 *_errno() = ERANGE;
2712 } else
2713 ret = ret*base + v;
2714 }
2715
2716 if(endptr && !empty)
2717 *endptr = (wchar_t*)nptr;
2718
2719 return ret;
2720}
2721
2722/*********************************************************************
2723 * _wcstoi64 (MSVCRT.@)
2724 */
2725__int64 CDECL _wcstoi64(const wchar_t *nptr,
2726 wchar_t **endptr, int base)
2727{
2728 return _wcstoi64_l(nptr, endptr, base, NULL);
2729}
2730
2731/*********************************************************************
2732 * _wcstol_l (MSVCRT.@)
2733 */
2735 wchar_t **end, int base, _locale_t locale)
2736{
2738
2739 if(ret > LONG_MAX) {
2740 ret = LONG_MAX;
2741 *_errno() = ERANGE;
2742 }else if(ret < LONG_MIN) {
2743 ret = LONG_MIN;
2744 *_errno() = ERANGE;
2745 }
2746 return ret;
2747}
2748
2749/*********************************************************************
2750 * wcstol (MSVCRT.@)
2751 */
2753 wchar_t **end, int base)
2754{
2755 return _wcstol_l(s, end, base, NULL);
2756}
2757
2758/*********************************************************************
2759 * _wtoi_l (MSVCRT.@)
2760 */
2761int __cdecl _wtoi_l(const wchar_t *str, _locale_t locale)
2762{
2764
2765 if(ret > INT_MAX) {
2766 ret = INT_MAX;
2767 *_errno() = ERANGE;
2768 } else if(ret < INT_MIN) {
2769 ret = INT_MIN;
2770 *_errno() = ERANGE;
2771 }
2772 return ret;
2773}
2774
2775/*********************************************************************
2776 * _wtoi (MSVCRT.@)
2777 */
2778int __cdecl _wtoi(const wchar_t *str)
2779{
2780 return _wtoi_l(str, NULL);
2781}
2782
2783/*********************************************************************
2784 * _wtol_l (MSVCRT.@)
2785 */
2787{
2789
2790 if(ret > LONG_MAX) {
2791 ret = LONG_MAX;
2792 *_errno() = ERANGE;
2793 } else if(ret < LONG_MIN) {
2794 ret = LONG_MIN;
2795 *_errno() = ERANGE;
2796 }
2797 return ret;
2798}
2799
2800/*********************************************************************
2801 * _wtol (MSVCRT.@)
2802 */
2804{
2805 return _wtol_l(str, NULL);
2806}
2807
2808#if _MSVCR_VER>=120
2809
2810/*********************************************************************
2811 * _wtoll_l (MSVCR120.@)
2812 */
2813__int64 __cdecl _wtoll_l(const wchar_t *str, _locale_t locale)
2814{
2815 return _wcstoi64_l(str, NULL, 10, locale);
2816}
2817
2818/*********************************************************************
2819 * _wtoll (MSVCR120.@)
2820 */
2821__int64 __cdecl _wtoll(const wchar_t *str)
2822{
2823 return _wtoll_l(str, NULL);
2824}
2825
2826#endif /* _MSVCR_VER>=120 */
2827
2828/*********************************************************************
2829 * _wcstoui64_l (MSVCRT.@)
2830 */
2831unsigned __int64 CDECL _wcstoui64_l(const wchar_t *nptr,
2832 wchar_t **endptr, int base, _locale_t locale)
2833{
2834 BOOL negative = FALSE, empty = TRUE;
2835 unsigned __int64 ret = 0;
2836
2837 TRACE("(%s %p %d %p)\n", debugstr_w(nptr), endptr, base, locale);
2838
2839 if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
2840 if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
2841 if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
2842
2843 if(endptr)
2844 *endptr = (wchar_t*)nptr;
2845
2846 while(_iswspace_l(*nptr, locale)) nptr++;
2847
2848 if(*nptr == '-') {
2849 negative = TRUE;
2850 nptr++;
2851 } else if(*nptr == '+')
2852 nptr++;
2853
2854 if((base==0 || base==16) && wctoint(*nptr, 1)==0 && (nptr[1]=='x' || nptr[1]=='X')) {
2855 base = 16;
2856 nptr += 2;
2857 }
2858
2859 if(base == 0) {
2860 if(wctoint(*nptr, 1)==0)
2861 base = 8;
2862 else
2863 base = 10;
2864 }
2865
2866 while(*nptr) {
2867 int v = wctoint(*nptr, base);
2868 if(v<0)
2869 break;
2870
2871 nptr++;
2872 empty = FALSE;
2873
2874 if(ret>UI64_MAX/base || ret*base>UI64_MAX-v) {
2875 ret = UI64_MAX;
2876 *_errno() = ERANGE;
2877 } else
2878 ret = ret*base + v;
2879 }
2880
2881 if(endptr && !empty)
2882 *endptr = (wchar_t*)nptr;
2883
2884 return negative ? -ret : ret;
2885}
2886
2887/*********************************************************************
2888 * _wcstoui64 (MSVCRT.@)
2889 */
2890unsigned __int64 CDECL _wcstoui64(const wchar_t *nptr,
2891 wchar_t **endptr, int base)
2892{
2893 return _wcstoui64_l(nptr, endptr, base, NULL);
2894}
2895
2896/*********************************************************************
2897 * _wcstoul_l (MSVCRT.@)
2898 */
2900 wchar_t **end, int base, _locale_t locale)
2901{
2903
2904 if(ret > ULONG_MAX) {
2905 ret = ULONG_MAX;
2906 *_errno() = ERANGE;
2907 }else if(ret < -(__int64)ULONG_MAX) {
2908 ret = 1;
2909 *_errno() = ERANGE;
2910 }
2911 return ret;
2912}
2913
2914/*********************************************************************
2915 * wcstoul (MSVCRT.@)
2916 */
2917__msvcrt_ulong __cdecl wcstoul(const wchar_t *s, wchar_t **end, int base)
2918{
2919 return _wcstoul_l(s, end, base, NULL);
2920}
2921
2922/******************************************************************
2923 * wcsnlen (MSVCRT.@)
2924 */
2925size_t CDECL wcsnlen(const wchar_t *s, size_t maxlen)
2926{
2927 size_t i;
2928
2929 for (i = 0; i < maxlen; i++)
2930 if (!s[i]) break;
2931 return i;
2932}
2933
2934/*********************************************************************
2935 * _towupper_l (MSVCRT.@)
2936 */
2938{
2940 wchar_t ret;
2941
2942 if(!locale)
2943 locinfo = get_locinfo();
2944 else
2945 locinfo = locale->locinfo;
2946
2947 if(!locinfo->lc_handle[LC_CTYPE]) {
2948 if(c >= 'a' && c <= 'z')
2949 return c + 'A' - 'a';
2950 return c;
2951 }
2952
2953 if(!LCMapStringW(locinfo->lc_handle[LC_CTYPE], LCMAP_UPPERCASE, &c, 1, &ret, 1))
2954 return c;
2955 return ret;
2956}
2957
2958/*********************************************************************
2959 * towupper (MSVCRT.@)
2960 */
2962{
2963 return _towupper_l(c, NULL);
2964}
2965
2966/*********************************************************************
2967 * wcschr (MSVCRT.@)
2968 */
2969wchar_t* CDECL wcschr(const wchar_t *str, wchar_t ch)
2970{
2971 do { if (*str == ch) return (WCHAR *)(ULONG_PTR)str; } while (*str++);
2972 return NULL;
2973}
2974
2975/*********************************************************************
2976 * wcsrchr (MSVCRT.@)
2977 */
2978wchar_t* CDECL wcsrchr(const wchar_t *str, wchar_t ch)
2979{
2980 WCHAR *ret = NULL;
2981 do { if (*str == ch) ret = (WCHAR *)(ULONG_PTR)str; } while (*str++);
2982 return ret;
2983}
2984
2985/***********************************************************************
2986 * wcslen (MSVCRT.@)
2987 */
2988size_t CDECL wcslen(const wchar_t *str)
2989{
2990 const wchar_t *s = str;
2991 while (*s) s++;
2992 return s - str;
2993}
2994
2995/*********************************************************************
2996 * wcsstr (MSVCRT.@)
2997 */
2998wchar_t* CDECL wcsstr(const wchar_t *str, const wchar_t *sub)
2999{
3000 while(*str)
3001 {
3002 const wchar_t *p1 = str, *p2 = sub;
3003 while(*p1 && *p2 && *p1 == *p2)
3004 {
3005 p1++;
3006 p2++;
3007 }
3008 if(!*p2)
3009 return (wchar_t*)str;
3010 str++;
3011 }
3012 return NULL;
3013}
3014
3015/*********************************************************************
3016 * _wtoi64_l (MSVCRT.@)
3017 */
3019{
3020 ULONGLONG RunningTotal = 0;
3021 BOOL bMinus = FALSE;
3022
3023 while (_iswspace_l(*str, locale)) {
3024 str++;
3025 } /* while */
3026
3027 if (*str == '+') {
3028 str++;
3029 } else if (*str == '-') {
3030 bMinus = TRUE;
3031 str++;
3032 } /* if */
3033
3034 while (*str >= '0' && *str <= '9') {
3035 RunningTotal = RunningTotal * 10 + *str - '0';
3036 str++;
3037 } /* while */
3038
3039 return bMinus ? -RunningTotal : RunningTotal;
3040}
3041
3042/*********************************************************************
3043 * _wtoi64 (MSVCRT.@)
3044 */
3045__int64 CDECL _wtoi64(const wchar_t *str)
3046{
3047 return _wtoi64_l(str, NULL);
3048}
3049
3050/*********************************************************************
3051 * _wcsxfrm_l (MSVCRT.@)
3052 */
3053size_t CDECL _wcsxfrm_l(wchar_t *dest, const wchar_t *src,
3054 size_t len, _locale_t locale)
3055{
3057 int i, ret;
3058
3059 if(!MSVCRT_CHECK_PMT(src)) return INT_MAX;
3060 if(!MSVCRT_CHECK_PMT(dest || !len)) return INT_MAX;
3061
3062 if(len > INT_MAX) {
3063 FIXME("len > INT_MAX not supported\n");
3064 len = INT_MAX;
3065 }
3066
3067 if(!locale)
3068 locinfo = get_locinfo();
3069 else
3070 locinfo = locale->locinfo;
3071
3072 if(!locinfo->lc_handle[LC_COLLATE]) {
3073 wcsncpy(dest, src, len);
3074 return wcslen(src);
3075 }
3076
3077 ret = LCMapStringW(locinfo->lc_handle[LC_COLLATE],
3078 LCMAP_SORTKEY, src, -1, NULL, 0);
3079 if(!ret) {
3080 if(len) dest[0] = 0;
3081 *_errno() = EILSEQ;
3082 return INT_MAX;
3083 }
3084 if(!len) return ret-1;
3085
3086 if(ret > len) {
3087 dest[0] = 0;
3088 *_errno() = ERANGE;
3089 return ret-1;
3090 }
3091
3092 ret = LCMapStringW(locinfo->lc_handle[LC_COLLATE],
3093 LCMAP_SORTKEY, src, -1, dest, len) - 1;
3094 for(i=ret; i>=0; i--)
3095 dest[i] = ((unsigned char*)dest)[i];
3096 return ret;
3097}
3098
3099/*********************************************************************
3100 * wcsxfrm (MSVCRT.@)
3101 */
3102size_t CDECL wcsxfrm(wchar_t *dest, const wchar_t *src, size_t len)
3103{
3104 return _wcsxfrm_l(dest, src, len, NULL);
3105}
unsigned char BOOLEAN
Definition: actypes.h:127
#define vsnprintf
Definition: acwin.h:108
long long __cdecl _wtoll(wchar_t const *const string)
Definition: atox.cpp:89
long long __cdecl _wtoll_l(wchar_t const *const string, _locale_t const locale)
Definition: atox.cpp:94
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
#define ARRAY_SIZE(A)
Definition: main.h:20
#define FIXME(fmt,...)
Definition: precomp.h:53
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: _locale.h:75
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define malloc
Definition: debug_ros.c:4
int next_token(char **, FILE *)
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static const WCHAR empty[1]
Definition: string.c:47
@ Sign
Definition: msg.c:1064
#define CDECL
Definition: compat.h:29
#define wcschr
Definition: compat.h:17
#define wcsrchr
Definition: compat.h:16
#define WideCharToMultiByte
Definition: compat.h:111
@ VT_INT
Definition: compat.h:2316
@ VT_PTR
Definition: compat.h:2320
@ VT_R8
Definition: compat.h:2300
@ VT_I8
Definition: compat.h:2314
INT WINAPI CompareStringW(LCID lcid, DWORD flags, LPCWSTR str1, INT len1, LPCWSTR str2, INT len2)
Definition: locale.c:3946
BOOL WINAPI GetStringTypeW(DWORD type, LPCWSTR src, INT count, LPWORD chartype)
Definition: locale.c:3098
INT WINAPI LCMapStringW(LCID lcid, DWORD flags, LPCWSTR src, INT srclen, LPWSTR dst, INT dstlen)
Definition: locale.c:3808
unsigned char ch[4][2]
Definition: console.c:118
WORD * MSVCRT__pwctype
Definition: ctype.c:128
void CDECL perror(const char *str)
Definition: errno.c:337
void __cdecl _invalid_parameter(const wchar_t *expr, const wchar_t *func, const wchar_t *file, unsigned int line, uintptr_t arg)
Definition: errno.c:461
int *CDECL _errno(void)
Definition: errno.c:215
int errno_t
Definition: corecrt.h:249
long __msvcrt_long
Definition: corecrt.h:167
#define __cdecl
Definition: corecrt.h:121
#define _ARGMAX
Definition: corecrt.h:157
unsigned short wint_t
Definition: corecrt.h:243
unsigned short wctype_t
Definition: corecrt.h:244
#define __int64
Definition: corecrt.h:72
unsigned long __msvcrt_ulong
Definition: corecrt.h:168
#define _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION
#define _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR
#define _BLANK
#define _PUNCT
#define _CONTROL
#define _LOWER
#define _SPACE
#define _ALPHA
#define _UPPER
#define _HEX
#define _DIGIT
#define WEOF
_ACRTIMP float __cdecl wcstof(const wchar_t *, wchar_t **)
Definition: strtod.cpp:114
_ACRTIMP float __cdecl _wcstof_l(const wchar_t *, wchar_t **, _locale_t)
Definition: strtod.cpp:122
#define EINVAL
Definition: errno.h:44
#define STRUNCATE
Definition: errno.h:64
#define ERANGE
Definition: errno.h:55
#define EILSEQ
Definition: errno.h:62
#define I64_MIN
Definition: limits.h:41
#define INT_MIN
Definition: limits.h:25
#define ULONG_MAX
Definition: limits.h:31
#define LONG_MAX
Definition: limits.h:30
#define I64_MAX
Definition: limits.h:42
#define UI64_MAX
Definition: limits.h:43
#define MB_LEN_MAX
Definition: limits.h:7
#define INT_MAX
Definition: limits.h:26
#define LONG_MIN
Definition: limits.h:29
#define LC_CTYPE
Definition: locale.h:27
#define LC_COLLATE
Definition: locale.h:26
#define isfinite(x)
Definition: math.h:363
#define _NLSCMPERROR
Definition: mbstring.h:28
#define va_end(v)
Definition: stdarg.h:28
#define va_arg(v, l)
Definition: stdarg.h:27
#define va_start(v, l)
Definition: stdarg.h:26
_ACRTIMP int __cdecl _set_printf_count_output(int)
#define EOF
Definition: stdio.h:33
_ACRTIMP int __cdecl _get_printf_count_output(void)
_ACRTIMP int __cdecl mblen(const char *, size_t)
Definition: mbcs.c:3092
#define _TRUNCATE
Definition: stdlib.h:45
char * va_list
Definition: vadefs.h:50
int mbstate_t
Definition: wchar.h:30
wchar_t wctrans_t
Definition: wctype.h:71
_locale_t CDECL get_current_locale_noalloc(_locale_t locale)
Definition: locale.c:1149
void CDECL free_locale_noalloc(_locale_t locale)
Definition: locale.c:1162
thread_data_t *CDECL msvcrt_get_thread_data(void)
Definition: ucrt_tls_sup.c:59
#define UCRTBASE_PRINTF_MASK
Definition: msvcrt.h:401
int create_positional_ctx_w(void *, const wchar_t *, va_list)
int pf_printf_a(puts_clbk_a, void *, const char *, _locale_t, DWORD, args_clbk, void *, va_list *)
#define MSVCRT_PRINTF_POSITIONAL_PARAMS
Definition: msvcrt.h:409
#define MSVCRT_INVALID_PMT(x, err)
Definition: msvcrt.h:376
int create_positional_ctx_a(void *, const char *, va_list)
struct fpnum fpnum_parse(wchar_t(*)(void *), void(*)(void *), void *, pthreadlocinfo, BOOL)
#define MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER
Definition: msvcrt.h:410
int pf_printf_w(puts_clbk_w, void *, const wchar_t *, _locale_t, DWORD, args_clbk, void *, va_list *)
#define MSVCRT_CHECK_PMT(x)
Definition: msvcrt.h:378
#define MSVCRT_CHECK_PMT_ERR(x, err)
Definition: msvcrt.h:377
int fpnum_double(struct fpnum *, double *)
Definition: string.c:370
else locinfo
Definition: scanf.h:225
int CDECL wcsrtombs_s(size_t *ret, char *mbstr, size_t size, const wchar_t **wcstr, size_t count, mbstate_t *mbstate)
Definition: wcs.c:790
int CDECL _vswprintf(wchar_t *str, const wchar_t *format, va_list args)
Definition: wcs.c:1770
int CDECL _wcsncoll_l(const wchar_t *str1, const wchar_t *str2, size_t count, _locale_t locale)
Definition: wcs.c:538
static BOOL n_format_enabled
Definition: wcs.c:54
int WINAPIV _snprintf_s_l(char *str, size_t len, size_t count, const char *format, _locale_t locale,...)
Definition: wcs.c:1290
int WINAPIV _scprintf_p_l(const char *format, _locale_t locale,...)
Definition: wcs.c:1357
int WINAPIV _snwprintf(wchar_t *str, size_t len, const wchar_t *format,...)
Definition: wcs.c:1498
wchar_t *CDECL wcstok_s(wchar_t *str, const wchar_t *delim, wchar_t **next_token)
Definition: wcs.c:2036
__msvcrt_long __cdecl _wtol(const wchar_t *str)
Definition: wcs.c:2803
INT CDECL _wcsnicmp(const wchar_t *str1, const wchar_t *str2, size_t n)
Definition: wcs.c:200
printf_arg arg_clbk_valist(void *ctx, int arg_pos, int type, va_list *valist)
Definition: wcs.c:852
INT CDECL _iswctype_l(wchar_t wc, wctype_t type, _locale_t locale)
Definition: wcs.c:2226
int WINAPIV _snprintf_c(char *str, size_t count, const char *format,...)
Definition: wcs.c:1277
__int64 CDECL _wtoi64_l(const wchar_t *str, _locale_t locale)
Definition: wcs.c:3018
static int wcsrtombs_s_l(size_t *ret, char *mbstr, size_t size, const wchar_t **wcstr, size_t count, _locale_t locale)
Definition: wcs.c:718
static void strtod_wstr_unget(void *ctx)
Definition: wcs.c:570
int CDECL wcstombs_s(size_t *ret, char *mbstr, size_t size, const wchar_t *wcstr, size_t count)
Definition: wcs.c:781
int CDECL _vsnprintf_s_l(char *str, size_t sizeOfBuffer, size_t count, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:1055
__msvcrt_ulong __cdecl _wcstoul_l(const wchar_t *s, wchar_t **end, int base, _locale_t locale)
Definition: wcs.c:2899
int CDECL vsprintf(char *str, const char *format, va_list valist)
Definition: wcs.c:1165
int CDECL _vscwprintf_p_l(const wchar_t *format, _locale_t locale, va_list args)
Definition: wcs.c:1803
wchar_t *CDECL _wcsrev(wchar_t *str)
Definition: wcs.c:329
int CDECL _vsnwprintf_s_l(wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, _locale_t locale, va_list valist)
Definition: wcs.c:1478
int WINAPIV _scwprintf(const wchar_t *format,...)
Definition: wcs.c:1678
size_t CDECL wcsrtombs(char *mbstr, const wchar_t **wcstr, size_t count, mbstate_t *mbstate)
Definition: wcs.c:706
size_t __cdecl wcsspn(const wchar_t *str, const wchar_t *accept)
Definition: wcs.c:513
INT CDECL wctob(wint_t wchar)
Definition: wcs.c:2180
double CDECL _wtof(const wchar_t *str)
Definition: wcs.c:810
int CDECL _wctomb_l(char *dst, wchar_t ch, _locale_t locale)
Definition: wcs.c:2152
int __cdecl _wtoi(const wchar_t *str)
Definition: wcs.c:2778
INT CDECL _wcsicoll(const wchar_t *str1, const wchar_t *str2)
Definition: wcs.c:241
int CDECL _vswprintf_p_l(wchar_t *buffer, size_t length, const wchar_t *format, _locale_t locale, va_list args)
Definition: wcs.c:1444
int WINAPIV sprintf_s(char *str, size_t num, const char *format,...)
Definition: wcs.c:1620
int WINAPIV _scprintf_p(const char *format,...)
Definition: wcs.c:1344
int CDECL _vsprintf_p(char *buffer, size_t length, const char *format, va_list args)
Definition: wcs.c:1876
INT CDECL iswctype(wchar_t wc, wctype_t type)
Definition: wcs.c:2244
int WINAPIV _snprintf_c_l(char *str, size_t count, const char *format, _locale_t locale,...)
Definition: wcs.c:1263
wint_t CDECL _towupper_l(wint_t c, _locale_t locale)
Definition: wcs.c:2937
__int64 CDECL _wcstoi64(const wchar_t *nptr, wchar_t **endptr, int base)
Definition: wcs.c:2725
int WINAPIV _scwprintf_p_l(const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1648
int CDECL _vsnwprintf_l(wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist)
Definition: wcs.c:1385
__msvcrt_long __cdecl _wtol_l(const wchar_t *str, _locale_t locale)
Definition: wcs.c:2786
unsigned __int64 CDECL _wcstoui64(const wchar_t *nptr, wchar_t **endptr, int base)
Definition: wcs.c:2890
int CDECL _vsprintf_p_l(char *buffer, size_t length, const char *format, _locale_t locale, va_list args)
Definition: wcs.c:1867
int WINAPIV swprintf_s(wchar_t *str, size_t numberOfElements, const wchar_t *format,...)
Definition: wcs.c:1706
int CDECL _vsprintf_l(char *str, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:970
int CDECL _vswprintf_c(wchar_t *str, size_t len, const wchar_t *format, va_list valist)
Definition: wcs.c:1409
int WINAPIV _snprintf_l(char *str, size_t count, const char *format, _locale_t locale,...)
Definition: wcs.c:1249
__msvcrt_long CDECL wcstol(const wchar_t *s, wchar_t **end, int base)
Definition: wcs.c:2752
int CDECL _vswprintf_l(wchar_t *str, const wchar_t *format, _locale_t locale, va_list args)
Definition: wcs.c:1778
int WINAPIV __swprintf_l(wchar_t *str, const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1914
int WINAPIV _snwprintf_s_l(wchar_t *str, size_t len, size_t count, const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1539
INT CDECL _wcsnicoll(const wchar_t *str1, const wchar_t *str2, size_t count)
Definition: wcs.c:287
INT CDECL _wcsicmp(const wchar_t *str1, const wchar_t *str2)
Definition: wcs.c:164
INT CDECL wcrtomb_s(size_t *len, char *mbchar, size_t size, wchar_t wch, mbstate_t *s)
Definition: wcs.c:2202
int WINAPIV _sprintf_l(char *str, const char *format, _locale_t locale,...)
Definition: wcs.c:979
int CDECL wcscoll(const wchar_t *str1, const wchar_t *str2)
Definition: wcs.c:2013
static wchar_t strtod_wstr_get(void *ctx)
Definition: wcs.c:563
int CDECL _vsnprintf_l(char *str, size_t len, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:954
int CDECL _wctomb_s_l(int *len, char *mbchar, size_t size, wchar_t wch, _locale_t locale)
Definition: wcs.c:2079
int __cdecl _wtoi_l(const wchar_t *str, _locale_t locale)
Definition: wcs.c:2761
static int vsprintf_p_l_opt(char *buffer, size_t length, const char *format, DWORD options, _locale_t locale, va_list args)
Definition: wcs.c:1837
int CDECL _wcsnicoll_l(const wchar_t *str1, const wchar_t *str2, size_t count, _locale_t locale)
Definition: wcs.c:249
int CDECL vsprintf_s(char *str, size_t num, const char *format, va_list valist)
Definition: wcs.c:1173
int CDECL _vswprintf_c_l(wchar_t *str, size_t len, const wchar_t *format, _locale_t locale, va_list valist)
Definition: wcs.c:1400
int WINAPIV _swprintf_p(wchar_t *buffer, size_t length, const wchar_t *format,...)
Definition: wcs.c:1945
size_t CDECL wcsnlen(const wchar_t *s, size_t maxlen)
Definition: wcs.c:2925
size_t CDECL wcsxfrm(wchar_t *dest, const wchar_t *src, size_t len)
Definition: wcs.c:3102
int WINAPIV _scwprintf_l(const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1634
int CDECL _vsnprintf_c_l(char *str, size_t len, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:1097
__int64 CDECL _wtoi64(const wchar_t *str)
Definition: wcs.c:3045
int CDECL _vscwprintf_l(const wchar_t *format, _locale_t locale, va_list args)
Definition: wcs.c:1795
INT CDECL _wcsnicmp_l(const wchar_t *str1, const wchar_t *str2, size_t n, _locale_t locale)
Definition: wcs.c:172
static int vswprintf_p_l_opt(wchar_t *buffer, size_t length, const wchar_t *format, DWORD options, _locale_t locale, va_list args)
Definition: wcs.c:1415
size_t __cdecl wcscspn(const wchar_t *str, const wchar_t *reject)
Definition: wcs.c:503
static size_t wcsrtombs_l(char *mbstr, const wchar_t **wcstr, size_t count, _locale_t locale)
Definition: wcs.c:614
int WINAPIV _snprintf_s(char *str, size_t len, size_t count, const char *format,...)
Definition: wcs.c:1304
wchar_t *CDECL wcspbrk(const wchar_t *str, const wchar_t *accept)
Definition: wcs.c:2021
int CDECL _vscprintf_l(const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:1189
wint_t CDECL towctrans(wint_t c, wctrans_t category)
Definition: wcs.c:154
int WINAPIV _swprintf_c_l(wchar_t *str, size_t len, const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1738
printf_arg arg_clbk_positional(void *ctx, int pos, int type, va_list *valist)
Definition: wcs.c:875
wint_t CDECL _towlower_l(wint_t c, _locale_t locale)
Definition: wcs.c:101
int WINAPIV _snprintf(char *str, size_t len, const char *format,...)
Definition: wcs.c:1236
double CDECL wcstod(const wchar_t *lpszStr, wchar_t **end)
Definition: wcs.c:802
__int64 CDECL _wcstoi64_l(const wchar_t *nptr, wchar_t **endptr, int base, _locale_t locale)
Definition: wcs.c:2660
int CDECL _wcsicoll_l(const wchar_t *str1, const wchar_t *str2, _locale_t locale)
Definition: wcs.c:208
int CDECL wcsncmp(const wchar_t *str1, const wchar_t *str2, size_t n)
Definition: wcs.c:523
size_t CDECL _wcsxfrm_l(wchar_t *dest, const wchar_t *src, size_t len, _locale_t locale)
Definition: wcs.c:3053
int CDECL _wcsncoll(const wchar_t *str1, const wchar_t *str2, size_t count)
Definition: wcs.c:558
wchar_t *CDECL wcstok(wchar_t *str, const wchar_t *delim)
Definition: wcs.c:2070
int CDECL _vsnprintf_s(char *str, size_t sizeOfBuffer, size_t count, const char *format, va_list valist)
Definition: wcs.c:1088
int WINAPIV _snwprintf_l(wchar_t *str, size_t len, const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1511
int CDECL _vswprintf_s_l(wchar_t *str, size_t numberOfElements, const wchar_t *format, _locale_t locale, va_list args)
Definition: wcs.c:1830
int WINAPIV _sprintf_s_l(char *str, size_t count, const char *format, _locale_t locale,...)
Definition: wcs.c:1074
int WINAPIV _sprintf_p_l(char *buffer, size_t length, const char *format, _locale_t locale,...)
Definition: wcs.c:1898
int CDECL _wcslwr_s(wchar_t *str, size_t n)
Definition: wcs.c:477
static int CDECL vsnprintf_s_l_opt(char *str, size_t sizeOfBuffer, size_t count, const char *format, DWORD options, _locale_t locale, va_list valist)
Definition: wcs.c:990
double CDECL _wcstod_l(const wchar_t *str, wchar_t **end, _locale_t locale)
Definition: wcs.c:579
int CDECL _vscwprintf(const wchar_t *format, va_list args)
Definition: wcs.c:1787
static int wctoint(WCHAR c, int base)
Definition: wcs.c:2630
INT CDECL _wcsicmp_l(const wchar_t *str1, const wchar_t *str2, _locale_t locale)
Definition: wcs.c:130
int CDECL wctomb_s(int *len, char *mbchar, size_t size, wchar_t wch)
Definition: wcs.c:2144
INT CDECL _wcsupr_s(wchar_t *str, size_t n)
Definition: wcs.c:414
int CDECL _vscprintf_p_l(const char *format, _locale_t locale, va_list args)
Definition: wcs.c:1198
int CDECL vswprintf_s(wchar_t *str, size_t numberOfElements, const wchar_t *format, va_list args)
Definition: wcs.c:1821
int WINAPIV _scprintf(const char *format,...)
Definition: wcs.c:1318
int WINAPIV _swprintf_p_l(wchar_t *buffer, size_t length, const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1961
__msvcrt_ulong __cdecl wcstoul(const wchar_t *s, wchar_t **end, int base)
Definition: wcs.c:2917
size_t CDECL wcslen(const wchar_t *str)
Definition: wcs.c:2988
double CDECL _wtof_l(const wchar_t *str, _locale_t locale)
Definition: wcs.c:818
int CDECL wcscmp(const wchar_t *str1, const wchar_t *str2)
Definition: wcs.c:1977
int CDECL _vscprintf_p(const char *format, va_list argptr)
Definition: wcs.c:1228
__msvcrt_long CDECL _wcstol_l(const wchar_t *s, wchar_t **end, int base, _locale_t locale)
Definition: wcs.c:2734
int CDECL _vsnprintf_c(char *str, size_t len, const char *format, va_list valist)
Definition: wcs.c:1106
int CDECL _vsprintf_s_l(char *str, size_t count, const char *format, _locale_t locale, va_list valist)
Definition: wcs.c:1065
wchar_t *CDECL _wcsdup(const wchar_t *str)
Definition: wcs.c:86
static int vsnwprintf_s_l_opt(wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, DWORD options, _locale_t locale, va_list valist)
Definition: wcs.c:1022
unsigned __int64 CDECL _wcstoui64_l(const wchar_t *nptr, wchar_t **endptr, int base, _locale_t locale)
Definition: wcs.c:2831
int CDECL _wcscoll_l(const wchar_t *str1, const wchar_t *str2, _locale_t locale)
Definition: wcs.c:1995
wchar_t *CDECL wcsstr(const wchar_t *str, const wchar_t *sub)
Definition: wcs.c:2998
int WINAPIV _snwprintf_s(wchar_t *str, size_t len, size_t count, const wchar_t *format,...)
Definition: wcs.c:1525
INT CDECL wcscat_s(wchar_t *dst, size_t elem, const wchar_t *src)
Definition: wcs.c:2540
int WINAPIV _scprintf_l(const char *format, _locale_t locale,...)
Definition: wcs.c:1331
int WINAPIV _swprintf_c(wchar_t *str, size_t len, const wchar_t *format,...)
Definition: wcs.c:1754
int CDECL _vsnwprintf_s(wchar_t *str, size_t sizeOfBuffer, size_t count, const wchar_t *format, va_list valist)
Definition: wcs.c:1488
INT CDECL wcscpy_s(wchar_t *wcDest, size_t numElement, const wchar_t *wcSrc)
Definition: wcs.c:2444
int WINAPIV _swprintf_s_l(wchar_t *str, size_t numberOfElements, const wchar_t *format, _locale_t locale,...)
Definition: wcs.c:1722
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
#define ULONG_PTR
Definition: config.h:101
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLdouble s
Definition: gl.h:2039
GLuint GLuint end
Definition: gl.h:1545
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLdouble GLdouble t
Definition: gl.h:2047
GLdouble n
Definition: glext.h:7729
GLenum src
Definition: glext.h:6340
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
const GLubyte * c
Definition: glext.h:8905
GLfloat f
Definition: glext.h:7540
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLenum GLenum dst
Definition: glext.h:6340
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLfloat GLfloat p
Definition: glext.h:8902
GLboolean enable
Definition: glext.h:11120
GLuint GLuint num
Definition: glext.h:9618
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define WC_NO_BEST_FIT_CHARS
Definition: unicode.h:46
#define c
Definition: ke_i.h:80
#define debugstr_w
Definition: kernel32.h:32
struct S1 s1
#define error(str)
Definition: mkdosfs.c:1605
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
static PVOID ptr
Definition: dispmode.c:27
#define _vscprintf
Definition: _vscprintf.c:25
#define _vsnprintf
Definition: _vsnprintf.c:28
#define _vsnwprintf
Definition: _vsnwprintf.c:28
#define sprintf
Definition: sprintf.c:45
#define wctomb
Definition: wctomb.c:31
#define _swprintf(buf, format,...)
Definition: sprintf.c:56
static va_list valist
Definition: printf.c:46
static size_t sizeOfBuffer
Definition: printf.c:48
static const unsigned char *static size_t const wchar_t * wcSrc
Definition: string.c:76
static size_t numberOfElements
Definition: string.c:98
static size_t elem
Definition: string.c:71
static char * dest
Definition: rtl.c:149
unsigned int UINT
Definition: ndis.h:50
int __cdecl __stdio_common_vsprintf_s(unsigned __int64 const options, char *const buffer, size_t const buffer_count, char const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:292
int __cdecl __stdio_common_vsprintf(unsigned __int64 const options, char *const buffer, size_t const buffer_count, char const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:233
int __cdecl __stdio_common_vsprintf_p(unsigned __int64 const options, char *const buffer, size_t const buffer_count, char const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:421
int __cdecl __stdio_common_vswprintf(unsigned __int64 const options, wchar_t *const buffer, size_t const buffer_count, wchar_t const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:246
int __cdecl __stdio_common_vswprintf_s(unsigned __int64 const options, wchar_t *const buffer, size_t const buffer_count, wchar_t const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:305
int __cdecl __stdio_common_vswprintf_p(unsigned __int64 const options, wchar_t *const buffer, size_t const buffer_count, wchar_t const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:434
int __cdecl __stdio_common_vsnprintf_s(unsigned __int64 const options, char *const buffer, size_t const buffer_count, size_t const max_count, char const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:393
int __cdecl __stdio_common_vsnwprintf_s(unsigned __int64 const options, wchar_t *const buffer, size_t const buffer_count, size_t const max_count, wchar_t const *const format, _locale_t const locale, va_list const arglist)
Definition: output.cpp:407
short WCHAR
Definition: pedump.c:58
#define err(...)
const WCHAR * str
#define WINAPIV
Definition: sdbpapi.h:64
#define iswgraph(_c)
Definition: ctype.h:673
#define _iswdigit_l(_c, _p)
Definition: ctype.h:679
#define _iswlower_l(_c, _p)
Definition: ctype.h:678
#define iswcntrl(_c)
Definition: ctype.h:674
#define iswspace(_c)
Definition: ctype.h:669
#define _iswupper_l(_c, _p)
Definition: ctype.h:677
#define iswupper(_c)
Definition: ctype.h:665
#define _iswspace_l(_c, _p)
Definition: ctype.h:681
#define _iswgraph_l(_c, _p)
Definition: ctype.h:685
#define iswdigit(_c)
Definition: ctype.h:667
#define iswalnum(_c)
Definition: ctype.h:671
#define iswlower(_c)
Definition: ctype.h:666
#define _iswxdigit_l(_c, _p)
Definition: ctype.h:680
#define _iswprint_l(_c, _p)
Definition: ctype.h:684
#define _iswalpha_l(_c, _p)
Definition: ctype.h:676
#define iswprint(_c)
Definition: ctype.h:672
#define _iswpunct_l(_c, _p)
Definition: ctype.h:682
#define _iswcntrl_l(_c, _p)
Definition: ctype.h:686
#define iswxdigit(_c)
Definition: ctype.h:668
#define _iswalnum_l(_c, _p)
Definition: ctype.h:683
#define iswpunct(_c)
Definition: ctype.h:670
#define iswalpha(_c)
Definition: ctype.h:664
_Check_return_opt_ _CRTIMP int __cdecl _vswprintf_p(_Out_writes_z_(_MaxCount) wchar_t *_DstBuf, _In_ size_t _MaxCount, _In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
_Check_return_ _CRTIMP int __cdecl _vscwprintf_p(_In_z_ _Printf_format_string_ const wchar_t *_Format, va_list _ArgList)
_Check_return_ _CRTIMP int __cdecl _scwprintf_p(_In_z_ _Printf_format_string_ const wchar_t *_Format,...)
#define CP_UTF8
Definition: nls.h:20
#define iswblank(_c)
#define _iswblank_l(_c, _p)
_wcslwr
_wcsnset_s
wcsncat
_wcsupr_s_l
_wcsset
wcsncpy
_wcslwr_l
wcscat
_wcsupr
_wcsupr_l
wcsncpy_s
_wcsnset
wcsncat_s
_wcsset_s
wcscpy
_wcslwr_s_l
_wcstombs_l
Definition: stdlib.h:1039
_wcstombs_s_l
Definition: stdlib.h:1039
wcstombs
Definition: stdlib.h:1013
XML_HIDDEN void xmlParserErrors const char const xmlChar const xmlChar * str2
Definition: parser.h:35
XML_HIDDEN void xmlParserErrors const char const xmlChar * str1
Definition: parser.h:35
#define memset(x, y, z)
Definition: compat.h:39
#define wcrtomb(cp, wc, sp)
Definition: wchar.h:163
#define towlower(c)
Definition: wctype.h:97
#define towupper(c)
Definition: wctype.h:99
PCWSTR s2
Definition: shell32_main.h:38
SOCKET WSAAPI accept(IN SOCKET s, OUT LPSOCKADDR addr, OUT INT FAR *addrlen)
Definition: socklife.c:23
#define TRACE(s)
Definition: solgame.cpp:4
Definition: match.c:390
Definition: format.c:58
Definition: msvcrt.h:359
Definition: wcs.c:46
BOOLEAN Alternate
Definition: wcs.c:48
char Format
Definition: wcs.c:51
int FieldLength
Definition: wcs.c:50
BOOLEAN NaturalString
Definition: wcs.c:49
int64_t LONGLONG
Definition: typedefs.h:68
int32_t INT
Definition: typedefs.h:58
uint64_t ULONGLONG
Definition: typedefs.h:67
uint32_t ULONG_PTR
Definition: typedefs.h:65
size_t const wchar_t const wchar
Definition: wcrtomb.cpp:53
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
Definition: wcsftime.cpp:383
int retval
Definition: wcstombs.cpp:91
int codepage
Definition: win_iconv.c:156
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define get_locinfo()
Definition: winesup.h:25
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
#define NORM_IGNORECASE
Definition: winnls.h:191
#define SORT_STRINGSORT
Definition: winnls.h:199
#define CT_CTYPE1
Definition: winnls.h:265
#define LCMAP_UPPERCASE
Definition: winnls.h:202
#define CSTR_EQUAL
Definition: winnls.h:510
#define LCMAP_SORTKEY
Definition: winnls.h:204
#define LCMAP_LOWERCASE
Definition: winnls.h:201