ReactOS 0.4.15-dev-7693-gd0e2924
mbsncat.c File Reference
#include <precomp.h>
#include <mbstring.h>
#include <string.h>
Include dependency graph for mbsncat.c:

Go to the source code of this file.

Functions

size_t _mbclen2 (const unsigned int s)
 
unsigned char_mbset (unsigned char *string, int c)
 
unsigned char_mbsncat (unsigned char *dst, const unsigned char *src, size_t n)
 
unsigned char_mbsnbcat (unsigned char *dst, const unsigned char *src, size_t n)
 

Function Documentation

◆ _mbclen2()

size_t _mbclen2 ( const unsigned int  s)

Definition at line 23 of file mbclen.c.

24{
25 return (_ismbblead(s>>8) && _ismbbtrail(s&0x00FF)) ? 2 : 1;
26}
GLdouble s
Definition: gl.h:2039
_Check_return_ _CRTIMP int __cdecl _ismbbtrail(_In_ unsigned int _C)
int __cdecl _ismbblead(unsigned int)
Definition: ismblead.c:20

Referenced by _mbsnbcat().

◆ _mbset()

unsigned char * _mbset ( unsigned char string,
int  c 
)

Definition at line 31 of file mbsupr.c.

32{
33 unsigned char *save = string;
34
35 if (_MBIS16 (c)) {
36
37 if (_MBLMASK (c) == 0) {
38 *string++ = '\0';
39 *string++ = '\0';
40 }
41 else {
42 *string++ = _MBGETH (c);
43 *string++ = _MBGETL (c);
44 }
45
46 }
47 else {
48
49 *string++ = c;
50
51 }
52
53 return save;
54}
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80
#define _MBLMASK(c)
Definition: mbstring.h:20
#define _MBGETH(c)
Definition: mbstring.h:23
#define _MBGETL(c)
Definition: mbstring.h:22
#define _MBIS16(c)
Definition: mbstring.h:25
char string[160]
Definition: util.h:11

Referenced by _mbsncat(), and _mbsupr().

◆ _mbsnbcat()

unsigned char * _mbsnbcat ( unsigned char dst,
const unsigned char src,
size_t  n 
)

Definition at line 47 of file mbsncat.c.

48{
49 unsigned char *d;
50 const unsigned char *s = src;
51 if (n != 0) {
52 d = dst + _mbslen(dst); // get the end of string
53 d += _mbclen2(*d); // move 1 or 2 up
54
55 do {
56 if ((*d++ = *s++) == 0)
57 {
58 while (--n != 0)
59 *d++ = 0;
60 break;
61 }
62 if ( !(n==1 && _ismbblead(*s)) )
63 n--;
64 } while (n > 0);
65 }
66 return dst;
67}
GLdouble n
Definition: glext.h:7729
GLenum src
Definition: glext.h:6340
GLenum GLenum dst
Definition: glext.h:6340
_Check_return_ _CRTIMP size_t __cdecl _mbslen(_In_z_ const unsigned char *_Str)
#define d
Definition: ke_i.h:81
size_t _mbclen2(const unsigned int s)
Definition: mbclen.c:23

◆ _mbsncat()

unsigned char * _mbsncat ( unsigned char dst,
const unsigned char src,
size_t  n 
)

Definition at line 21 of file mbsncat.c.

22{
23 int c;
24 unsigned char *save = dst;
25
26 while ((c = _mbsnextc (dst)))
27 dst = _mbsinc (dst);
28
29 while (n-- > 0 && (c = _mbsnextc (src))) {
30
31 _mbset (dst, c);
32
33 dst = _mbsinc (dst);
34
35 src = _mbsinc ((unsigned char *) src);
36
37 }
38
39 *dst = '\0';
40
41 return save;
42}
_Check_return_ _CRTIMP unsigned int __cdecl _mbsnextc(_In_z_ const unsigned char *_Str)
_Check_return_ _CRTIMP unsigned char *__cdecl _mbsinc(_In_z_ const unsigned char *_Ptr)
unsigned char * _mbset(unsigned char *string, int c)
Definition: mbsupr.c:31