Sync with trunk head (part 1 or 2)
[reactos.git] / include / crt / string.h
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #ifndef _INC_STRING
7 #define _INC_STRING
8
9 #include <crtdefs.h>
10
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14
15 #ifndef _NLSCMP_DEFINED
16 #define _NLSCMP_DEFINED
17 #define _NLSCMPERROR 2147483647
18 #endif
19
20 #ifndef NULL
21 #ifdef __cplusplus
22 #define NULL 0
23 #else
24 #define NULL ((void *)0)
25 #endif
26 #endif
27
28 #ifndef _CRT_MEMORY_DEFINED
29 #define _CRT_MEMORY_DEFINED
30 _CRTIMP void *__cdecl _memccpy(void *_Dst,const void *_Src,int _Val,size_t _MaxCount);
31 _CRTIMP _CONST_RETURN void *__cdecl memchr(const void *_Buf ,int _Val,size_t _MaxCount);
32 _CRTIMP int __cdecl _memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
33 _CRTIMP int __cdecl _memicmp_l(const void *_Buf1,const void *_Buf2,size_t _Size,_locale_t _Locale);
34 int __cdecl memcmp(const void *_Buf1,const void *_Buf2,size_t _Size);
35 _CRT_INSECURE_DEPRECATE_MEMORY(memcpy_s) void *__cdecl memcpy(void *_Dst,const void *_Src,size_t _Size);
36 void *__cdecl memset(void *_Dst,int _Val,size_t _Size);
37 #ifndef NO_OLDNAMES
38 _CRTIMP _CRT_NONSTDC_DEPRECATE(_memccpy) void *__cdecl memccpy(void *_Dst,const void *_Src,int _Val,size_t _Size);
39 _CRTIMP _CRT_NONSTDC_DEPRECATE(_memicmp) int __cdecl memicmp(const void *_Buf1,const void *_Buf2,size_t _Size);
40 #endif
41 #endif
42
43 char *__cdecl _strset(char *_Str,int _Val);
44 char *__cdecl strcpy(char *_Dest,const char *_Source);
45 char *__cdecl strcat(char *_Dest,const char *_Source);
46 int __cdecl strcmp(const char *_Str1,const char *_Str2);
47 size_t __cdecl strlen(const char *_Str);
48 _CRTIMP size_t __cdecl strnlen(const char *_Str,size_t _MaxCount);
49
50 _CRT_INSECURE_DEPRECATE_MEMORY(memmove_s) void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size);
51 _CRTIMP char *__cdecl _strdup(const char *_Src);
52 _CRTIMP _CONST_RETURN char *__cdecl strchr(const char *_Str,int _Val);
53 _CRTIMP int __cdecl _stricmp(const char *_Str1,const char *_Str2);
54 _CRTIMP int __cdecl _strcmpi(const char *_Str1,const char *_Str2);
55 _CRTIMP int __cdecl _stricmp_l(const char *_Str1,const char *_Str2,_locale_t _Locale);
56 _CRTIMP int __cdecl strcoll(const char *_Str1,const char *_Str2);
57 _CRTIMP int __cdecl _strcoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale);
58 _CRTIMP int __cdecl _stricoll(const char *_Str1,const char *_Str2);
59 _CRTIMP int __cdecl _stricoll_l(const char *_Str1,const char *_Str2,_locale_t _Locale);
60 _CRTIMP int __cdecl _strncoll (const char *_Str1,const char *_Str2,size_t _MaxCount);
61 _CRTIMP int __cdecl _strncoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale);
62 _CRTIMP int __cdecl _strnicoll (const char *_Str1,const char *_Str2,size_t _MaxCount);
63 _CRTIMP int __cdecl _strnicoll_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale);
64 _CRTIMP size_t __cdecl strcspn(const char *_Str,const char *_Control);
65 _CRTIMP _CRT_INSECURE_DEPRECATE(_strerror_s) char *__cdecl _strerror(const char *_ErrMsg);
66 _CRTIMP _CRT_INSECURE_DEPRECATE(strerror_s) char *__cdecl strerror(int);
67 _CRTIMP char *__cdecl _strlwr(char *_String);
68 char *strlwr_l(char *_String,_locale_t _Locale);
69 char *__cdecl strncat(char *_Dest,const char *_Source,size_t _Count);
70 int __cdecl strncmp(const char *_Str1,const char *_Str2,size_t _MaxCount);
71 _CRTIMP int __cdecl _strnicmp(const char *_Str1,const char *_Str2,size_t _MaxCount);
72 _CRTIMP int __cdecl _strnicmp_l(const char *_Str1,const char *_Str2,size_t _MaxCount,_locale_t _Locale);
73 char *strncpy(char *_Dest,const char *_Source,size_t _Count);
74 _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(_strnset_s) char *__cdecl _strnset(char *_Str,int _Val,size_t _MaxCount);
75 _CRTIMP _CONST_RETURN char *__cdecl strpbrk(const char *_Str,const char *_Control);
76 _CRTIMP _CONST_RETURN char *__cdecl strrchr(const char *_Str,int _Ch);
77 _CRTIMP char *__cdecl _strrev(char *_Str);
78 _CRTIMP size_t __cdecl strspn(const char *_Str,const char *_Control);
79 _CRTIMP _CONST_RETURN char *__cdecl strstr(const char *_Str,const char *_SubStr);
80 _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(strtok_s) char *__cdecl strtok(char *_Str,const char *_Delim);
81 _CRTIMP char *__cdecl _strupr(char *_String);
82 _CRTIMP char *_strupr_l(char *_String,_locale_t _Locale);
83 _CRTIMP size_t __cdecl strxfrm(char *_Dst,const char *_Src,size_t _MaxCount);
84 _CRTIMP size_t __cdecl _strxfrm_l(char *_Dst,const char *_Src,size_t _MaxCount,_locale_t _Locale);
85
86 #ifndef NO_OLDNAMES
87 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strdup) char *__cdecl strdup(const char *_Src);
88 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strcmpi) int __cdecl strcmpi(const char *_Str1,const char *_Str2);
89 _CRTIMP _CRT_NONSTDC_DEPRECATE(_stricmp) int __cdecl stricmp(const char *_Str1,const char *_Str2);
90 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strlwr) char *__cdecl strlwr(char *_Str);
91 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strnicmp) int __cdecl strnicmp(const char *_Str1,const char *_Str,size_t _MaxCount);
92 // __CRT_INLINE int __cdecl strncasecmp (const char *__sz1, const char *__sz2, size_t __sizeMaxCompare) { return _strnicmp (__sz1, __sz2, __sizeMaxCompare); }
93 // __CRT_INLINE int __cdecl strcasecmp (const char *__sz1, const char *__sz2) { return _stricmp (__sz1, __sz2); }
94 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strnset) char *__cdecl strnset(char *_Str,int _Val,size_t _MaxCount);
95 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strrev) char *__cdecl strrev(char *_Str);
96 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strset) char *__cdecl strset(char *_Str,int _Val);
97 _CRTIMP _CRT_NONSTDC_DEPRECATE(_strupr) char *__cdecl strupr(char *_Str);
98 #endif
99
100 #ifndef _WSTRING_DEFINED
101 #define _WSTRING_DEFINED
102
103 _CRTIMP wchar_t *__cdecl _wcsdup(const wchar_t *_Str);
104 _CRTIMP _CRT_INSECURE_DEPRECATE(wcsat_s) wchar_t *__cdecl wcscat(wchar_t *_Dest,const wchar_t *_Source);
105 #if __STDC_WANT_SECURE_LIB__
106 _CRTIMP errno_t __cdecl wcsat_s(wchar_t * Dest, size_t SizeInWords, const wchar_t * _Source);
107 #endif
108 _CRTIMP _CONST_RETURN wchar_t *__cdecl wcschr(const wchar_t *_Str,wchar_t _Ch);
109 _CRTIMP int __cdecl wcscmp(const wchar_t *_Str1,const wchar_t *_Str2);
110 _CRTIMP _CRT_INSECURE_DEPRECATE(wcscpy_s) wchar_t *__cdecl wcscpy(wchar_t *_Dest,const wchar_t *_Source);
111 #if __STDC_WANT_SECURE_LIB__
112 _CRTIMP errno_t __cdecl wcscpy_s(wchar_t * Dest, size_t SizeInWords, const wchar_t * _Source);
113 #endif
114 _CRTIMP size_t __cdecl wcscspn(const wchar_t *_Str,const wchar_t *_Control);
115 _CRTIMP wchar_t *wcsncat(wchar_t *_Dest,const wchar_t *_Source,size_t _Count);
116 _CRTIMP size_t __cdecl wcslen(const wchar_t *_Str);
117 _CRTIMP _CRT_INSECURE_DEPRECATE(wcsnlen_s) size_t __cdecl wcsnlen(const wchar_t *_Src,size_t _MaxCount);
118 #if __STDC_WANT_SECURE_LIB__
119 _CRTIMP errno_t __cdecl wcsnlen_s(wchar_t **_Src, size_t _MaxCount);
120 #endif
121 _CRTIMP int __cdecl wcsncmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
122 _CRTIMP _CRT_INSECURE_DEPRECATE(wcsncpy_s) wchar_t *wcsncpy(wchar_t *_Dest,const wchar_t *_Source,size_t _Count);
123 #if __STDC_WANT_SECURE_LIB__
124 _CRTIMP errno_t __cdecl wcsncpy_s(wchar_t *_Dest, size_t SizeInWords, const wchar_t *_Source ,size_t _Count);
125 #endif
126 _CRTIMP _CONST_RETURN wchar_t *__cdecl wcspbrk(const wchar_t *_Str,const wchar_t *_Control);
127 _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsrchr(const wchar_t *_Str,wchar_t _Ch);
128 _CRTIMP size_t __cdecl wcsspn(const wchar_t *_Str,const wchar_t *_Control);
129 _CRTIMP _CONST_RETURN wchar_t *__cdecl wcsstr(const wchar_t *_Str,const wchar_t *_SubStr);
130 _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(wcstok_s) wchar_t *__cdecl wcstok(wchar_t *_Str,const wchar_t *_Delim);
131 _CRTIMP _CRT_INSECURE_DEPRECATE(_wcserror_s) wchar_t *__cdecl _wcserror(int _ErrNum);
132 _CRTIMP _CRT_INSECURE_DEPRECATE(__wcserror_s) wchar_t *__cdecl __wcserror(const wchar_t *_Str);
133 _CRTIMP int __cdecl _wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2);
134 _CRTIMP int __cdecl _wcsicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale);
135 _CRTIMP int __cdecl _wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
136 _CRTIMP int __cdecl _wcsnicmp_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale);
137 _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(_wcsnset_s) wchar_t *__cdecl _wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount);
138 _CRTIMP wchar_t *__cdecl _wcsrev(wchar_t *_Str);
139 _CRTIMP _CRT_INSECURE_DEPRECATE_CORE(_wcsset_s) wchar_t *__cdecl _wcsset(wchar_t *_Str,wchar_t _Val);
140 _CRTIMP wchar_t *__cdecl _wcslwr(wchar_t *_String);
141 _CRTIMP wchar_t *_wcslwr_l(wchar_t *_String,_locale_t _Locale);
142 _CRTIMP wchar_t *__cdecl _wcsupr(wchar_t *_String);
143 _CRTIMP wchar_t *_wcsupr_l(wchar_t *_String,_locale_t _Locale);
144 _CRTIMP size_t __cdecl wcsxfrm(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount);
145 _CRTIMP size_t __cdecl _wcsxfrm_l(wchar_t *_Dst,const wchar_t *_Src,size_t _MaxCount,_locale_t _Locale);
146 _CRTIMP int __cdecl wcscoll(const wchar_t *_Str1,const wchar_t *_Str2);
147 _CRTIMP int __cdecl _wcscoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale);
148 _CRTIMP int __cdecl _wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2);
149 _CRTIMP int __cdecl _wcsicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,_locale_t _Locale);
150 _CRTIMP int __cdecl _wcsncoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
151 _CRTIMP int __cdecl _wcsncoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale);
152 _CRTIMP int __cdecl _wcsnicoll(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
153 _CRTIMP int __cdecl _wcsnicoll_l(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount,_locale_t _Locale);
154
155 #ifndef NO_OLDNAMES
156 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsdup) wchar_t *__cdecl wcsdup(const wchar_t *_Str);
157 #define wcswcs wcsstr
158 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsicmp) int __cdecl wcsicmp(const wchar_t *_Str1,const wchar_t *_Str2);
159 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsnicmp) int __cdecl wcsnicmp(const wchar_t *_Str1,const wchar_t *_Str2,size_t _MaxCount);
160 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsnset) wchar_t *__cdecl wcsnset(wchar_t *_Str,wchar_t _Val,size_t _MaxCount);
161 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsrev) wchar_t *__cdecl wcsrev(wchar_t *_Str);
162 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsset) wchar_t *__cdecl wcsset(wchar_t *_Str,wchar_t _Val);
163 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcslwr) wchar_t *__cdecl wcslwr(wchar_t *_Str);
164 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsupr) wchar_t *__cdecl wcsupr(wchar_t *_Str);
165 _CRTIMP _CRT_NONSTDC_DEPRECATE(_wcsicoll) int __cdecl wcsicoll(const wchar_t *_Str1,const wchar_t *_Str2);
166 #endif
167
168 #endif /* !_WSTRING_DEFINED */
169
170 #ifdef __cplusplus
171 }
172 #endif
173
174 #include <sec_api/string_s.h>
175
176 // HACK
177 #define strcasecmp _stricmp
178 #define strncasecmp _strnicmp
179 #define stricmp _stricmp
180 #define wcsicmp _wcsicmp
181
182 #endif