#include <precomp.h>
Go to the source code of this file.
◆ _Success_()
Definition at line 11 of file wcstombs_s.c.
23{
24 size_t cchMax, cchConverted;
26
27
29 ((cjDstSize == 0) && (pmbstrDst == 0)) ))
30 {
33 }
34
35
36 if (pcchConverted)
37 {
38
39 *pcchConverted = 0;
40 }
41
43 {
46 }
47
48
49 if ((pmbstrDst == 0) && (pwszSrc == 0))
50 {
53 }
54
55
56 if (pwszSrc)
57 {
58
59 if (pmbstrDst)
60 {
61
62 cchMax = (cjMaxCount < cjDstSize) ? cjMaxCount + 1 : cjDstSize;
63
64
66
67
68 if (cchConverted ==
cchMax)
69 {
70
71 if (cchConverted == cjDstSize)
72 {
73
75 {
76
78
79
82 }
83
84
86 }
87
88
89 pmbstrDst[cchConverted - 1] =
L'\0';
90 }
91 else
92 {
93
94 cchConverted++;
95 }
96 }
97 else
98 {
99
100 cchConverted = wcsnlen(pwszSrc, cjMaxCount) + 1;
101 }
102 }
103 else
104 {
105 cchConverted = cjMaxCount + 1;
106 }
107
108
109 if (pcchConverted)
110 {
111
112 *pcchConverted = cchConverted;
113 }
114
115 return retval;
116}
size_t __cdecl wcstombs(_Out_writes_opt_z_(_MaxCount) char *_Dest, _In_z_ const wchar_t *_Source, _In_ size_t _MaxCount)
#define MSVCRT_CHECK_PMT(x)
errno_t __cdecl _set_errno(_In_ int _Value)