ReactOS 0.4.16-dev-814-g656a5dc
mbccpy_s_l.cpp File Reference
#include <corecrt_internal_mbstring.h>
#include <corecrt_internal_securecrt.h>
#include <locale.h>
Include dependency graph for mbccpy_s_l.cpp:

Go to the source code of this file.

Functions

errno_t __cdecl _mbccpy_s_l (unsigned char *_Dst, size_t _SizeInBytes, int *_PCopied, const unsigned char *_Src, _LOCALE_ARG_DECL)
 

Function Documentation

◆ _mbccpy_s_l()

errno_t __cdecl _mbccpy_s_l ( unsigned char _Dst,
size_t  _SizeInBytes,
int _PCopied,
const unsigned char _Src,
_LOCALE_ARG_DECL   
)

Definition at line 17 of file mbccpy_s_l.cpp.

18{
19 /* validation section */
20 _ASSIGN_IF_NOT_NULL(_PCopied, 0);
22 if (_Src == nullptr)
23 {
24 *_Dst = '\0';
26 }
27
29
30 /* copy */
31 if (_ISMBBLEAD(*_Src))
32 {
33 if (_Src[1] == '\0')
34 {
35 /* the source string contained a lead byte followed by the null terminator:
36 we copy only the null terminator and return EILSEQ to indicate the
37 malformed char */
38 *_Dst = '\0';
39 _ASSIGN_IF_NOT_NULL(_PCopied, 1);
41 }
42 if (_SizeInBytes < 2)
43 {
44 *_Dst = '\0';
46 }
47 *_Dst++ = *_Src++;
48 *_Dst = *_Src;
49 _ASSIGN_IF_NOT_NULL(_PCopied, 2);
50 }
51 else
52 {
53 *_Dst = *_Src;
54 _ASSIGN_IF_NOT_NULL(_PCopied, 1);
55 }
56
58}
#define _RETURN_EINVAL
#define _ASSIGN_IF_NOT_NULL(_Pointer, _Value)
#define _RETURN_BUFFER_TOO_SMALL(_String, _Size)
#define _RETURN_NO_ERROR
#define _LOCALE_UPDATE
#define _RETURN_MBCS_ERROR
#define _ISMBBLEAD(_Character)
#define _VALIDATE_STRING(_String, _Size)
_In_ size_t _SizeInBytes
Definition: time.h:146

Referenced by _mbccpy_l().