[crt]
[reactos.git] / reactos / lib / sdk / crt / string / strset.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/crt/strset.c
5 * PURPOSE: Implementation of _strnset and _strset
6 * PROGRAMER: Unknown
7 * UPDATE HISTORY:
8 * 25/11/05: Added license header
9 */
10
11 #if defined(__GNUC__) && !defined(__clang__)
12 #define __int64 long long
13 #elif defined(_MSC_VER)
14 #pragma warning(disable: 4164)
15 #pragma function(_strset)
16 #endif
17
18 #ifdef _WIN64
19 typedef unsigned __int64 size_t;
20 #else
21 typedef unsigned int size_t;
22 #endif
23
24 /*
25 * @implemented
26 */
27 char* _strnset(char* szToFill, int szFill, size_t sizeMaxFill)
28 {
29 char *t = szToFill;
30 int i = 0;
31 while (*szToFill != 0 && i < (int) sizeMaxFill)
32 {
33 *szToFill = szFill;
34 szToFill++;
35 i++;
36
37 }
38 return t;
39 }
40
41 /*
42 * @implemented
43 */
44 char* _strset(char* szToFill, int szFill)
45 {
46 char *t = szToFill;
47 while (*szToFill != 0)
48 {
49 *szToFill = szFill;
50 szToFill++;
51
52 }
53 return t;
54 }
55