1 | /** @file
|
---|
2 | * IPRT / No-CRT - string.h.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2022 Oracle and/or its affiliates.
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox base platform packages, as
|
---|
9 | * available from https://www.virtualbox.org.
|
---|
10 | *
|
---|
11 | * This program is free software; you can redistribute it and/or
|
---|
12 | * modify it under the terms of the GNU General Public License
|
---|
13 | * as published by the Free Software Foundation, in version 3 of the
|
---|
14 | * License.
|
---|
15 | *
|
---|
16 | * This program is distributed in the hope that it will be useful, but
|
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
19 | * General Public License for more details.
|
---|
20 | *
|
---|
21 | * You should have received a copy of the GNU General Public License
|
---|
22 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
23 | *
|
---|
24 | * The contents of this file may alternatively be used under the terms
|
---|
25 | * of the Common Development and Distribution License Version 1.0
|
---|
26 | * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
|
---|
27 | * in the VirtualBox distribution, in which case the provisions of the
|
---|
28 | * CDDL are applicable instead of those of the GPL.
|
---|
29 | *
|
---|
30 | * You may elect to license modified versions of this file under the
|
---|
31 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
32 | *
|
---|
33 | * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
|
---|
34 | */
|
---|
35 |
|
---|
36 | #ifndef IPRT_INCLUDED_nocrt_string_h
|
---|
37 | #define IPRT_INCLUDED_nocrt_string_h
|
---|
38 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
39 | # pragma once
|
---|
40 | #endif
|
---|
41 |
|
---|
42 | #include <iprt/types.h>
|
---|
43 |
|
---|
44 | /* Dummy for now, fix when/if needed. */
|
---|
45 | typedef struct RT_NOCRT(mbstate_t)
|
---|
46 | {
|
---|
47 | unsigned long whatever;
|
---|
48 | } RT_NOCRT(mbstate_t);
|
---|
49 |
|
---|
50 |
|
---|
51 | RT_C_DECLS_BEGIN
|
---|
52 |
|
---|
53 | void *RT_NOCRT(memchr)(const void *pv, int ch, size_t cb);
|
---|
54 | int RT_NOCRT(memcmp)(const void *pv1, const void *pv2, size_t cb);
|
---|
55 | void *RT_NOCRT(memcpy)(void *pvDst, const void *pvSrc, size_t cb);
|
---|
56 | void *RT_NOCRT(mempcpy)(void *pvDst, const void *pvSrc, size_t cb);
|
---|
57 | void *RT_NOCRT(memrchr)(const void *pv, int ch, size_t cb);
|
---|
58 | void *RT_NOCRT(memmove)(void *pvDst, const void *pvSrc, size_t cb);
|
---|
59 | void *RT_NOCRT(memset)(void *pvDst, int ch, size_t cb);
|
---|
60 |
|
---|
61 | char *RT_NOCRT(strcat)(char *pszDst, const char *pszSrc);
|
---|
62 | char *RT_NOCRT(strncat)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
63 | char *RT_NOCRT(strchr)(const char *psz, int ch);
|
---|
64 | char *RT_NOCRT(strrchr)(const char *psz, int ch);
|
---|
65 | int RT_NOCRT(strcmp)(const char *psz1, const char *psz2);
|
---|
66 | int RT_NOCRT(strncmp)(const char *psz1, const char *psz2, size_t cch);
|
---|
67 | int RT_NOCRT(stricmp)(const char *psz1, const char *psz2);
|
---|
68 | int RT_NOCRT(strnicmp)(const char *psz1, const char *psz2, size_t cch);
|
---|
69 | int RT_NOCRT(strcmpcase)(const char *psz1, const char *psz2, size_t cch);
|
---|
70 | int RT_NOCRT(strcoll)(const char *psz1, const char *psz2);
|
---|
71 | char *RT_NOCRT(strcpy)(char *pszDst, const char *pszSrc);
|
---|
72 | char *RT_NOCRT(strncpy)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
73 | char *RT_NOCRT(strcat)(char *pszDst, const char *pszSrc);
|
---|
74 | char *RT_NOCRT(strncat)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
75 | size_t RT_NOCRT(strlen)(const char *psz);
|
---|
76 | size_t RT_NOCRT(strnlen)(const char *psz, size_t cch);
|
---|
77 | size_t RT_NOCRT(strspn)(const char *psz, const char *pszBreakChars);
|
---|
78 | size_t RT_NOCRT(strcspn)(const char *psz, const char *pszBreakChars);
|
---|
79 | char *RT_NOCRT(strpbrk)(const char *psz, const char *pszBreakChars);
|
---|
80 | char *RT_NOCRT(strstr)(const char *psz, const char *pszSub);
|
---|
81 | char *RT_NOCRT(strtok)(char *psz, const char *pszDelim);
|
---|
82 | char *RT_NOCRT(strtok_r)(char *psz, const char *pszDelim, char **ppszSave);
|
---|
83 | #if 0 /* C++11: */
|
---|
84 | char *RT_NOCRT(strtok_s)(char *psz, /*rsize_t*/ size_t cchMax, const char *pszDelim, char **ppszSave);
|
---|
85 | #else /* Microsoft: */
|
---|
86 | char *RT_NOCRT(strtok_s)(char *psz, const char *pszDelim, char **ppszSave);
|
---|
87 | #endif
|
---|
88 | size_t RT_NOCRT(strxfrm)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
89 |
|
---|
90 | size_t RT_NOCRT(wcslen)(const wchar_t *pwsz);
|
---|
91 | wchar_t *RT_NOCRT(wcscat)(wchar_t *pwszDst, const wchar_t *pwszSrc);
|
---|
92 | wchar_t *RT_NOCRT(wcschr)(const wchar_t *pwsz, wchar_t wc);
|
---|
93 | wchar_t *RT_NOCRT(wcscpy)(wchar_t *pwszDst, const wchar_t *pwszSrc);
|
---|
94 | int RT_NOCRT(wcsicmp)(const wchar_t *pwsz1, const wchar_t *pwsz2);
|
---|
95 | size_t RT_NOCRT(wcstombs)(char *pszDst, const wchar_t *pszSrc, size_t cbDst);
|
---|
96 |
|
---|
97 |
|
---|
98 | /* Underscored versions for MSC compatibility (mesa #defines regular to _regular
|
---|
99 | a lot, which is why we really need these prototypes). */
|
---|
100 | void *RT_NOCRT(_memchr)(const void *pv, int ch, size_t cb);
|
---|
101 | int RT_NOCRT(_memcmp)(const void *pv1, const void *pv2, size_t cb);
|
---|
102 | void *RT_NOCRT(_memcpy)(void *pvDst, const void *pvSrc, size_t cb);
|
---|
103 | void *RT_NOCRT(_mempcpy)(void *pvDst, const void *pvSrc, size_t cb);
|
---|
104 | void *RT_NOCRT(_memrchr)(const void *pv, int ch, size_t cb);
|
---|
105 | void *RT_NOCRT(_memmove)(void *pvDst, const void *pvSrc, size_t cb);
|
---|
106 | void *RT_NOCRT(_memset)(void *pvDst, int ch, size_t cb);
|
---|
107 |
|
---|
108 | char *RT_NOCRT(_strcat)(char *pszDst, const char *pszSrc);
|
---|
109 | char *RT_NOCRT(_strncat)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
110 | char *RT_NOCRT(_strchr)(const char *psz, int ch);
|
---|
111 | char *RT_NOCRT(_strrchr)(const char *psz, int ch);
|
---|
112 | int RT_NOCRT(_strcmp)(const char *psz1, const char *psz2);
|
---|
113 | int RT_NOCRT(_strncmp)(const char *psz1, const char *psz2, size_t cch);
|
---|
114 | int RT_NOCRT(_stricmp)(const char *psz1, const char *psz2);
|
---|
115 | int RT_NOCRT(_strnicmp)(const char *psz1, const char *psz2, size_t cch);
|
---|
116 | int RT_NOCRT(_strcmpcase)(const char *psz1, const char *psz2, size_t cch);
|
---|
117 | int RT_NOCRT(_strcoll)(const char *psz1, const char *psz2);
|
---|
118 | char *RT_NOCRT(_strcpy)(char *pszDst, const char *pszSrc);
|
---|
119 | char *RT_NOCRT(_strncpy)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
120 | char *RT_NOCRT(_strcat)(char *pszDst, const char *pszSrc);
|
---|
121 | char *RT_NOCRT(_strncat)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
122 | size_t RT_NOCRT(_strlen)(const char *psz);
|
---|
123 | size_t RT_NOCRT(_strnlen)(const char *psz, size_t cch);
|
---|
124 | size_t RT_NOCRT(_strspn)(const char *psz, const char *pszBreakChars);
|
---|
125 | size_t RT_NOCRT(_strcspn)(const char *psz, const char *pszBreakChars);
|
---|
126 | char *RT_NOCRT(_strpbrk)(const char *psz, const char *pszBreakChars);
|
---|
127 | char *RT_NOCRT(_strstr)(const char *psz, const char *pszSub);
|
---|
128 | char *RT_NOCRT(_strtok)(char *psz, const char *pszDelim);
|
---|
129 | char *RT_NOCRT(_strtok_r)(char *psz, const char *pszDelim, char **ppszSave);
|
---|
130 | #if 0 /* C++11: */
|
---|
131 | char *RT_NOCRT(_strtok_s)(char *psz, /*rsize_t*/ size_t cchMax, const char *pszDelim, char **ppszSave);
|
---|
132 | #else /* Microsoft: */
|
---|
133 | char *RT_NOCRT(_strtok_s)(char *psz, const char *pszDelim, char **ppszSave);
|
---|
134 | #endif
|
---|
135 | size_t RT_NOCRT(_strxfrm)(char *pszDst, const char *pszSrc, size_t cch);
|
---|
136 |
|
---|
137 | size_t RT_NOCRT(_wcslen)(const wchar_t *pwsz);
|
---|
138 | wchar_t *RT_NOCRT(_wcscat)(wchar_t *pwszDst, const wchar_t *pwszSrc);
|
---|
139 | wchar_t *RT_NOCRT(_wcschr)(const wchar_t *pwsz, wchar_t wc);
|
---|
140 | wchar_t *RT_NOCRT(_wcscpy)(wchar_t *pwszDst, const wchar_t *pwszSrc);
|
---|
141 | int RT_NOCRT(_wcsicmp)(const wchar_t *pwsz1, const wchar_t *pwsz2);
|
---|
142 | size_t RT_NOCRT(_wcstombs)(char *pszDst, const wchar_t *pszSrc, size_t cbDst);
|
---|
143 |
|
---|
144 |
|
---|
145 | #if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
|
---|
146 | # define memchr RT_NOCRT(memchr)
|
---|
147 | # define memcmp RT_NOCRT(memcmp)
|
---|
148 | # define memcpy RT_NOCRT(memcpy)
|
---|
149 | # define mempcpy RT_NOCRT(mempcpy)
|
---|
150 | # define memrchr RT_NOCRT(memrchr)
|
---|
151 | # define memmove RT_NOCRT(memmove)
|
---|
152 | # define memset RT_NOCRT(memset)
|
---|
153 |
|
---|
154 | # define strcat RT_NOCRT(strcat)
|
---|
155 | # define strncat RT_NOCRT(strncat)
|
---|
156 | # define strchr RT_NOCRT(strchr)
|
---|
157 | # define strrchr RT_NOCRT(strrchr)
|
---|
158 | # define strcmp RT_NOCRT(strcmp)
|
---|
159 | # define strncmp RT_NOCRT(strncmp)
|
---|
160 | # define stricmp RT_NOCRT(stricmp)
|
---|
161 | # define strnicmp RT_NOCRT(strnicmp)
|
---|
162 | # define strcmpcase RT_NOCRT(strcmpcase)
|
---|
163 | # define strcoll RT_NOCRT(strcoll)
|
---|
164 | # define strcpy RT_NOCRT(strcpy)
|
---|
165 | # define strncpy RT_NOCRT(strncpy)
|
---|
166 | # define strcat RT_NOCRT(strcat)
|
---|
167 | # define strncat RT_NOCRT(strncat)
|
---|
168 | # define strlen RT_NOCRT(strlen)
|
---|
169 | # define strnlen RT_NOCRT(strnlen)
|
---|
170 | # define strspn RT_NOCRT(strspn)
|
---|
171 | # define strcspn RT_NOCRT(strcspn)
|
---|
172 | # define strpbrk RT_NOCRT(strpbrk)
|
---|
173 | # define strstr RT_NOCRT(strstr)
|
---|
174 | # define strtok RT_NOCRT(strtok)
|
---|
175 | # define strtok_r RT_NOCRT(strtok_r)
|
---|
176 | # define strtok_s RT_NOCRT(strtok_s)
|
---|
177 | # define strxfrm RT_NOCRT(strxfrm)
|
---|
178 |
|
---|
179 | # define wcslen RT_NOCRT(wcslen)
|
---|
180 | # define wcscat RT_NOCRT(wcscat)
|
---|
181 | # define wcschr RT_NOCRT(wcschr)
|
---|
182 | # define wcscpy RT_NOCRT(wcscpy)
|
---|
183 | # define wcsicmp RT_NOCRT(wcsicmp)
|
---|
184 | # define wcstombs RT_NOCRT(wcstombs)
|
---|
185 |
|
---|
186 | /* Underscored: */
|
---|
187 | # define _memchr RT_NOCRT(memchr)
|
---|
188 | # define _memcmp RT_NOCRT(memcmp)
|
---|
189 | # define _memcpy RT_NOCRT(memcpy)
|
---|
190 | # define _mempcpy RT_NOCRT(mempcpy)
|
---|
191 | # define _memrchr RT_NOCRT(memrchr)
|
---|
192 | # define _memmove RT_NOCRT(memmove)
|
---|
193 | # define _memset RT_NOCRT(memset)
|
---|
194 |
|
---|
195 | # define _strcat RT_NOCRT(strcat)
|
---|
196 | # define _strncat RT_NOCRT(strncat)
|
---|
197 | # define _strchr RT_NOCRT(strchr)
|
---|
198 | # define _strrchr RT_NOCRT(strrchr)
|
---|
199 | # define _strcmp RT_NOCRT(strcmp)
|
---|
200 | # define _strncmp RT_NOCRT(strncmp)
|
---|
201 | # define _stricmp RT_NOCRT(stricmp)
|
---|
202 | # define _strnicmp RT_NOCRT(strnicmp)
|
---|
203 | # define _strcmpcase RT_NOCRT(strcmpcase)
|
---|
204 | # define _strcoll RT_NOCRT(strcoll)
|
---|
205 | # define _strcpy RT_NOCRT(strcpy)
|
---|
206 | # define _strncpy RT_NOCRT(strncpy)
|
---|
207 | # define _strcat RT_NOCRT(strcat)
|
---|
208 | # define _strncat RT_NOCRT(strncat)
|
---|
209 | # define _strlen RT_NOCRT(strlen)
|
---|
210 | # define _strnlen RT_NOCRT(strnlen)
|
---|
211 | # define _strspn RT_NOCRT(strspn)
|
---|
212 | # define _strcspn RT_NOCRT(strcspn)
|
---|
213 | # define _strpbrk RT_NOCRT(strpbrk)
|
---|
214 | # define _strstr RT_NOCRT(strstr)
|
---|
215 | # define _strtok RT_NOCRT(strtok)
|
---|
216 | # define _strtok_r RT_NOCRT(strtok_r)
|
---|
217 | # define _strtok_s RT_NOCRT(strtok_s)
|
---|
218 | # define _strxfrm RT_NOCRT(strxfrm)
|
---|
219 |
|
---|
220 | # define _wcslen RT_NOCRT(wcslen)
|
---|
221 | # define _wcscat RT_NOCRT(wcscat)
|
---|
222 | # define _wcschr RT_NOCRT(wcschr)
|
---|
223 | # define _wcscpy RT_NOCRT(wcscpy)
|
---|
224 | # define _wcsicmp RT_NOCRT(wcsicmp)
|
---|
225 | # define _wcstombs RT_NOCRT(wcstombs)
|
---|
226 | #endif
|
---|
227 |
|
---|
228 |
|
---|
229 | #ifdef IPRT_NO_CRT_FOR_3RD_PARTY
|
---|
230 | /*
|
---|
231 | * Only for external libraries and such.
|
---|
232 | */
|
---|
233 |
|
---|
234 | const char *RT_NOCRT(strerror)(int iErrNo);
|
---|
235 | char *RT_NOCRT(strdup)(const char *pszSrc);
|
---|
236 |
|
---|
237 | /* Underscored: */
|
---|
238 | const char *RT_NOCRT(_strerror)(int iErrNo);
|
---|
239 | char *RT_NOCRT(_strdup)(const char *pszSrc);
|
---|
240 |
|
---|
241 | # if !defined(RT_WITHOUT_NOCRT_WRAPPERS) && !defined(RT_WITHOUT_NOCRT_WRAPPER_ALIASES)
|
---|
242 | # define strerror RT_NOCRT(strerror)
|
---|
243 | # define strdup RT_NOCRT(strdup)
|
---|
244 |
|
---|
245 | /* Underscored: */
|
---|
246 | # define _strerror RT_NOCRT(strerror)
|
---|
247 | # define _strdup RT_NOCRT(strdup)
|
---|
248 | # endif
|
---|
249 |
|
---|
250 | #endif /* IPRT_NO_CRT_FOR_3RD_PARTY */
|
---|
251 |
|
---|
252 | RT_C_DECLS_END
|
---|
253 |
|
---|
254 | #endif /* !IPRT_INCLUDED_nocrt_string_h */
|
---|