2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/crtdll/mbstring/mbsncpy.c
5 * PURPOSE: Copies a string to a maximum of n bytes or characters
6 * PROGRAMER: Boudewijn Dekker
11 #include <msvcrt/mbstring.h>
14 unsigned char *_mbsncpy(unsigned char *str1, const unsigned char *str2, size_t n)
16 unsigned char *s1 = (unsigned char *)str1;
17 unsigned char *s2 = (unsigned char *)str2;
19 unsigned short *short_s1, *short_s2;
28 if ( !_ismbblead(*s2) ) {
36 short_s1 = (unsigned short *)s1;
37 short_s2 = (unsigned short *)s2;
38 *short_s1 = *short_s2;
49 //The _mbsnbcpy function copies count bytes from src to dest. If src is shorter
50 //than dest, the string is padded with null characters. If dest is less than or
51 //equal to count it is not terminated with a null character.
54 unsigned char * _mbsnbcpy(unsigned char *str1, const unsigned char *str2, size_t n)
56 unsigned char *s1 = (unsigned char *)str1;
57 unsigned char *s2 = (unsigned char *)str2;
59 unsigned short *short_s1, *short_s2;
70 if ( !_ismbblead(*s2) ) {
78 short_s1 = (unsigned short *)s1;
79 short_s2 = (unsigned short *)s2;
80 *short_s1 = *short_s2;