ReactOS 0.4.15-dev-7934-g1dc8d80
mbsnset.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/sdk/crt/mbstring/mbsnset.c
5 * PURPOSE: Fills a string with a multibyte character
6 * PROGRAMER: Ariadne
7 * UPDATE HISTORY:
8 * 12/04/99: Created
9 */
10#include <mbstring.h>
11
12size_t _mbclen2(const unsigned int s);
13
14/*
15 * @implemented
16 */
17unsigned char * _mbsnset(unsigned char *src, unsigned int val, size_t count)
18{
19 unsigned char *char_src = (unsigned char *)src;
20 unsigned short *short_src = (unsigned short *)src;
21
22 if ( _mbclen2(val) == 1 ) {
23
24 while(count > 0) {
25 *char_src = val;
26 char_src++;
27 count--;
28 }
29 *char_src = 0;
30 }
31 else {
32 while(count > 0) {
33 *short_src = val;
34 short_src++;
35 count-=2;
36 }
37 *short_src = 0;
38 }
39
40 return src;
41}
42
43/*
44 * @implemented
45 */
46unsigned char * _mbsnbset(unsigned char *src, unsigned int val, size_t count)
47{
48 unsigned char *char_src = (unsigned char *)src;
49 unsigned short *short_src = (unsigned short *)src;
50
51 if ( _mbclen2(val) == 1 ) {
52
53 while(count > 0) {
54 *char_src = val;
55 char_src++;
56 count--;
57 }
58 *char_src = 0;
59 }
60 else {
61 while(count > 0) {
62 *short_src = val;
63 short_src++;
64 count-=2;
65 }
66 *short_src = 0;
67 }
68
69 return src;
70}
GLdouble s
Definition: gl.h:2039
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLenum src
Definition: glext.h:6340
GLuint GLfloat * val
Definition: glext.h:7180
size_t _mbclen2(const unsigned int s)
Definition: mbclen.c:23
unsigned char * _mbsnbset(unsigned char *src, unsigned int val, size_t count)
Definition: mbsnset.c:46
unsigned char * _mbsnset(unsigned char *src, unsigned int val, size_t count)
Definition: mbsnset.c:17