diff options
author | Tobias Markmann <tm@ayena.de> | 2015-09-24 18:59:52 (GMT) |
---|---|---|
committer | Swift Review <review@swift.im> | 2015-10-30 14:13:39 (GMT) |
commit | 3d62970e1b929cf676202fc6cebc1cf426c14ff2 (patch) | |
tree | a68c82c3829a001c6f8cadbb2d68d91c98f617bf | |
parent | 3cc7e86420e4b3d67c5882d8d68e1e6a003c6154 (diff) | |
download | swift-3d62970e1b929cf676202fc6cebc1cf426c14ff2.zip swift-3d62970e1b929cf676202fc6cebc1cf426c14ff2.tar.bz2 |
Update libIDN in 3rdParty to version 1.32
Updated existing libIDN files in 3rdParty folder to latest
1.32 version and added remaining dependencies for compilation.
Updated SConscript file accordingly.
Test-Information:
Build and ran test=unit on OS X 10.10.
Change-Id: Iec6506e1cc88fe2983b2019aca95a42580d1c80e
24 files changed, 3849 insertions, 568 deletions
diff --git a/3rdParty/LibIDN/SConscript b/3rdParty/LibIDN/SConscript index 3711ad8..cfe189b 100644 --- a/3rdParty/LibIDN/SConscript +++ b/3rdParty/LibIDN/SConscript | |||
@@ -8,11 +8,11 @@ if env.get("LIBIDN_BUNDLED", False) : | |||
8 | # Module flags | 8 | # Module flags |
9 | ################################################################################ | 9 | ################################################################################ |
10 | 10 | ||
11 | if env["SCONS_STAGE"] == "flags" : | 11 | if env["SCONS_STAGE"] == "flags" : |
12 | env["LIBIDN_FLAGS"] = { | 12 | env["LIBIDN_FLAGS"] = { |
13 | "CPPDEFINES": ["IDNA_STATIC"], | 13 | "CPPDEFINES": ["LIBIDN_STATIC"], |
14 | } | 14 | } |
15 | if os.path.basename(env["CC"]) in ("clang", "gcc") : | 15 | if os.path.basename(env["CC"]) in ("clang", "gcc") : |
16 | env["LIBIDN_FLAGS"].update({"CPPFLAGS": ["-isystem" "3rdParty/LibIDN/src"]}) | 16 | env["LIBIDN_FLAGS"].update({"CPPFLAGS": ["-isystem" "3rdParty/LibIDN/src"]}) |
17 | else : | 17 | else : |
18 | env["LIBIDN_FLAGS"].update({"CPPPATH": [Dir("src")]}) | 18 | env["LIBIDN_FLAGS"].update({"CPPPATH": [Dir("src")]}) |
@@ -46,12 +46,12 @@ if env.get("LIBIDN_BUNDLED", False) : | |||
46 | else : | 46 | else : |
47 | print "Error: Cannot find strncasecmp() or strnicmp()" | 47 | print "Error: Cannot find strncasecmp() or strnicmp()" |
48 | Exit(1) | 48 | Exit(1) |
49 | conf.Finish() | 49 | conf.Finish() |
50 | 50 | ||
51 | myenv.Append(CPPDEFINES = "IDNA_STATIC") | 51 | myenv.Append(CPPDEFINES = ["LIBIDN_STATIC", "HAVE_CONFIG_H"]) |
52 | myenv.Append(CPPPATH = ["src", "stubs"]) | 52 | myenv.Append(CPPPATH = ["src", "stubs", "src/gl"]) |
53 | if myenv["PLATFORM"] == "win32" : | 53 | if myenv["PLATFORM"] == "win32" : |
54 | myenv.Append(CPPPATH = "stubs/win32") | 54 | myenv.Append(CPPPATH = "stubs/win32") |
55 | if myenv["MSVC_VERSION"][:3] == "9.0" : | 55 | if myenv["MSVC_VERSION"][:3] == "9.0" : |
56 | myenv.Append(CPPPATH = "stubs/win32/VC2008") | 56 | myenv.Append(CPPPATH = "stubs/win32/VC2008") |
57 | 57 | ||
@@ -60,7 +60,11 @@ if env.get("LIBIDN_BUNDLED", False) : | |||
60 | "src/profiles.c", | 60 | "src/profiles.c", |
61 | "src/rfc3454.c", | 61 | "src/rfc3454.c", |
62 | "src/punycode.c", | 62 | "src/punycode.c", |
63 | "src/idna.c", | 63 | "src/idna.c", |
64 | "src/toutf8.c", | 64 | "src/toutf8.c", |
65 | "src/nfkc.c" | 65 | "src/nfkc.c", |
66 | "src/gl/c-ctype.c", | ||
67 | "src/gl/c-strcasecmp.c", | ||
68 | "src/gl/c-strncasecmp.c", | ||
69 | "src/gl/unistr/u8-check.c" | ||
66 | ]) | 70 | ]) |
diff --git a/3rdParty/LibIDN/src/config.h b/3rdParty/LibIDN/src/config.h new file mode 100644 index 0000000..7a38073 --- /dev/null +++ b/3rdParty/LibIDN/src/config.h | |||
@@ -0,0 +1,1296 @@ | |||
1 | /* config.h.in. Generated from configure.ac by autoheader. */ | ||
2 | |||
3 | /* Define to the number of bits in type 'ptrdiff_t'. */ | ||
4 | #undef BITSIZEOF_PTRDIFF_T | ||
5 | |||
6 | /* Define to the number of bits in type 'sig_atomic_t'. */ | ||
7 | #undef BITSIZEOF_SIG_ATOMIC_T | ||
8 | |||
9 | /* Define to the number of bits in type 'size_t'. */ | ||
10 | #undef BITSIZEOF_SIZE_T | ||
11 | |||
12 | /* Define to the number of bits in type 'wchar_t'. */ | ||
13 | #undef BITSIZEOF_WCHAR_T | ||
14 | |||
15 | /* Define to the number of bits in type 'wint_t'. */ | ||
16 | #undef BITSIZEOF_WINT_T | ||
17 | |||
18 | /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP | ||
19 | systems. This function is required for `alloca.c' support on those systems. | ||
20 | */ | ||
21 | #undef CRAY_STACKSEG_END | ||
22 | |||
23 | /* Define if mono is the preferred C# implementation. */ | ||
24 | #undef CSHARP_CHOICE_MONO | ||
25 | |||
26 | /* Define if pnet is the preferred C# implementation. */ | ||
27 | #undef CSHARP_CHOICE_PNET | ||
28 | |||
29 | /* Define to 1 if using `alloca.c'. */ | ||
30 | #undef C_ALLOCA | ||
31 | |||
32 | /* Define to 1 if translation of program messages to the user's native | ||
33 | language is requested. */ | ||
34 | #undef ENABLE_NLS | ||
35 | |||
36 | /* Define if gettimeofday clobbers the localtime buffer. */ | ||
37 | #undef GETTIMEOFDAY_CLOBBERS_LOCALTIME | ||
38 | |||
39 | /* Define this to 'void' or 'struct timezone' to match the system's | ||
40 | declaration of the second argument to gettimeofday. */ | ||
41 | #undef GETTIMEOFDAY_TIMEZONE | ||
42 | |||
43 | /* Define to a C preprocessor expression that evaluates to 1 or 0, depending | ||
44 | whether the gnulib module fscanf shall be considered present. */ | ||
45 | #undef GNULIB_FSCANF | ||
46 | |||
47 | /* Define to a C preprocessor expression that evaluates to 1 or 0, depending | ||
48 | whether the gnulib module lock shall be considered present. */ | ||
49 | #undef GNULIB_LOCK | ||
50 | |||
51 | /* Define to 1 if printf and friends should be labeled with attribute | ||
52 | "__gnu_printf__" instead of "__printf__" */ | ||
53 | #undef GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU | ||
54 | |||
55 | /* Define to a C preprocessor expression that evaluates to 1 or 0, depending | ||
56 | whether the gnulib module scanf shall be considered present. */ | ||
57 | #undef GNULIB_SCANF | ||
58 | |||
59 | /* Define to a C preprocessor expression that evaluates to 1 or 0, depending | ||
60 | whether the gnulib module strerror shall be considered present. */ | ||
61 | #undef GNULIB_STRERROR | ||
62 | |||
63 | /* Define to 1 when the gnulib module close should be tested. */ | ||
64 | #undef GNULIB_TEST_CLOSE | ||
65 | |||
66 | /* Define to 1 when the gnulib module dup2 should be tested. */ | ||
67 | #undef GNULIB_TEST_DUP2 | ||
68 | |||
69 | /* Define to 1 when the gnulib module environ should be tested. */ | ||
70 | #undef GNULIB_TEST_ENVIRON | ||
71 | |||
72 | /* Define to 1 when the gnulib module fdopen should be tested. */ | ||
73 | #undef GNULIB_TEST_FDOPEN | ||
74 | |||
75 | /* Define to 1 when the gnulib module fstat should be tested. */ | ||
76 | #undef GNULIB_TEST_FSTAT | ||
77 | |||
78 | /* Define to 1 when the gnulib module getcwd should be tested. */ | ||
79 | #undef GNULIB_TEST_GETCWD | ||
80 | |||
81 | /* Define to 1 when the gnulib module getdtablesize should be tested. */ | ||
82 | #undef GNULIB_TEST_GETDTABLESIZE | ||
83 | |||
84 | /* Define to 1 when the gnulib module getopt-gnu should be tested. */ | ||
85 | #undef GNULIB_TEST_GETOPT_GNU | ||
86 | |||
87 | /* Define to 1 when the gnulib module gettimeofday should be tested. */ | ||
88 | #undef GNULIB_TEST_GETTIMEOFDAY | ||
89 | |||
90 | /* Define to 1 when the gnulib module lstat should be tested. */ | ||
91 | #undef GNULIB_TEST_LSTAT | ||
92 | |||
93 | /* Define to 1 when the gnulib module malloc-posix should be tested. */ | ||
94 | #undef GNULIB_TEST_MALLOC_POSIX | ||
95 | |||
96 | /* Define to 1 when the gnulib module open should be tested. */ | ||
97 | #undef GNULIB_TEST_OPEN | ||
98 | |||
99 | /* Define to 1 when the gnulib module putenv should be tested. */ | ||
100 | #undef GNULIB_TEST_PUTENV | ||
101 | |||
102 | /* Define to 1 when the gnulib module setenv should be tested. */ | ||
103 | #undef GNULIB_TEST_SETENV | ||
104 | |||
105 | /* Define to 1 when the gnulib module setlocale should be tested. */ | ||
106 | #undef GNULIB_TEST_SETLOCALE | ||
107 | |||
108 | /* Define to 1 when the gnulib module stat should be tested. */ | ||
109 | #undef GNULIB_TEST_STAT | ||
110 | |||
111 | /* Define to 1 when the gnulib module strerror should be tested. */ | ||
112 | #undef GNULIB_TEST_STRERROR | ||
113 | |||
114 | /* Define to 1 when the gnulib module strverscmp should be tested. */ | ||
115 | #undef GNULIB_TEST_STRVERSCMP | ||
116 | |||
117 | /* Define to 1 when the gnulib module symlink should be tested. */ | ||
118 | #undef GNULIB_TEST_SYMLINK | ||
119 | |||
120 | /* Define to 1 when the gnulib module unsetenv should be tested. */ | ||
121 | #undef GNULIB_TEST_UNSETENV | ||
122 | |||
123 | /* Define to a C preprocessor expression that evaluates to 1 or 0, depending | ||
124 | whether the gnulib module unistr/u8-mbtoucr shall be considered present. */ | ||
125 | #undef GNULIB_UNISTR_U8_MBTOUCR | ||
126 | |||
127 | /* Define to a C preprocessor expression that evaluates to 1 or 0, depending | ||
128 | whether the gnulib module unistr/u8-uctomb shall be considered present. */ | ||
129 | #undef GNULIB_UNISTR_U8_UCTOMB | ||
130 | |||
131 | /* Define to 1 if you have 'alloca' after including <alloca.h>, a header that | ||
132 | may be supplied by this distribution. */ | ||
133 | #undef HAVE_ALLOCA | ||
134 | |||
135 | /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). | ||
136 | */ | ||
137 | #undef HAVE_ALLOCA_H | ||
138 | |||
139 | /* Define to 1 if you have the Mac OS X function CFLocaleCopyCurrent in the | ||
140 | CoreFoundation framework. */ | ||
141 | #undef HAVE_CFLOCALECOPYCURRENT | ||
142 | |||
143 | /* Define to 1 if you have the Mac OS X function CFPreferencesCopyAppValue in | ||
144 | the CoreFoundation framework. */ | ||
145 | #undef HAVE_CFPREFERENCESCOPYAPPVALUE | ||
146 | |||
147 | /* Define if the GNU dcgettext() function is already present or preinstalled. | ||
148 | */ | ||
149 | #undef HAVE_DCGETTEXT | ||
150 | |||
151 | /* Define to 1 if you have the declaration of `getdtablesize', and to 0 if you | ||
152 | don't. */ | ||
153 | #undef HAVE_DECL_GETDTABLESIZE | ||
154 | |||
155 | /* Define to 1 if you have the declaration of `getenv', and to 0 if you don't. | ||
156 | */ | ||
157 | #undef HAVE_DECL_GETENV | ||
158 | |||
159 | /* Define to 1 if you have the declaration of `program_invocation_name', and | ||
160 | to 0 if you don't. */ | ||
161 | #undef HAVE_DECL_PROGRAM_INVOCATION_NAME | ||
162 | |||
163 | /* Define to 1 if you have the declaration of `program_invocation_short_name', | ||
164 | and to 0 if you don't. */ | ||
165 | #undef HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME | ||
166 | |||
167 | /* Define to 1 if you have the declaration of `setenv', and to 0 if you don't. | ||
168 | */ | ||
169 | #undef HAVE_DECL_SETENV | ||
170 | |||
171 | /* Define to 1 if you have the declaration of `strerror_r', and to 0 if you | ||
172 | don't. */ | ||
173 | #undef HAVE_DECL_STRERROR_R | ||
174 | |||
175 | /* Define to 1 if you have the declaration of `unsetenv', and to 0 if you | ||
176 | don't. */ | ||
177 | #undef HAVE_DECL_UNSETENV | ||
178 | |||
179 | /* Define to 1 if you have the declaration of `_putenv', and to 0 if you | ||
180 | don't. */ | ||
181 | #undef HAVE_DECL__PUTENV | ||
182 | |||
183 | /* Define to 1 if you have the <dlfcn.h> header file. */ | ||
184 | #undef HAVE_DLFCN_H | ||
185 | |||
186 | /* Define to 1 if you have the 'dup2' function. */ | ||
187 | #undef HAVE_DUP2 | ||
188 | |||
189 | /* Define if you have the declaration of environ. */ | ||
190 | #undef HAVE_ENVIRON_DECL | ||
191 | |||
192 | /* Define to 1 if you have the <features.h> header file. */ | ||
193 | #undef HAVE_FEATURES_H | ||
194 | |||
195 | /* Define to 1 if you have the `getdtablesize' function. */ | ||
196 | #undef HAVE_GETDTABLESIZE | ||
197 | |||
198 | /* Define to 1 if you have the `getlocalename_l' function. */ | ||
199 | #undef HAVE_GETLOCALENAME_L | ||
200 | |||
201 | /* Define to 1 if you have the <getopt.h> header file. */ | ||
202 | #undef HAVE_GETOPT_H | ||
203 | |||
204 | /* Define to 1 if you have the `getopt_long_only' function. */ | ||
205 | #undef HAVE_GETOPT_LONG_ONLY | ||
206 | |||
207 | /* Define if the GNU gettext() function is already present or preinstalled. */ | ||
208 | #undef HAVE_GETTEXT | ||
209 | |||
210 | /* Define to 1 if you have the `gettimeofday' function. */ | ||
211 | #undef HAVE_GETTIMEOFDAY | ||
212 | |||
213 | /* Define if you have the iconv() function and it works. */ | ||
214 | #undef HAVE_ICONV | ||
215 | |||
216 | /* Define to 1 if you have the <iconv.h> header file. */ | ||
217 | #undef HAVE_ICONV_H | ||
218 | |||
219 | /* Define to 1 if the compiler supports one of the keywords 'inline', | ||
220 | '__inline__', '__inline' and effectively inlines functions marked as such. | ||
221 | */ | ||
222 | #undef HAVE_INLINE | ||
223 | |||
224 | /* Define to 1 if you have the <inttypes.h> header file. */ | ||
225 | #undef HAVE_INTTYPES_H | ||
226 | |||
227 | /* Define if you have <langinfo.h> and nl_langinfo(CODESET). */ | ||
228 | #undef HAVE_LANGINFO_CODESET | ||
229 | |||
230 | /* Define to 1 if you have the <langinfo.h> header file. */ | ||
231 | #undef HAVE_LANGINFO_H | ||
232 | |||
233 | /* Define if your <locale.h> file defines LC_MESSAGES. */ | ||
234 | #undef HAVE_LC_MESSAGES | ||
235 | |||
236 | /* Define to 1 if the system has the type 'long long int'. */ | ||
237 | #undef HAVE_LONG_LONG_INT | ||
238 | |||
239 | /* Define to 1 if you have the `lstat' function. */ | ||
240 | #undef HAVE_LSTAT | ||
241 | |||
242 | /* Define if the 'malloc' function is POSIX compliant. */ | ||
243 | #undef HAVE_MALLOC_POSIX | ||
244 | |||
245 | /* Define to 1 if you have the <memory.h> header file. */ | ||
246 | #undef HAVE_MEMORY_H | ||
247 | |||
248 | /* Define to 1 on MSVC platforms that have the "invalid parameter handler" | ||
249 | concept. */ | ||
250 | #undef HAVE_MSVC_INVALID_PARAMETER_HANDLER | ||
251 | |||
252 | /* Define to 1 if you have the `newlocale' function. */ | ||
253 | #undef HAVE_NEWLOCALE | ||
254 | |||
255 | /* Define to 1 if you have the `pthread_atfork' function. */ | ||
256 | #undef HAVE_PTHREAD_ATFORK | ||
257 | |||
258 | /* Define if the <pthread.h> defines PTHREAD_MUTEX_RECURSIVE. */ | ||
259 | #undef HAVE_PTHREAD_MUTEX_RECURSIVE | ||
260 | |||
261 | /* Define if the POSIX multithreading library has read/write locks. */ | ||
262 | #undef HAVE_PTHREAD_RWLOCK | ||
263 | |||
264 | /* Define to 1 if atoll is declared even after undefining macros. */ | ||
265 | #undef HAVE_RAW_DECL_ATOLL | ||
266 | |||
267 | /* Define to 1 if btowc is declared even after undefining macros. */ | ||
268 | #undef HAVE_RAW_DECL_BTOWC | ||
269 | |||
270 | /* Define to 1 if canonicalize_file_name is declared even after undefining | ||
271 | macros. */ | ||
272 | #undef HAVE_RAW_DECL_CANONICALIZE_FILE_NAME | ||
273 | |||
274 | /* Define to 1 if chdir is declared even after undefining macros. */ | ||
275 | #undef HAVE_RAW_DECL_CHDIR | ||
276 | |||
277 | /* Define to 1 if chown is declared even after undefining macros. */ | ||
278 | #undef HAVE_RAW_DECL_CHOWN | ||
279 | |||
280 | /* Define to 1 if dprintf is declared even after undefining macros. */ | ||
281 | #undef HAVE_RAW_DECL_DPRINTF | ||
282 | |||
283 | /* Define to 1 if dup is declared even after undefining macros. */ | ||
284 | #undef HAVE_RAW_DECL_DUP | ||
285 | |||
286 | /* Define to 1 if dup2 is declared even after undefining macros. */ | ||
287 | #undef HAVE_RAW_DECL_DUP2 | ||
288 | |||
289 | /* Define to 1 if dup3 is declared even after undefining macros. */ | ||
290 | #undef HAVE_RAW_DECL_DUP3 | ||
291 | |||
292 | /* Define to 1 if duplocale is declared even after undefining macros. */ | ||
293 | #undef HAVE_RAW_DECL_DUPLOCALE | ||
294 | |||
295 | /* Define to 1 if endusershell is declared even after undefining macros. */ | ||
296 | #undef HAVE_RAW_DECL_ENDUSERSHELL | ||
297 | |||
298 | /* Define to 1 if environ is declared even after undefining macros. */ | ||
299 | #undef HAVE_RAW_DECL_ENVIRON | ||
300 | |||
301 | /* Define to 1 if euidaccess is declared even after undefining macros. */ | ||
302 | #undef HAVE_RAW_DECL_EUIDACCESS | ||
303 | |||
304 | /* Define to 1 if faccessat is declared even after undefining macros. */ | ||
305 | #undef HAVE_RAW_DECL_FACCESSAT | ||
306 | |||
307 | /* Define to 1 if fchdir is declared even after undefining macros. */ | ||
308 | #undef HAVE_RAW_DECL_FCHDIR | ||
309 | |||
310 | /* Define to 1 if fchmodat is declared even after undefining macros. */ | ||
311 | #undef HAVE_RAW_DECL_FCHMODAT | ||
312 | |||
313 | /* Define to 1 if fchownat is declared even after undefining macros. */ | ||
314 | #undef HAVE_RAW_DECL_FCHOWNAT | ||
315 | |||
316 | /* Define to 1 if fcntl is declared even after undefining macros. */ | ||
317 | #undef HAVE_RAW_DECL_FCNTL | ||
318 | |||
319 | /* Define to 1 if fdatasync is declared even after undefining macros. */ | ||
320 | #undef HAVE_RAW_DECL_FDATASYNC | ||
321 | |||
322 | /* Define to 1 if ffsl is declared even after undefining macros. */ | ||
323 | #undef HAVE_RAW_DECL_FFSL | ||
324 | |||
325 | /* Define to 1 if ffsll is declared even after undefining macros. */ | ||
326 | #undef HAVE_RAW_DECL_FFSLL | ||
327 | |||
328 | /* Define to 1 if fpurge is declared even after undefining macros. */ | ||
329 | #undef HAVE_RAW_DECL_FPURGE | ||
330 | |||
331 | /* Define to 1 if fseeko is declared even after undefining macros. */ | ||
332 | #undef HAVE_RAW_DECL_FSEEKO | ||
333 | |||
334 | /* Define to 1 if fstat is declared even after undefining macros. */ | ||
335 | #undef HAVE_RAW_DECL_FSTAT | ||
336 | |||
337 | /* Define to 1 if fstatat is declared even after undefining macros. */ | ||
338 | #undef HAVE_RAW_DECL_FSTATAT | ||
339 | |||
340 | /* Define to 1 if fsync is declared even after undefining macros. */ | ||
341 | #undef HAVE_RAW_DECL_FSYNC | ||
342 | |||
343 | /* Define to 1 if ftello is declared even after undefining macros. */ | ||
344 | #undef HAVE_RAW_DECL_FTELLO | ||
345 | |||
346 | /* Define to 1 if ftruncate is declared even after undefining macros. */ | ||
347 | #undef HAVE_RAW_DECL_FTRUNCATE | ||
348 | |||
349 | /* Define to 1 if futimens is declared even after undefining macros. */ | ||
350 | #undef HAVE_RAW_DECL_FUTIMENS | ||
351 | |||
352 | /* Define to 1 if getcwd is declared even after undefining macros. */ | ||
353 | #undef HAVE_RAW_DECL_GETCWD | ||
354 | |||
355 | /* Define to 1 if getdelim is declared even after undefining macros. */ | ||
356 | #undef HAVE_RAW_DECL_GETDELIM | ||
357 | |||
358 | /* Define to 1 if getdomainname is declared even after undefining macros. */ | ||
359 | #undef HAVE_RAW_DECL_GETDOMAINNAME | ||
360 | |||
361 | /* Define to 1 if getdtablesize is declared even after undefining macros. */ | ||
362 | #undef HAVE_RAW_DECL_GETDTABLESIZE | ||
363 | |||
364 | /* Define to 1 if getgroups is declared even after undefining macros. */ | ||
365 | #undef HAVE_RAW_DECL_GETGROUPS | ||
366 | |||
367 | /* Define to 1 if gethostname is declared even after undefining macros. */ | ||
368 | #undef HAVE_RAW_DECL_GETHOSTNAME | ||
369 | |||
370 | /* Define to 1 if getline is declared even after undefining macros. */ | ||
371 | #undef HAVE_RAW_DECL_GETLINE | ||
372 | |||
373 | /* Define to 1 if getloadavg is declared even after undefining macros. */ | ||
374 | #undef HAVE_RAW_DECL_GETLOADAVG | ||
375 | |||
376 | /* Define to 1 if getlogin is declared even after undefining macros. */ | ||
377 | #undef HAVE_RAW_DECL_GETLOGIN | ||
378 | |||
379 | /* Define to 1 if getlogin_r is declared even after undefining macros. */ | ||
380 | #undef HAVE_RAW_DECL_GETLOGIN_R | ||
381 | |||
382 | /* Define to 1 if getpagesize is declared even after undefining macros. */ | ||
383 | #undef HAVE_RAW_DECL_GETPAGESIZE | ||
384 | |||
385 | /* Define to 1 if gets is declared even after undefining macros. */ | ||
386 | #undef HAVE_RAW_DECL_GETS | ||
387 | |||
388 | /* Define to 1 if getsubopt is declared even after undefining macros. */ | ||
389 | #undef HAVE_RAW_DECL_GETSUBOPT | ||
390 | |||
391 | /* Define to 1 if gettimeofday is declared even after undefining macros. */ | ||
392 | #undef HAVE_RAW_DECL_GETTIMEOFDAY | ||
393 | |||
394 | /* Define to 1 if getusershell is declared even after undefining macros. */ | ||
395 | #undef HAVE_RAW_DECL_GETUSERSHELL | ||
396 | |||
397 | /* Define to 1 if grantpt is declared even after undefining macros. */ | ||
398 | #undef HAVE_RAW_DECL_GRANTPT | ||
399 | |||
400 | /* Define to 1 if group_member is declared even after undefining macros. */ | ||
401 | #undef HAVE_RAW_DECL_GROUP_MEMBER | ||
402 | |||
403 | /* Define to 1 if imaxabs is declared even after undefining macros. */ | ||
404 | #undef HAVE_RAW_DECL_IMAXABS | ||
405 | |||
406 | /* Define to 1 if imaxdiv is declared even after undefining macros. */ | ||
407 | #undef HAVE_RAW_DECL_IMAXDIV | ||
408 | |||
409 | /* Define to 1 if initstate is declared even after undefining macros. */ | ||
410 | #undef HAVE_RAW_DECL_INITSTATE | ||
411 | |||
412 | /* Define to 1 if initstate_r is declared even after undefining macros. */ | ||
413 | #undef HAVE_RAW_DECL_INITSTATE_R | ||
414 | |||
415 | /* Define to 1 if isatty is declared even after undefining macros. */ | ||
416 | #undef HAVE_RAW_DECL_ISATTY | ||
417 | |||
418 | /* Define to 1 if lchmod is declared even after undefining macros. */ | ||
419 | #undef HAVE_RAW_DECL_LCHMOD | ||
420 | |||
421 | /* Define to 1 if lchown is declared even after undefining macros. */ | ||
422 | #undef HAVE_RAW_DECL_LCHOWN | ||
423 | |||
424 | /* Define to 1 if link is declared even after undefining macros. */ | ||
425 | #undef HAVE_RAW_DECL_LINK | ||
426 | |||
427 | /* Define to 1 if linkat is declared even after undefining macros. */ | ||
428 | #undef HAVE_RAW_DECL_LINKAT | ||
429 | |||
430 | /* Define to 1 if lseek is declared even after undefining macros. */ | ||
431 | #undef HAVE_RAW_DECL_LSEEK | ||
432 | |||
433 | /* Define to 1 if lstat is declared even after undefining macros. */ | ||
434 | #undef HAVE_RAW_DECL_LSTAT | ||
435 | |||
436 | /* Define to 1 if mbrlen is declared even after undefining macros. */ | ||
437 | #undef HAVE_RAW_DECL_MBRLEN | ||
438 | |||
439 | /* Define to 1 if mbrtowc is declared even after undefining macros. */ | ||
440 | #undef HAVE_RAW_DECL_MBRTOWC | ||
441 | |||
442 | /* Define to 1 if mbsinit is declared even after undefining macros. */ | ||
443 | #undef HAVE_RAW_DECL_MBSINIT | ||
444 | |||
445 | /* Define to 1 if mbsnrtowcs is declared even after undefining macros. */ | ||
446 | #undef HAVE_RAW_DECL_MBSNRTOWCS | ||
447 | |||
448 | /* Define to 1 if mbsrtowcs is declared even after undefining macros. */ | ||
449 | #undef HAVE_RAW_DECL_MBSRTOWCS | ||
450 | |||
451 | /* Define to 1 if memmem is declared even after undefining macros. */ | ||
452 | #undef HAVE_RAW_DECL_MEMMEM | ||
453 | |||
454 | /* Define to 1 if mempcpy is declared even after undefining macros. */ | ||
455 | #undef HAVE_RAW_DECL_MEMPCPY | ||
456 | |||
457 | /* Define to 1 if memrchr is declared even after undefining macros. */ | ||
458 | #undef HAVE_RAW_DECL_MEMRCHR | ||
459 | |||
460 | /* Define to 1 if mkdirat is declared even after undefining macros. */ | ||
461 | #undef HAVE_RAW_DECL_MKDIRAT | ||
462 | |||
463 | /* Define to 1 if mkdtemp is declared even after undefining macros. */ | ||
464 | #undef HAVE_RAW_DECL_MKDTEMP | ||
465 | |||
466 | /* Define to 1 if mkfifo is declared even after undefining macros. */ | ||
467 | #undef HAVE_RAW_DECL_MKFIFO | ||
468 | |||
469 | /* Define to 1 if mkfifoat is declared even after undefining macros. */ | ||
470 | #undef HAVE_RAW_DECL_MKFIFOAT | ||
471 | |||
472 | /* Define to 1 if mknod is declared even after undefining macros. */ | ||
473 | #undef HAVE_RAW_DECL_MKNOD | ||
474 | |||
475 | /* Define to 1 if mknodat is declared even after undefining macros. */ | ||
476 | #undef HAVE_RAW_DECL_MKNODAT | ||
477 | |||
478 | /* Define to 1 if mkostemp is declared even after undefining macros. */ | ||
479 | #undef HAVE_RAW_DECL_MKOSTEMP | ||
480 | |||
481 | /* Define to 1 if mkostemps is declared even after undefining macros. */ | ||
482 | #undef HAVE_RAW_DECL_MKOSTEMPS | ||
483 | |||
484 | /* Define to 1 if mkstemp is declared even after undefining macros. */ | ||
485 | #undef HAVE_RAW_DECL_MKSTEMP | ||
486 | |||
487 | /* Define to 1 if mkstemps is declared even after undefining macros. */ | ||
488 | #undef HAVE_RAW_DECL_MKSTEMPS | ||
489 | |||
490 | /* Define to 1 if nl_langinfo is declared even after undefining macros. */ | ||
491 | #undef HAVE_RAW_DECL_NL_LANGINFO | ||
492 | |||
493 | /* Define to 1 if openat is declared even after undefining macros. */ | ||
494 | #undef HAVE_RAW_DECL_OPENAT | ||
495 | |||
496 | /* Define to 1 if pclose is declared even after undefining macros. */ | ||
497 | #undef HAVE_RAW_DECL_PCLOSE | ||
498 | |||
499 | /* Define to 1 if pipe is declared even after undefining macros. */ | ||
500 | #undef HAVE_RAW_DECL_PIPE | ||
501 | |||
502 | /* Define to 1 if pipe2 is declared even after undefining macros. */ | ||
503 | #undef HAVE_RAW_DECL_PIPE2 | ||
504 | |||
505 | /* Define to 1 if popen is declared even after undefining macros. */ | ||
506 | #undef HAVE_RAW_DECL_POPEN | ||
507 | |||
508 | /* Define to 1 if posix_openpt is declared even after undefining macros. */ | ||
509 | #undef HAVE_RAW_DECL_POSIX_OPENPT | ||
510 | |||
511 | /* Define to 1 if pread is declared even after undefining macros. */ | ||
512 | #undef HAVE_RAW_DECL_PREAD | ||
513 | |||
514 | /* Define to 1 if ptsname is declared even after undefining macros. */ | ||
515 | #undef HAVE_RAW_DECL_PTSNAME | ||
516 | |||
517 | /* Define to 1 if ptsname_r is declared even after undefining macros. */ | ||
518 | #undef HAVE_RAW_DECL_PTSNAME_R | ||
519 | |||
520 | /* Define to 1 if pwrite is declared even after undefining macros. */ | ||
521 | #undef HAVE_RAW_DECL_PWRITE | ||
522 | |||
523 | /* Define to 1 if random is declared even after undefining macros. */ | ||
524 | #undef HAVE_RAW_DECL_RANDOM | ||
525 | |||
526 | /* Define to 1 if random_r is declared even after undefining macros. */ | ||
527 | #undef HAVE_RAW_DECL_RANDOM_R | ||
528 | |||
529 | /* Define to 1 if rawmemchr is declared even after undefining macros. */ | ||
530 | #undef HAVE_RAW_DECL_RAWMEMCHR | ||
531 | |||
532 | /* Define to 1 if readlink is declared even after undefining macros. */ | ||
533 | #undef HAVE_RAW_DECL_READLINK | ||
534 | |||
535 | /* Define to 1 if readlinkat is declared even after undefining macros. */ | ||
536 | #undef HAVE_RAW_DECL_READLINKAT | ||
537 | |||
538 | /* Define to 1 if realpath is declared even after undefining macros. */ | ||
539 | #undef HAVE_RAW_DECL_REALPATH | ||
540 | |||
541 | /* Define to 1 if renameat is declared even after undefining macros. */ | ||
542 | #undef HAVE_RAW_DECL_RENAMEAT | ||
543 | |||
544 | /* Define to 1 if rmdir is declared even after undefining macros. */ | ||
545 | #undef HAVE_RAW_DECL_RMDIR | ||
546 | |||
547 | /* Define to 1 if rpmatch is declared even after undefining macros. */ | ||
548 | #undef HAVE_RAW_DECL_RPMATCH | ||
549 | |||
550 | /* Define to 1 if secure_getenv is declared even after undefining macros. */ | ||
551 | #undef HAVE_RAW_DECL_SECURE_GETENV | ||
552 | |||
553 | /* Define to 1 if setenv is declared even after undefining macros. */ | ||
554 | #undef HAVE_RAW_DECL_SETENV | ||
555 | |||
556 | /* Define to 1 if sethostname is declared even after undefining macros. */ | ||
557 | #undef HAVE_RAW_DECL_SETHOSTNAME | ||
558 | |||
559 | /* Define to 1 if setlocale is declared even after undefining macros. */ | ||
560 | #undef HAVE_RAW_DECL_SETLOCALE | ||
561 | |||
562 | /* Define to 1 if setstate is declared even after undefining macros. */ | ||
563 | #undef HAVE_RAW_DECL_SETSTATE | ||
564 | |||
565 | /* Define to 1 if setstate_r is declared even after undefining macros. */ | ||
566 | #undef HAVE_RAW_DECL_SETSTATE_R | ||
567 | |||
568 | /* Define to 1 if setusershell is declared even after undefining macros. */ | ||
569 | #undef HAVE_RAW_DECL_SETUSERSHELL | ||
570 | |||
571 | /* Define to 1 if sleep is declared even after undefining macros. */ | ||
572 | #undef HAVE_RAW_DECL_SLEEP | ||
573 | |||
574 | /* Define to 1 if snprintf is declared even after undefining macros. */ | ||
575 | #undef HAVE_RAW_DECL_SNPRINTF | ||
576 | |||
577 | /* Define to 1 if srandom is declared even after undefining macros. */ | ||
578 | #undef HAVE_RAW_DECL_SRANDOM | ||
579 | |||
580 | /* Define to 1 if srandom_r is declared even after undefining macros. */ | ||
581 | #undef HAVE_RAW_DECL_SRANDOM_R | ||
582 | |||
583 | /* Define to 1 if stat is declared even after undefining macros. */ | ||
584 | #undef HAVE_RAW_DECL_STAT | ||
585 | |||
586 | /* Define to 1 if stpcpy is declared even after undefining macros. */ | ||
587 | #undef HAVE_RAW_DECL_STPCPY | ||
588 | |||
589 | /* Define to 1 if stpncpy is declared even after undefining macros. */ | ||
590 | #undef HAVE_RAW_DECL_STPNCPY | ||
591 | |||
592 | /* Define to 1 if strcasestr is declared even after undefining macros. */ | ||
593 | #undef HAVE_RAW_DECL_STRCASESTR | ||
594 | |||
595 | /* Define to 1 if strchrnul is declared even after undefining macros. */ | ||
596 | #undef HAVE_RAW_DECL_STRCHRNUL | ||
597 | |||
598 | /* Define to 1 if strdup is declared even after undefining macros. */ | ||
599 | #undef HAVE_RAW_DECL_STRDUP | ||
600 | |||
601 | /* Define to 1 if strerror_r is declared even after undefining macros. */ | ||
602 | #undef HAVE_RAW_DECL_STRERROR_R | ||
603 | |||
604 | /* Define to 1 if strncat is declared even after undefining macros. */ | ||
605 | #undef HAVE_RAW_DECL_STRNCAT | ||
606 | |||
607 | /* Define to 1 if strndup is declared even after undefining macros. */ | ||
608 | #undef HAVE_RAW_DECL_STRNDUP | ||
609 | |||
610 | /* Define to 1 if strnlen is declared even after undefining macros. */ | ||
611 | #undef HAVE_RAW_DECL_STRNLEN | ||
612 | |||
613 | /* Define to 1 if strpbrk is declared even after undefining macros. */ | ||
614 | #undef HAVE_RAW_DECL_STRPBRK | ||
615 | |||
616 | /* Define to 1 if strsep is declared even after undefining macros. */ | ||
617 | #undef HAVE_RAW_DECL_STRSEP | ||
618 | |||
619 | /* Define to 1 if strsignal is declared even after undefining macros. */ | ||
620 | #undef HAVE_RAW_DECL_STRSIGNAL | ||
621 | |||
622 | /* Define to 1 if strtod is declared even after undefining macros. */ | ||
623 | #undef HAVE_RAW_DECL_STRTOD | ||
624 | |||
625 | /* Define to 1 if strtoimax is declared even after undefining macros. */ | ||
626 | #undef HAVE_RAW_DECL_STRTOIMAX | ||
627 | |||
628 | /* Define to 1 if strtok_r is declared even after undefining macros. */ | ||
629 | #undef HAVE_RAW_DECL_STRTOK_R | ||
630 | |||
631 | /* Define to 1 if strtoll is declared even after undefining macros. */ | ||
632 | #undef HAVE_RAW_DECL_STRTOLL | ||
633 | |||
634 | /* Define to 1 if strtoull is declared even after undefining macros. */ | ||
635 | #undef HAVE_RAW_DECL_STRTOULL | ||
636 | |||
637 | /* Define to 1 if strtoumax is declared even after undefining macros. */ | ||
638 | #undef HAVE_RAW_DECL_STRTOUMAX | ||
639 | |||
640 | /* Define to 1 if strverscmp is declared even after undefining macros. */ | ||
641 | #undef HAVE_RAW_DECL_STRVERSCMP | ||
642 | |||
643 | /* Define to 1 if symlink is declared even after undefining macros. */ | ||
644 | #undef HAVE_RAW_DECL_SYMLINK | ||
645 | |||
646 | /* Define to 1 if symlinkat is declared even after undefining macros. */ | ||
647 | #undef HAVE_RAW_DECL_SYMLINKAT | ||
648 | |||
649 | /* Define to 1 if tmpfile is declared even after undefining macros. */ | ||
650 | #undef HAVE_RAW_DECL_TMPFILE | ||
651 | |||
652 | /* Define to 1 if ttyname_r is declared even after undefining macros. */ | ||
653 | #undef HAVE_RAW_DECL_TTYNAME_R | ||
654 | |||
655 | /* Define to 1 if unlink is declared even after undefining macros. */ | ||
656 | #undef HAVE_RAW_DECL_UNLINK | ||
657 | |||
658 | /* Define to 1 if unlinkat is declared even after undefining macros. */ | ||
659 | #undef HAVE_RAW_DECL_UNLINKAT | ||
660 | |||
661 | /* Define to 1 if unlockpt is declared even after undefining macros. */ | ||
662 | #undef HAVE_RAW_DECL_UNLOCKPT | ||
663 | |||
664 | /* Define to 1 if unsetenv is declared even after undefining macros. */ | ||
665 | #undef HAVE_RAW_DECL_UNSETENV | ||
666 | |||
667 | /* Define to 1 if usleep is declared even after undefining macros. */ | ||
668 | #undef HAVE_RAW_DECL_USLEEP | ||
669 | |||
670 | /* Define to 1 if utimensat is declared even after undefining macros. */ | ||
671 | #undef HAVE_RAW_DECL_UTIMENSAT | ||
672 | |||
673 | /* Define to 1 if vdprintf is declared even after undefining macros. */ | ||
674 | #undef HAVE_RAW_DECL_VDPRINTF | ||
675 | |||
676 | /* Define to 1 if vsnprintf is declared even after undefining macros. */ | ||
677 | #undef HAVE_RAW_DECL_VSNPRINTF | ||
678 | |||
679 | /* Define to 1 if wcpcpy is declared even after undefining macros. */ | ||
680 | #undef HAVE_RAW_DECL_WCPCPY | ||
681 | |||
682 | /* Define to 1 if wcpncpy is declared even after undefining macros. */ | ||
683 | #undef HAVE_RAW_DECL_WCPNCPY | ||
684 | |||
685 | /* Define to 1 if wcrtomb is declared even after undefining macros. */ | ||
686 | #undef HAVE_RAW_DECL_WCRTOMB | ||
687 | |||
688 | /* Define to 1 if wcscasecmp is declared even after undefining macros. */ | ||
689 | #undef HAVE_RAW_DECL_WCSCASECMP | ||
690 | |||
691 | /* Define to 1 if wcscat is declared even after undefining macros. */ | ||
692 | #undef HAVE_RAW_DECL_WCSCAT | ||
693 | |||
694 | /* Define to 1 if wcschr is declared even after undefining macros. */ | ||
695 | #undef HAVE_RAW_DECL_WCSCHR | ||
696 | |||
697 | /* Define to 1 if wcscmp is declared even after undefining macros. */ | ||
698 | #undef HAVE_RAW_DECL_WCSCMP | ||
699 | |||
700 | /* Define to 1 if wcscoll is declared even after undefining macros. */ | ||
701 | #undef HAVE_RAW_DECL_WCSCOLL | ||
702 | |||
703 | /* Define to 1 if wcscpy is declared even after undefining macros. */ | ||
704 | #undef HAVE_RAW_DECL_WCSCPY | ||
705 | |||
706 | /* Define to 1 if wcscspn is declared even after undefining macros. */ | ||
707 | #undef HAVE_RAW_DECL_WCSCSPN | ||
708 | |||
709 | /* Define to 1 if wcsdup is declared even after undefining macros. */ | ||
710 | #undef HAVE_RAW_DECL_WCSDUP | ||
711 | |||
712 | /* Define to 1 if wcslen is declared even after undefining macros. */ | ||
713 | #undef HAVE_RAW_DECL_WCSLEN | ||
714 | |||
715 | /* Define to 1 if wcsncasecmp is declared even after undefining macros. */ | ||
716 | #undef HAVE_RAW_DECL_WCSNCASECMP | ||
717 | |||
718 | /* Define to 1 if wcsncat is declared even after undefining macros. */ | ||
719 | #undef HAVE_RAW_DECL_WCSNCAT | ||
720 | |||
721 | /* Define to 1 if wcsncmp is declared even after undefining macros. */ | ||
722 | #undef HAVE_RAW_DECL_WCSNCMP | ||
723 | |||
724 | /* Define to 1 if wcsncpy is declared even after undefining macros. */ | ||
725 | #undef HAVE_RAW_DECL_WCSNCPY | ||
726 | |||
727 | /* Define to 1 if wcsnlen is declared even after undefining macros. */ | ||
728 | #undef HAVE_RAW_DECL_WCSNLEN | ||
729 | |||
730 | /* Define to 1 if wcsnrtombs is declared even after undefining macros. */ | ||
731 | #undef HAVE_RAW_DECL_WCSNRTOMBS | ||
732 | |||
733 | /* Define to 1 if wcspbrk is declared even after undefining macros. */ | ||
734 | #undef HAVE_RAW_DECL_WCSPBRK | ||
735 | |||
736 | /* Define to 1 if wcsrchr is declared even after undefining macros. */ | ||
737 | #undef HAVE_RAW_DECL_WCSRCHR | ||
738 | |||
739 | /* Define to 1 if wcsrtombs is declared even after undefining macros. */ | ||
740 | #undef HAVE_RAW_DECL_WCSRTOMBS | ||
741 | |||
742 | /* Define to 1 if wcsspn is declared even after undefining macros. */ | ||
743 | #undef HAVE_RAW_DECL_WCSSPN | ||
744 | |||
745 | /* Define to 1 if wcsstr is declared even after undefining macros. */ | ||
746 | #undef HAVE_RAW_DECL_WCSSTR | ||
747 | |||
748 | /* Define to 1 if wcstok is declared even after undefining macros. */ | ||
749 | #undef HAVE_RAW_DECL_WCSTOK | ||
750 | |||
751 | /* Define to 1 if wcswidth is declared even after undefining macros. */ | ||
752 | #undef HAVE_RAW_DECL_WCSWIDTH | ||
753 | |||
754 | /* Define to 1 if wcsxfrm is declared even after undefining macros. */ | ||
755 | #undef HAVE_RAW_DECL_WCSXFRM | ||
756 | |||
757 | /* Define to 1 if wctob is declared even after undefining macros. */ | ||
758 | #undef HAVE_RAW_DECL_WCTOB | ||
759 | |||
760 | /* Define to 1 if wcwidth is declared even after undefining macros. */ | ||
761 | #undef HAVE_RAW_DECL_WCWIDTH | ||
762 | |||
763 | /* Define to 1 if wmemchr is declared even after undefining macros. */ | ||
764 | #undef HAVE_RAW_DECL_WMEMCHR | ||
765 | |||
766 | /* Define to 1 if wmemcmp is declared even after undefining macros. */ | ||
767 | #undef HAVE_RAW_DECL_WMEMCMP | ||
768 | |||
769 | /* Define to 1 if wmemcpy is declared even after undefining macros. */ | ||
770 | #undef HAVE_RAW_DECL_WMEMCPY | ||
771 | |||
772 | /* Define to 1 if wmemmove is declared even after undefining macros. */ | ||
773 | #undef HAVE_RAW_DECL_WMEMMOVE | ||
774 | |||
775 | /* Define to 1 if wmemset is declared even after undefining macros. */ | ||
776 | #undef HAVE_RAW_DECL_WMEMSET | ||
777 | |||
778 | /* Define to 1 if _Exit is declared even after undefining macros. */ | ||
779 | #undef HAVE_RAW_DECL__EXIT | ||
780 | |||
781 | /* Define to 1 if you have the <search.h> header file. */ | ||
782 | #undef HAVE_SEARCH_H | ||
783 | |||
784 | /* Define to 1 if you have the `setdtablesize' function. */ | ||
785 | #undef HAVE_SETDTABLESIZE | ||
786 | |||
787 | /* Define to 1 if you have the `setenv' function. */ | ||
788 | #undef HAVE_SETENV | ||
789 | |||
790 | /* Define to 1 if you have the `setlocale' function. */ | ||
791 | #undef HAVE_SETLOCALE | ||
792 | |||
793 | /* Define to 1 if 'sig_atomic_t' is a signed integer type. */ | ||
794 | #undef HAVE_SIGNED_SIG_ATOMIC_T | ||
795 | |||
796 | /* Define to 1 if 'wchar_t' is a signed integer type. */ | ||
797 | #undef HAVE_SIGNED_WCHAR_T | ||
798 | |||
799 | /* Define to 1 if 'wint_t' is a signed integer type. */ | ||
800 | #undef HAVE_SIGNED_WINT_T | ||
801 | |||
802 | /* Define to 1 if you have the <stdint.h> header file. */ | ||
803 | #undef HAVE_STDINT_H | ||
804 | |||
805 | /* Define to 1 if you have the <stdlib.h> header file. */ | ||
806 | #undef HAVE_STDLIB_H | ||
807 | |||
808 | /* Define to 1 if you have the `strerror_r' function. */ | ||
809 | #undef HAVE_STRERROR_R | ||
810 | |||
811 | /* Define to 1 if you have the <strings.h> header file. */ | ||
812 | #undef HAVE_STRINGS_H | ||
813 | |||
814 | /* Define to 1 if you have the <string.h> header file. */ | ||
815 | #undef HAVE_STRING_H | ||
816 | |||
817 | /* Define to 1 if you have the `strverscmp' function. */ | ||
818 | #undef HAVE_STRVERSCMP | ||
819 | |||
820 | /* Define to 1 if you have the `symlink' function. */ | ||
821 | #undef HAVE_SYMLINK | ||
822 | |||
823 | /* Define to 1 if you have the <sys/bitypes.h> header file. */ | ||
824 | #undef HAVE_SYS_BITYPES_H | ||
825 | |||
826 | /* Define to 1 if you have the <sys/inttypes.h> header file. */ | ||
827 | #undef HAVE_SYS_INTTYPES_H | ||
828 | |||
829 | /* Define to 1 if you have the <sys/param.h> header file. */ | ||
830 | #undef HAVE_SYS_PARAM_H | ||
831 | |||
832 | /* Define to 1 if you have the <sys/socket.h> header file. */ | ||
833 | #undef HAVE_SYS_SOCKET_H | ||
834 | |||
835 | /* Define to 1 if you have the <sys/stat.h> header file. */ | ||
836 | #undef HAVE_SYS_STAT_H | ||
837 | |||
838 | /* Define to 1 if you have the <sys/timeb.h> header file. */ | ||
839 | #undef HAVE_SYS_TIMEB_H | ||
840 | |||
841 | /* Define to 1 if you have the <sys/time.h> header file. */ | ||
842 | #undef HAVE_SYS_TIME_H | ||
843 | |||
844 | /* Define to 1 if you have the <sys/types.h> header file. */ | ||
845 | #undef HAVE_SYS_TYPES_H | ||
846 | |||
847 | /* Define to 1 if you have the `tsearch' function. */ | ||
848 | #undef HAVE_TSEARCH | ||
849 | |||
850 | /* Define to 1 if you have the <unistd.h> header file. */ | ||
851 | #undef HAVE_UNISTD_H | ||
852 | |||
853 | /* Define to 1 if you have the `unsetenv' function. */ | ||
854 | #undef HAVE_UNSETENV | ||
855 | |||
856 | /* Define to 1 if the system has the type 'unsigned long long int'. */ | ||
857 | #undef HAVE_UNSIGNED_LONG_LONG_INT | ||
858 | |||
859 | /* Define to 1 if you have the `uselocale' function. */ | ||
860 | #undef HAVE_USELOCALE | ||
861 | |||
862 | /* Define to 1 or 0, depending whether the compiler supports simple visibility | ||
863 | declarations. */ | ||
864 | #undef HAVE_VISIBILITY | ||
865 | |||
866 | /* Define to 1 if you have the <wchar.h> header file. */ | ||
867 | #undef HAVE_WCHAR_H | ||
868 | |||
869 | /* Define if you have the 'wchar_t' type. */ | ||
870 | #undef HAVE_WCHAR_T | ||
871 | |||
872 | /* Define to 1 if you have the <winsock2.h> header file. */ | ||
873 | #undef HAVE_WINSOCK2_H | ||
874 | |||
875 | /* Define if you have the 'wint_t' type. */ | ||
876 | #undef HAVE_WINT_T | ||
877 | |||
878 | /* Define to 1 if O_NOATIME works. */ | ||
879 | #undef HAVE_WORKING_O_NOATIME | ||
880 | |||
881 | /* Define to 1 if O_NOFOLLOW works. */ | ||
882 | #undef HAVE_WORKING_O_NOFOLLOW | ||
883 | |||
884 | /* Define to 1 if you have the <xlocale.h> header file. */ | ||
885 | #undef HAVE_XLOCALE_H | ||
886 | |||
887 | /* Define to 1 if the system has the type `_Bool'. */ | ||
888 | #undef HAVE__BOOL | ||
889 | |||
890 | /* Define to 1 if you have the `_ftime' function. */ | ||
891 | #undef HAVE__FTIME | ||
892 | |||
893 | /* Define to 1 if you have the `_set_invalid_parameter_handler' function. */ | ||
894 | #undef HAVE__SET_INVALID_PARAMETER_HANDLER | ||
895 | |||
896 | /* Define as const if the declaration of iconv() needs const. */ | ||
897 | #undef ICONV_CONST | ||
898 | |||
899 | /* Define to a symbolic name denoting the flavor of iconv_open() | ||
900 | implementation. */ | ||
901 | #undef ICONV_FLAVOR | ||
902 | |||
903 | /* Define to 1 if 'lstat' dereferences a symlink specified with a trailing | ||
904 | slash. */ | ||
905 | #undef LSTAT_FOLLOWS_SLASHED_SYMLINK | ||
906 | |||
907 | /* Define to the sub-directory in which libtool stores uninstalled libraries. | ||
908 | */ | ||
909 | #undef LT_OBJDIR | ||
910 | |||
911 | /* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ | ||
912 | #undef MALLOC_0_IS_NONNULL | ||
913 | |||
914 | /* Define to 1 if open() fails to recognize a trailing slash. */ | ||
915 | #undef OPEN_TRAILING_SLASH_BUG | ||
916 | |||
917 | /* Name of package */ | ||
918 | #undef PACKAGE | ||
919 | |||
920 | /* Define to the address where bug reports for this package should be sent. */ | ||
921 | #undef PACKAGE_BUGREPORT | ||
922 | |||
923 | /* Define to the full name of this package. */ | ||
924 | #undef PACKAGE_NAME | ||
925 | |||
926 | /* String identifying the packager of this software */ | ||
927 | #undef PACKAGE_PACKAGER | ||
928 | |||
929 | /* Packager info for bug reports (URL/e-mail/...) */ | ||
930 | #undef PACKAGE_PACKAGER_BUG_REPORTS | ||
931 | |||
932 | /* Packager-specific version information */ | ||
933 | #undef PACKAGE_PACKAGER_VERSION | ||
934 | |||
935 | /* Define to the full name and version of this package. */ | ||
936 | #undef PACKAGE_STRING | ||
937 | |||
938 | /* Define to the one symbol short name of this package. */ | ||
939 | #undef PACKAGE_TARNAME | ||
940 | |||
941 | /* Define to the home page for this package. */ | ||
942 | #undef PACKAGE_URL | ||
943 | |||
944 | /* Define to the version of this package. */ | ||
945 | #undef PACKAGE_VERSION | ||
946 | |||
947 | /* Define if <inttypes.h> exists and defines unusable PRI* macros. */ | ||
948 | #undef PRI_MACROS_BROKEN | ||
949 | |||
950 | /* Define to the type that is the result of default argument promotions of | ||
951 | type mode_t. */ | ||
952 | #undef PROMOTED_MODE_T | ||
953 | |||
954 | /* Define if the pthread_in_use() detection is hard. */ | ||
955 | #undef PTHREAD_IN_USE_DETECTION_HARD | ||
956 | |||
957 | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | ||
958 | 'ptrdiff_t'. */ | ||
959 | #undef PTRDIFF_T_SUFFIX | ||
960 | |||
961 | /* Define to 1 if stat needs help when passed a directory name with a trailing | ||
962 | slash */ | ||
963 | #undef REPLACE_FUNC_STAT_DIR | ||
964 | |||
965 | /* Define to 1 if stat needs help when passed a file name with a trailing | ||
966 | slash */ | ||
967 | #undef REPLACE_FUNC_STAT_FILE | ||
968 | |||
969 | /* Define to 1 if strerror(0) does not return a message implying success. */ | ||
970 | #undef REPLACE_STRERROR_0 | ||
971 | |||
972 | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | ||
973 | 'sig_atomic_t'. */ | ||
974 | #undef SIG_ATOMIC_T_SUFFIX | ||
975 | |||
976 | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | ||
977 | 'size_t'. */ | ||
978 | #undef SIZE_T_SUFFIX | ||
979 | |||
980 | /* If using the C implementation of alloca, define if you know the | ||
981 | direction of stack growth for your system; otherwise it will be | ||
982 | automatically deduced at runtime. | ||
983 | STACK_DIRECTION > 0 => grows toward higher addresses | ||
984 | STACK_DIRECTION < 0 => grows toward lower addresses | ||
985 | STACK_DIRECTION = 0 => direction of growth unknown */ | ||
986 | #undef STACK_DIRECTION | ||
987 | |||
988 | /* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */ | ||
989 | #undef STAT_MACROS_BROKEN | ||
990 | |||
991 | /* Define to 1 if you have the ANSI C header files. */ | ||
992 | #undef STDC_HEADERS | ||
993 | |||
994 | /* Define to 1 if strerror_r returns char *. */ | ||
995 | #undef STRERROR_R_CHAR_P | ||
996 | |||
997 | /* Define if the POSIX multithreading library can be used. */ | ||
998 | #undef USE_POSIX_THREADS | ||
999 | |||
1000 | /* Define if references to the POSIX multithreading library should be made | ||
1001 | weak. */ | ||
1002 | #undef USE_POSIX_THREADS_WEAK | ||
1003 | |||
1004 | /* Define if the GNU Pth multithreading library can be used. */ | ||
1005 | #undef USE_PTH_THREADS | ||
1006 | |||
1007 | /* Define if references to the GNU Pth multithreading library should be made | ||
1008 | weak. */ | ||
1009 | #undef USE_PTH_THREADS_WEAK | ||
1010 | |||
1011 | /* Define if the old Solaris multithreading library can be used. */ | ||
1012 | #undef USE_SOLARIS_THREADS | ||
1013 | |||
1014 | /* Define if references to the old Solaris multithreading library should be | ||
1015 | made weak. */ | ||
1016 | #undef USE_SOLARIS_THREADS_WEAK | ||
1017 | |||
1018 | /* Enable extensions on AIX 3, Interix. */ | ||
1019 | #ifndef _ALL_SOURCE | ||
1020 | # undef _ALL_SOURCE | ||
1021 | #endif | ||
1022 | /* Enable general extensions on OS X. */ | ||
1023 | #ifndef _DARWIN_C_SOURCE | ||
1024 | # undef _DARWIN_C_SOURCE | ||
1025 | #endif | ||
1026 | /* Enable GNU extensions on systems that have them. */ | ||
1027 | #ifndef _GNU_SOURCE | ||
1028 | # undef _GNU_SOURCE | ||
1029 | #endif | ||
1030 | /* Use GNU style printf and scanf. */ | ||
1031 | #ifndef __USE_MINGW_ANSI_STDIO | ||
1032 | # undef __USE_MINGW_ANSI_STDIO | ||
1033 | #endif | ||
1034 | /* Enable threading extensions on Solaris. */ | ||
1035 | #ifndef _POSIX_PTHREAD_SEMANTICS | ||
1036 | # undef _POSIX_PTHREAD_SEMANTICS | ||
1037 | #endif | ||
1038 | /* Enable extensions on HP NonStop. */ | ||
1039 | #ifndef _TANDEM_SOURCE | ||
1040 | # undef _TANDEM_SOURCE | ||
1041 | #endif | ||
1042 | /* Enable X/Open extensions if necessary. HP-UX 11.11 defines | ||
1043 | mbstate_t only if _XOPEN_SOURCE is defined to 500, regardless of | ||
1044 | whether compiling with -Ae or -D_HPUX_SOURCE=1. */ | ||
1045 | #ifndef _XOPEN_SOURCE | ||
1046 | # undef _XOPEN_SOURCE | ||
1047 | #endif | ||
1048 | /* Enable general extensions on Solaris. */ | ||
1049 | #ifndef __EXTENSIONS__ | ||
1050 | # undef __EXTENSIONS__ | ||
1051 | #endif | ||
1052 | |||
1053 | |||
1054 | /* Define if the native Windows multithreading API can be used. */ | ||
1055 | #undef USE_WINDOWS_THREADS | ||
1056 | |||
1057 | /* Version number of package */ | ||
1058 | #undef VERSION | ||
1059 | |||
1060 | /* Define to 1 if unsetenv returns void instead of int. */ | ||
1061 | #undef VOID_UNSETENV | ||
1062 | |||
1063 | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | ||
1064 | 'wchar_t'. */ | ||
1065 | #undef WCHAR_T_SUFFIX | ||
1066 | |||
1067 | /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type | ||
1068 | 'wint_t'. */ | ||
1069 | #undef WINT_T_SUFFIX | ||
1070 | |||
1071 | /* Define to 1 if you want TLD code. */ | ||
1072 | #undef WITH_TLD | ||
1073 | |||
1074 | /* Enable large inode numbers on Mac OS X 10.5. */ | ||
1075 | #undef _DARWIN_USE_64_BIT_INODE | ||
1076 | |||
1077 | /* Number of bits in a file offset, on hosts where this is settable. */ | ||
1078 | #undef _FILE_OFFSET_BITS | ||
1079 | |||
1080 | /* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct | ||
1081 | stat.st_size becomes 64-bit. */ | ||
1082 | #undef _GL_WINDOWS_64_BIT_ST_SIZE | ||
1083 | |||
1084 | /* Define for large files, on AIX-style hosts. */ | ||
1085 | #undef _LARGE_FILES | ||
1086 | |||
1087 | /* Define to 1 on Solaris. */ | ||
1088 | #undef _LCONV_C99 | ||
1089 | |||
1090 | /* Define to 1 if on MINIX. */ | ||
1091 | #undef _MINIX | ||
1092 | |||
1093 | /* Define to 1 to make NetBSD features available. MINIX 3 needs this. */ | ||
1094 | #undef _NETBSD_SOURCE | ||
1095 | |||
1096 | /* The _Noreturn keyword of C11. */ | ||
1097 | #if ! (defined _Noreturn \ | ||
1098 | || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__)) | ||
1099 | # if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \ | ||
1100 | || 0x5110 <= __SUNPRO_C) | ||
1101 | # define _Noreturn __attribute__ ((__noreturn__)) | ||
1102 | # elif defined _MSC_VER && 1200 <= _MSC_VER | ||
1103 | # define _Noreturn __declspec (noreturn) | ||
1104 | # else | ||
1105 | # define _Noreturn | ||
1106 | # endif | ||
1107 | #endif | ||
1108 | |||
1109 | |||
1110 | /* Define to 2 if the system does not provide POSIX.1 features except with | ||
1111 | this defined. */ | ||
1112 | #undef _POSIX_1_SOURCE | ||
1113 | |||
1114 | /* Define to 1 if you need to in order for 'stat' and other things to work. */ | ||
1115 | #undef _POSIX_SOURCE | ||
1116 | |||
1117 | /* Define to rpl_ if the getopt replacement functions and variables should be | ||
1118 | used. */ | ||
1119 | #undef __GETOPT_PREFIX | ||
1120 | |||
1121 | /* Please see the Gnulib manual for how to use these macros. | ||
1122 | |||
1123 | Suppress extern inline with HP-UX cc, as it appears to be broken; see | ||
1124 | <http://lists.gnu.org/archive/html/bug-texinfo/2013-02/msg00030.html>. | ||
1125 | |||
1126 | Suppress extern inline with Sun C in standards-conformance mode, as it | ||
1127 | mishandles inline functions that call each other. E.g., for 'inline void f | ||
1128 | (void) { } inline void g (void) { f (); }', c99 incorrectly complains | ||
1129 | 'reference to static identifier "f" in extern inline function'. | ||
1130 | This bug was observed with Sun C 5.12 SunOS_i386 2011/11/16. | ||
1131 | |||
1132 | Suppress extern inline (with or without __attribute__ ((__gnu_inline__))) | ||
1133 | on configurations that mistakenly use 'static inline' to implement | ||
1134 | functions or macros in standard C headers like <ctype.h>. For example, | ||
1135 | if isdigit is mistakenly implemented via a static inline function, | ||
1136 | a program containing an extern inline function that calls isdigit | ||
1137 | may not work since the C standard prohibits extern inline functions | ||
1138 | from calling static functions. This bug is known to occur on: | ||
1139 | |||
1140 | OS X 10.8 and earlier; see: | ||
1141 | http://lists.gnu.org/archive/html/bug-gnulib/2012-12/msg00023.html | ||
1142 | |||
1143 | DragonFly; see | ||
1144 | http://muscles.dragonflybsd.org/bulk/bleeding-edge-potential/latest-per-pkg/ah-tty-0.3.12.log | ||
1145 | |||
1146 | FreeBSD; see: | ||
1147 | http://lists.gnu.org/archive/html/bug-gnulib/2014-07/msg00104.html | ||
1148 | |||
1149 | OS X 10.9 has a macro __header_inline indicating the bug is fixed for C and | ||
1150 | for clang but remains for g++; see <http://trac.macports.org/ticket/41033>. | ||
1151 | Assume DragonFly and FreeBSD will be similar. */ | ||
1152 | #if (((defined __APPLE__ && defined __MACH__) \ | ||
1153 | || defined __DragonFly__ || defined __FreeBSD__) \ | ||
1154 | && (defined __header_inline \ | ||
1155 | ? (defined __cplusplus && defined __GNUC_STDC_INLINE__ \ | ||
1156 | && ! defined __clang__) \ | ||
1157 | : ((! defined _DONT_USE_CTYPE_INLINE_ \ | ||
1158 | && (defined __GNUC__ || defined __cplusplus)) \ | ||
1159 | || (defined _FORTIFY_SOURCE && 0 < _FORTIFY_SOURCE \ | ||
1160 | && defined __GNUC__ && ! defined __cplusplus)))) | ||
1161 | # define _GL_EXTERN_INLINE_STDHEADER_BUG | ||
1162 | #endif | ||
1163 | #if ((__GNUC__ \ | ||
1164 | ? defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ \ | ||
1165 | : (199901L <= __STDC_VERSION__ \ | ||
1166 | && !defined __HP_cc \ | ||
1167 | && !(defined __SUNPRO_C && __STDC__))) \ | ||
1168 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) | ||
1169 | # define _GL_INLINE inline | ||
1170 | # define _GL_EXTERN_INLINE extern inline | ||
1171 | # define _GL_EXTERN_INLINE_IN_USE | ||
1172 | #elif (2 < __GNUC__ + (7 <= __GNUC_MINOR__) && !defined __STRICT_ANSI__ \ | ||
1173 | && !defined _GL_EXTERN_INLINE_STDHEADER_BUG) | ||
1174 | # if defined __GNUC_GNU_INLINE__ && __GNUC_GNU_INLINE__ | ||
1175 | /* __gnu_inline__ suppresses a GCC 4.2 diagnostic. */ | ||
1176 | # define _GL_INLINE extern inline __attribute__ ((__gnu_inline__)) | ||
1177 | # else | ||
1178 | # define _GL_INLINE extern inline | ||
1179 | # endif | ||
1180 | # define _GL_EXTERN_INLINE extern | ||
1181 | # define _GL_EXTERN_INLINE_IN_USE | ||
1182 | #else | ||
1183 | # define _GL_INLINE static _GL_UNUSED | ||
1184 | # define _GL_EXTERN_INLINE static _GL_UNUSED | ||
1185 | #endif | ||
1186 | |||
1187 | #if 4 < __GNUC__ + (6 <= __GNUC_MINOR__) | ||
1188 | # if defined __GNUC_STDC_INLINE__ && __GNUC_STDC_INLINE__ | ||
1189 | # define _GL_INLINE_HEADER_CONST_PRAGMA | ||
1190 | # else | ||
1191 | # define _GL_INLINE_HEADER_CONST_PRAGMA \ | ||
1192 | _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"") | ||
1193 | # endif | ||
1194 | /* Suppress GCC's bogus "no previous prototype for 'FOO'" | ||
1195 | and "no previous declaration for 'FOO'" diagnostics, | ||
1196 | when FOO is an inline function in the header; see | ||
1197 | <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54113>. */ | ||
1198 | # define _GL_INLINE_HEADER_BEGIN \ | ||
1199 | _Pragma ("GCC diagnostic push") \ | ||
1200 | _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \ | ||
1201 | _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \ | ||
1202 | _GL_INLINE_HEADER_CONST_PRAGMA | ||
1203 | # define _GL_INLINE_HEADER_END \ | ||
1204 | _Pragma ("GCC diagnostic pop") | ||
1205 | #else | ||
1206 | # define _GL_INLINE_HEADER_BEGIN | ||
1207 | # define _GL_INLINE_HEADER_END | ||
1208 | #endif | ||
1209 | |||
1210 | /* A replacement for va_copy, if needed. */ | ||
1211 | #define gl_va_copy(a,b) ((a) = (b)) | ||
1212 | |||
1213 | /* Define to `__inline__' or `__inline' if that's what the C compiler | ||
1214 | calls it, or to nothing if 'inline' is not supported under any name. */ | ||
1215 | #ifndef __cplusplus | ||
1216 | #undef inline | ||
1217 | #endif | ||
1218 | |||
1219 | /* Work around a bug in Apple GCC 4.0.1 build 5465: In C99 mode, it supports | ||
1220 | the ISO C 99 semantics of 'extern inline' (unlike the GNU C semantics of | ||
1221 | earlier versions), but does not display it by setting __GNUC_STDC_INLINE__. | ||
1222 | __APPLE__ && __MACH__ test for Mac OS X. | ||
1223 | __APPLE_CC__ tests for the Apple compiler and its version. | ||
1224 | __STDC_VERSION__ tests for the C99 mode. */ | ||
1225 | #if defined __APPLE__ && defined __MACH__ && __APPLE_CC__ >= 5465 && !defined __cplusplus && __STDC_VERSION__ >= 199901L && !defined __GNUC_STDC_INLINE__ | ||
1226 | # define __GNUC_STDC_INLINE__ 1 | ||
1227 | #endif | ||
1228 | |||
1229 | /* Define to `int' if <sys/types.h> does not define. */ | ||
1230 | #undef mode_t | ||
1231 | |||
1232 | /* Define to the type of st_nlink in struct stat, or a supertype. */ | ||
1233 | #undef nlink_t | ||
1234 | |||
1235 | /* Define to `int' if <sys/types.h> does not define. */ | ||
1236 | #undef pid_t | ||
1237 | |||
1238 | /* Define to the equivalent of the C99 'restrict' keyword, or to | ||
1239 | nothing if this is not supported. Do not define if restrict is | ||
1240 | supported directly. */ | ||
1241 | #undef restrict | ||
1242 | /* Work around a bug in Sun C++: it does not support _Restrict or | ||
1243 | __restrict__, even though the corresponding Sun C compiler ends up with | ||
1244 | "#define restrict _Restrict" or "#define restrict __restrict__" in the | ||
1245 | previous line. Perhaps some future version of Sun C++ will work with | ||
1246 | restrict; if so, hopefully it defines __RESTRICT like Sun C does. */ | ||
1247 | #if defined __SUNPRO_CC && !defined __RESTRICT | ||
1248 | # define _Restrict | ||
1249 | # define __restrict__ | ||
1250 | #endif | ||
1251 | |||
1252 | /* Define to `unsigned int' if <sys/types.h> does not define. */ | ||
1253 | #undef size_t | ||
1254 | |||
1255 | /* Define as a signed type of the same size as size_t. */ | ||
1256 | #undef ssize_t | ||
1257 | |||
1258 | /* Define as a marker that can be attached to declarations that might not | ||
1259 | be used. This helps to reduce warnings, such as from | ||
1260 | GCC -Wunused-parameter. */ | ||
1261 | #if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7) | ||
1262 | # define _GL_UNUSED __attribute__ ((__unused__)) | ||
1263 | #else | ||
1264 | # define _GL_UNUSED | ||
1265 | #endif | ||
1266 | /* The name _UNUSED_PARAMETER_ is an earlier spelling, although the name | ||
1267 | is a misnomer outside of parameter lists. */ | ||
1268 | #define _UNUSED_PARAMETER_ _GL_UNUSED | ||
1269 | |||
1270 | /* gcc supports the "unused" attribute on possibly unused labels, and | ||
1271 | g++ has since version 4.5. Note to support C++ as well as C, | ||
1272 | _GL_UNUSED_LABEL should be used with a trailing ; */ | ||
1273 | #if !defined __cplusplus || __GNUC__ > 4 \ | ||
1274 | || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) | ||
1275 | # define _GL_UNUSED_LABEL _GL_UNUSED | ||
1276 | #else | ||
1277 | # define _GL_UNUSED_LABEL | ||
1278 | #endif | ||
1279 | |||
1280 | /* The __pure__ attribute was added in gcc 2.96. */ | ||
1281 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) | ||
1282 | # define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__)) | ||
1283 | #else | ||
1284 | # define _GL_ATTRIBUTE_PURE /* empty */ | ||
1285 | #endif | ||
1286 | |||
1287 | /* The __const__ attribute was added in gcc 2.95. */ | ||
1288 | #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
1289 | # define _GL_ATTRIBUTE_CONST __attribute__ ((__const__)) | ||
1290 | #else | ||
1291 | # define _GL_ATTRIBUTE_CONST /* empty */ | ||
1292 | #endif | ||
1293 | |||
1294 | |||
1295 | /* Define as a macro for copying va_list variables. */ | ||
1296 | #undef va_copy | ||
diff --git a/3rdParty/LibIDN/src/gl/c-ctype.c b/3rdParty/LibIDN/src/gl/c-ctype.c new file mode 100644 index 0000000..932d676 --- /dev/null +++ b/3rdParty/LibIDN/src/gl/c-ctype.c | |||
@@ -0,0 +1,395 @@ | |||
1 | /* Character handling in C locale. | ||
2 | |||
3 | Copyright 2000-2003, 2006, 2009-2015 Free Software Foundation, Inc. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as published by | ||
7 | the Free Software Foundation; either version 2.1 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | #include <config.h> | ||
19 | |||
20 | /* Specification. */ | ||
21 | #define NO_C_CTYPE_MACROS | ||
22 | #include "c-ctype.h" | ||
23 | |||
24 | /* The function isascii is not locale dependent. Its use in EBCDIC is | ||
25 | questionable. */ | ||
26 | bool | ||
27 | c_isascii (int c) | ||
28 | { | ||
29 | return (c >= 0x00 && c <= 0x7f); | ||
30 | } | ||
31 | |||
32 | bool | ||
33 | c_isalnum (int c) | ||
34 | { | ||
35 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
36 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
37 | #if C_CTYPE_ASCII | ||
38 | return ((c >= '0' && c <= '9') | ||
39 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z')); | ||
40 | #else | ||
41 | return ((c >= '0' && c <= '9') | ||
42 | || (c >= 'A' && c <= 'Z') | ||
43 | || (c >= 'a' && c <= 'z')); | ||
44 | #endif | ||
45 | #else | ||
46 | switch (c) | ||
47 | { | ||
48 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
49 | case '6': case '7': case '8': case '9': | ||
50 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
51 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
52 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
53 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
54 | case 'Y': case 'Z': | ||
55 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
56 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
57 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
58 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
59 | case 'y': case 'z': | ||
60 | return 1; | ||
61 | default: | ||
62 | return 0; | ||
63 | } | ||
64 | #endif | ||
65 | } | ||
66 | |||
67 | bool | ||
68 | c_isalpha (int c) | ||
69 | { | ||
70 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
71 | #if C_CTYPE_ASCII | ||
72 | return ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'); | ||
73 | #else | ||
74 | return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')); | ||
75 | #endif | ||
76 | #else | ||
77 | switch (c) | ||
78 | { | ||
79 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
80 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
81 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
82 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
83 | case 'Y': case 'Z': | ||
84 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
85 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
86 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
87 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
88 | case 'y': case 'z': | ||
89 | return 1; | ||
90 | default: | ||
91 | return 0; | ||
92 | } | ||
93 | #endif | ||
94 | } | ||
95 | |||
96 | bool | ||
97 | c_isblank (int c) | ||
98 | { | ||
99 | return (c == ' ' || c == '\t'); | ||
100 | } | ||
101 | |||
102 | bool | ||
103 | c_iscntrl (int c) | ||
104 | { | ||
105 | #if C_CTYPE_ASCII | ||
106 | return ((c & ~0x1f) == 0 || c == 0x7f); | ||
107 | #else | ||
108 | switch (c) | ||
109 | { | ||
110 | case ' ': case '!': case '"': case '#': case '$': case '%': | ||
111 | case '&': case '\'': case '(': case ')': case '*': case '+': | ||
112 | case ',': case '-': case '.': case '/': | ||
113 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
114 | case '6': case '7': case '8': case '9': | ||
115 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
116 | case '@': | ||
117 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
118 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
119 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
120 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
121 | case 'Y': case 'Z': | ||
122 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
123 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
124 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
125 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
126 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
127 | case 'y': case 'z': | ||
128 | case '{': case '|': case '}': case '~': | ||
129 | return 0; | ||
130 | default: | ||
131 | return 1; | ||
132 | } | ||
133 | #endif | ||
134 | } | ||
135 | |||
136 | bool | ||
137 | c_isdigit (int c) | ||
138 | { | ||
139 | #if C_CTYPE_CONSECUTIVE_DIGITS | ||
140 | return (c >= '0' && c <= '9'); | ||
141 | #else | ||
142 | switch (c) | ||
143 | { | ||
144 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
145 | case '6': case '7': case '8': case '9': | ||
146 | return 1; | ||
147 | default: | ||
148 | return 0; | ||
149 | } | ||
150 | #endif | ||
151 | } | ||
152 | |||
153 | bool | ||
154 | c_islower (int c) | ||
155 | { | ||
156 | #if C_CTYPE_CONSECUTIVE_LOWERCASE | ||
157 | return (c >= 'a' && c <= 'z'); | ||
158 | #else | ||
159 | switch (c) | ||
160 | { | ||
161 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
162 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
163 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
164 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
165 | case 'y': case 'z': | ||
166 | return 1; | ||
167 | default: | ||
168 | return 0; | ||
169 | } | ||
170 | #endif | ||
171 | } | ||
172 | |||
173 | bool | ||
174 | c_isgraph (int c) | ||
175 | { | ||
176 | #if C_CTYPE_ASCII | ||
177 | return (c >= '!' && c <= '~'); | ||
178 | #else | ||
179 | switch (c) | ||
180 | { | ||
181 | case '!': case '"': case '#': case '$': case '%': case '&': | ||
182 | case '\'': case '(': case ')': case '*': case '+': case ',': | ||
183 | case '-': case '.': case '/': | ||
184 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
185 | case '6': case '7': case '8': case '9': | ||
186 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
187 | case '@': | ||
188 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
189 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
190 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
191 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
192 | case 'Y': case 'Z': | ||
193 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
194 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
195 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
196 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
197 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
198 | case 'y': case 'z': | ||
199 | case '{': case '|': case '}': case '~': | ||
200 | return 1; | ||
201 | default: | ||
202 | return 0; | ||
203 | } | ||
204 | #endif | ||
205 | } | ||
206 | |||
207 | bool | ||
208 | c_isprint (int c) | ||
209 | { | ||
210 | #if C_CTYPE_ASCII | ||
211 | return (c >= ' ' && c <= '~'); | ||
212 | #else | ||
213 | switch (c) | ||
214 | { | ||
215 | case ' ': case '!': case '"': case '#': case '$': case '%': | ||
216 | case '&': case '\'': case '(': case ')': case '*': case '+': | ||
217 | case ',': case '-': case '.': case '/': | ||
218 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
219 | case '6': case '7': case '8': case '9': | ||
220 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
221 | case '@': | ||
222 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
223 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
224 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
225 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
226 | case 'Y': case 'Z': | ||
227 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
228 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
229 | case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': | ||
230 | case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': | ||
231 | case 's': case 't': case 'u': case 'v': case 'w': case 'x': | ||
232 | case 'y': case 'z': | ||
233 | case '{': case '|': case '}': case '~': | ||
234 | return 1; | ||
235 | default: | ||
236 | return 0; | ||
237 | } | ||
238 | #endif | ||
239 | } | ||
240 | |||
241 | bool | ||
242 | c_ispunct (int c) | ||
243 | { | ||
244 | #if C_CTYPE_ASCII | ||
245 | return ((c >= '!' && c <= '~') | ||
246 | && !((c >= '0' && c <= '9') | ||
247 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'Z'))); | ||
248 | #else | ||
249 | switch (c) | ||
250 | { | ||
251 | case '!': case '"': case '#': case '$': case '%': case '&': | ||
252 | case '\'': case '(': case ')': case '*': case '+': case ',': | ||
253 | case '-': case '.': case '/': | ||
254 | case ':': case ';': case '<': case '=': case '>': case '?': | ||
255 | case '@': | ||
256 | case '[': case '\\': case ']': case '^': case '_': case '`': | ||
257 | case '{': case '|': case '}': case '~': | ||
258 | return 1; | ||
259 | default: | ||
260 | return 0; | ||
261 | } | ||
262 | #endif | ||
263 | } | ||
264 | |||
265 | bool | ||
266 | c_isspace (int c) | ||
267 | { | ||
268 | return (c == ' ' || c == '\t' | ||
269 | || c == '\n' || c == '\v' || c == '\f' || c == '\r'); | ||
270 | } | ||
271 | |||
272 | bool | ||
273 | c_isupper (int c) | ||
274 | { | ||
275 | #if C_CTYPE_CONSECUTIVE_UPPERCASE | ||
276 | return (c >= 'A' && c <= 'Z'); | ||
277 | #else | ||
278 | switch (c) | ||
279 | { | ||
280 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
281 | case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': | ||
282 | case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': | ||
283 | case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': | ||
284 | case 'Y': case 'Z': | ||
285 | return 1; | ||
286 | default: | ||
287 | return 0; | ||
288 | } | ||
289 | #endif | ||
290 | } | ||
291 | |||
292 | bool | ||
293 | c_isxdigit (int c) | ||
294 | { | ||
295 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
296 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
297 | #if C_CTYPE_ASCII | ||
298 | return ((c >= '0' && c <= '9') | ||
299 | || ((c & ~0x20) >= 'A' && (c & ~0x20) <= 'F')); | ||
300 | #else | ||
301 | return ((c >= '0' && c <= '9') | ||
302 | || (c >= 'A' && c <= 'F') | ||
303 | || (c >= 'a' && c <= 'f')); | ||
304 | #endif | ||
305 | #else | ||
306 | switch (c) | ||
307 | { | ||
308 | case '0': case '1': case '2': case '3': case '4': case '5': | ||
309 | case '6': case '7': case '8': case '9': | ||
310 | case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': | ||
311 | case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': | ||
312 | return 1; | ||
313 | default: | ||
314 | return 0; | ||
315 | } | ||
316 | #endif | ||
317 | } | ||
318 | |||
319 | int | ||
320 | c_tolower (int c) | ||
321 | { | ||
322 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
323 | return (c >= 'A' && c <= 'Z' ? c - 'A' + 'a' : c); | ||
324 | #else | ||
325 | switch (c) | ||
326 | { | ||
327 | case 'A': return 'a'; | ||
328 | case 'B': return 'b'; | ||
329 | case 'C': return 'c'; | ||
330 | case 'D': return 'd'; | ||
331 | case 'E': return 'e'; | ||
332 | case 'F': return 'f'; | ||
333 | case 'G': return 'g'; | ||
334 | case 'H': return 'h'; | ||
335 | case 'I': return 'i'; | ||
336 | case 'J': return 'j'; | ||
337 | case 'K': return 'k'; | ||
338 | case 'L': return 'l'; | ||
339 | case 'M': return 'm'; | ||
340 | case 'N': return 'n'; | ||
341 | case 'O': return 'o'; | ||
342 | case 'P': return 'p'; | ||
343 | case 'Q': return 'q'; | ||
344 | case 'R': return 'r'; | ||
345 | case 'S': return 's'; | ||
346 | case 'T': return 't'; | ||
347 | case 'U': return 'u'; | ||
348 | case 'V': return 'v'; | ||
349 | case 'W': return 'w'; | ||
350 | case 'X': return 'x'; | ||
351 | case 'Y': return 'y'; | ||
352 | case 'Z': return 'z'; | ||
353 | default: return c; | ||
354 | } | ||
355 | #endif | ||
356 | } | ||
357 | |||
358 | int | ||
359 | c_toupper (int c) | ||
360 | { | ||
361 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
362 | return (c >= 'a' && c <= 'z' ? c - 'a' + 'A' : c); | ||
363 | #else | ||
364 | switch (c) | ||
365 | { | ||
366 | case 'a': return 'A'; | ||
367 | case 'b': return 'B'; | ||
368 | case 'c': return 'C'; | ||
369 | case 'd': return 'D'; | ||
370 | case 'e': return 'E'; | ||
371 | case 'f': return 'F'; | ||
372 | case 'g': return 'G'; | ||
373 | case 'h': return 'H'; | ||
374 | case 'i': return 'I'; | ||
375 | case 'j': return 'J'; | ||
376 | case 'k': return 'K'; | ||
377 | case 'l': return 'L'; | ||
378 | case 'm': return 'M'; | ||
379 | case 'n': return 'N'; | ||
380 | case 'o': return 'O'; | ||
381 | case 'p': return 'P'; | ||
382 | case 'q': return 'Q'; | ||
383 | case 'r': return 'R'; | ||
384 | case 's': return 'S'; | ||
385 | case 't': return 'T'; | ||
386 | case 'u': return 'U'; | ||
387 | case 'v': return 'V'; | ||
388 | case 'w': return 'W'; | ||
389 | case 'x': return 'X'; | ||
390 | case 'y': return 'Y'; | ||
391 | case 'z': return 'Z'; | ||
392 | default: return c; | ||
393 | } | ||
394 | #endif | ||
395 | } | ||
diff --git a/3rdParty/LibIDN/src/gl/c-ctype.h b/3rdParty/LibIDN/src/gl/c-ctype.h new file mode 100644 index 0000000..d57cf43 --- /dev/null +++ b/3rdParty/LibIDN/src/gl/c-ctype.h | |||
@@ -0,0 +1,295 @@ | |||
1 | /* Character handling in C locale. | ||
2 | |||
3 | These functions work like the corresponding functions in <ctype.h>, | ||
4 | except that they have the C (POSIX) locale hardwired, whereas the | ||
5 | <ctype.h> functions' behaviour depends on the current locale set via | ||
6 | setlocale. | ||
7 | |||
8 | Copyright (C) 2000-2003, 2006, 2008-2015 Free Software Foundation, Inc. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU Lesser General Public License as published by | ||
12 | the Free Software Foundation; either version 2.1 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU Lesser General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU Lesser General Public License | ||
21 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
22 | |||
23 | #ifndef C_CTYPE_H | ||
24 | #define C_CTYPE_H | ||
25 | |||
26 | #include <stdbool.h> | ||
27 | |||
28 | |||
29 | #ifdef __cplusplus | ||
30 | extern "C" { | ||
31 | #endif | ||
32 | |||
33 | |||
34 | /* The functions defined in this file assume the "C" locale and a character | ||
35 | set without diacritics (ASCII-US or EBCDIC-US or something like that). | ||
36 | Even if the "C" locale on a particular system is an extension of the ASCII | ||
37 | character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it | ||
38 | is ISO-8859-1), the functions in this file recognize only the ASCII | ||
39 | characters. */ | ||
40 | |||
41 | |||
42 | /* Check whether the ASCII optimizations apply. */ | ||
43 | |||
44 | /* ANSI C89 (and ISO C99 5.2.1.3 too) already guarantees that | ||
45 | '0', '1', ..., '9' have consecutive integer values. */ | ||
46 | #define C_CTYPE_CONSECUTIVE_DIGITS 1 | ||
47 | |||
48 | #if ('A' <= 'Z') \ | ||
49 | && ('A' + 1 == 'B') && ('B' + 1 == 'C') && ('C' + 1 == 'D') \ | ||
50 | && ('D' + 1 == 'E') && ('E' + 1 == 'F') && ('F' + 1 == 'G') \ | ||
51 | && ('G' + 1 == 'H') && ('H' + 1 == 'I') && ('I' + 1 == 'J') \ | ||
52 | && ('J' + 1 == 'K') && ('K' + 1 == 'L') && ('L' + 1 == 'M') \ | ||
53 | && ('M' + 1 == 'N') && ('N' + 1 == 'O') && ('O' + 1 == 'P') \ | ||
54 | && ('P' + 1 == 'Q') && ('Q' + 1 == 'R') && ('R' + 1 == 'S') \ | ||
55 | && ('S' + 1 == 'T') && ('T' + 1 == 'U') && ('U' + 1 == 'V') \ | ||
56 | && ('V' + 1 == 'W') && ('W' + 1 == 'X') && ('X' + 1 == 'Y') \ | ||
57 | && ('Y' + 1 == 'Z') | ||
58 | #define C_CTYPE_CONSECUTIVE_UPPERCASE 1 | ||
59 | #endif | ||
60 | |||
61 | #if ('a' <= 'z') \ | ||
62 | && ('a' + 1 == 'b') && ('b' + 1 == 'c') && ('c' + 1 == 'd') \ | ||
63 | && ('d' + 1 == 'e') && ('e' + 1 == 'f') && ('f' + 1 == 'g') \ | ||
64 | && ('g' + 1 == 'h') && ('h' + 1 == 'i') && ('i' + 1 == 'j') \ | ||
65 | && ('j' + 1 == 'k') && ('k' + 1 == 'l') && ('l' + 1 == 'm') \ | ||
66 | && ('m' + 1 == 'n') && ('n' + 1 == 'o') && ('o' + 1 == 'p') \ | ||
67 | && ('p' + 1 == 'q') && ('q' + 1 == 'r') && ('r' + 1 == 's') \ | ||
68 | && ('s' + 1 == 't') && ('t' + 1 == 'u') && ('u' + 1 == 'v') \ | ||
69 | && ('v' + 1 == 'w') && ('w' + 1 == 'x') && ('x' + 1 == 'y') \ | ||
70 | && ('y' + 1 == 'z') | ||
71 | #define C_CTYPE_CONSECUTIVE_LOWERCASE 1 | ||
72 | #endif | ||
73 | |||
74 | #if (' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
75 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
76 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
77 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
78 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
79 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
80 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
81 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
82 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
83 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
84 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
85 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
86 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
87 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
88 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
89 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
90 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
91 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
92 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
93 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
94 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
95 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
96 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126) | ||
97 | /* The character set is ASCII or one of its variants or extensions, not EBCDIC. | ||
98 | Testing the value of '\n' and '\r' is not relevant. */ | ||
99 | #define C_CTYPE_ASCII 1 | ||
100 | #endif | ||
101 | |||
102 | |||
103 | /* Function declarations. */ | ||
104 | |||
105 | /* Unlike the functions in <ctype.h>, which require an argument in the range | ||
106 | of the 'unsigned char' type, the functions here operate on values that are | ||
107 | in the 'unsigned char' range or in the 'char' range. In other words, | ||
108 | when you have a 'char' value, you need to cast it before using it as | ||
109 | argument to a <ctype.h> function: | ||
110 | |||
111 | const char *s = ...; | ||
112 | if (isalpha ((unsigned char) *s)) ... | ||
113 | |||
114 | but you don't need to cast it for the functions defined in this file: | ||
115 | |||
116 | const char *s = ...; | ||
117 | if (c_isalpha (*s)) ... | ||
118 | */ | ||
119 | |||
120 | extern bool c_isascii (int c) _GL_ATTRIBUTE_CONST; /* not locale dependent */ | ||
121 | |||
122 | extern bool c_isalnum (int c) _GL_ATTRIBUTE_CONST; | ||
123 | extern bool c_isalpha (int c) _GL_ATTRIBUTE_CONST; | ||
124 | extern bool c_isblank (int c) _GL_ATTRIBUTE_CONST; | ||
125 | extern bool c_iscntrl (int c) _GL_ATTRIBUTE_CONST; | ||
126 | extern bool c_isdigit (int c) _GL_ATTRIBUTE_CONST; | ||
127 | extern bool c_islower (int c) _GL_ATTRIBUTE_CONST; | ||
128 | extern bool c_isgraph (int c) _GL_ATTRIBUTE_CONST; | ||
129 | extern bool c_isprint (int c) _GL_ATTRIBUTE_CONST; | ||
130 | extern bool c_ispunct (int c) _GL_ATTRIBUTE_CONST; | ||
131 | extern bool c_isspace (int c) _GL_ATTRIBUTE_CONST; | ||
132 | extern bool c_isupper (int c) _GL_ATTRIBUTE_CONST; | ||
133 | extern bool c_isxdigit (int c) _GL_ATTRIBUTE_CONST; | ||
134 | |||
135 | extern int c_tolower (int c) _GL_ATTRIBUTE_CONST; | ||
136 | extern int c_toupper (int c) _GL_ATTRIBUTE_CONST; | ||
137 | |||
138 | |||
139 | #if (defined __GNUC__ && !defined __STRICT_ANSI__ && defined __OPTIMIZE__ \ | ||
140 | && !defined __OPTIMIZE_SIZE__ && !defined NO_C_CTYPE_MACROS) | ||
141 | |||
142 | /* ASCII optimizations. */ | ||
143 | |||
144 | #undef c_isascii | ||
145 | #define c_isascii(c) \ | ||
146 | ({ int __c = (c); \ | ||
147 | (__c >= 0x00 && __c <= 0x7f); \ | ||
148 | }) | ||
149 | |||
150 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
151 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
152 | #if C_CTYPE_ASCII | ||
153 | #undef c_isalnum | ||
154 | #define c_isalnum(c) \ | ||
155 | ({ int __c = (c); \ | ||
156 | ((__c >= '0' && __c <= '9') \ | ||
157 | || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z')); \ | ||
158 | }) | ||
159 | #else | ||
160 | #undef c_isalnum | ||
161 | #define c_isalnum(c) \ | ||
162 | ({ int __c = (c); \ | ||
163 | ((__c >= '0' && __c <= '9') \ | ||
164 | || (__c >= 'A' && __c <= 'Z') \ | ||
165 | || (__c >= 'a' && __c <= 'z')); \ | ||
166 | }) | ||
167 | #endif | ||
168 | #endif | ||
169 | |||
170 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
171 | #if C_CTYPE_ASCII | ||
172 | #undef c_isalpha | ||
173 | #define c_isalpha(c) \ | ||
174 | ({ int __c = (c); \ | ||
175 | ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'Z'); \ | ||
176 | }) | ||
177 | #else | ||
178 | #undef c_isalpha | ||
179 | #define c_isalpha(c) \ | ||
180 | ({ int __c = (c); \ | ||
181 | ((__c >= 'A' && __c <= 'Z') || (__c >= 'a' && __c <= 'z')); \ | ||
182 | }) | ||
183 | #endif | ||
184 | #endif | ||
185 | |||
186 | #undef c_isblank | ||
187 | #define c_isblank(c) \ | ||
188 | ({ int __c = (c); \ | ||
189 | (__c == ' ' || __c == '\t'); \ | ||
190 | }) | ||
191 | |||
192 | #if C_CTYPE_ASCII | ||
193 | #undef c_iscntrl | ||
194 | #define c_iscntrl(c) \ | ||
195 | ({ int __c = (c); \ | ||
196 | ((__c & ~0x1f) == 0 || __c == 0x7f); \ | ||
197 | }) | ||
198 | #endif | ||
199 | |||
200 | #if C_CTYPE_CONSECUTIVE_DIGITS | ||
201 | #undef c_isdigit | ||
202 | #define c_isdigit(c) \ | ||
203 | ({ int __c = (c); \ | ||
204 | (__c >= '0' && __c <= '9'); \ | ||
205 | }) | ||
206 | #endif | ||
207 | |||
208 | #if C_CTYPE_CONSECUTIVE_LOWERCASE | ||
209 | #undef c_islower | ||
210 | #define c_islower(c) \ | ||
211 | ({ int __c = (c); \ | ||
212 | (__c >= 'a' && __c <= 'z'); \ | ||
213 | }) | ||
214 | #endif | ||
215 | |||
216 | #if C_CTYPE_ASCII | ||
217 | #undef c_isgraph | ||
218 | #define c_isgraph(c) \ | ||
219 | ({ int __c = (c); \ | ||
220 | (__c >= '!' && __c <= '~'); \ | ||
221 | }) | ||
222 | #endif | ||
223 | |||
224 | #if C_CTYPE_ASCII | ||
225 | #undef c_isprint | ||
226 | #define c_isprint(c) \ | ||
227 | ({ int __c = (c); \ | ||
228 | (__c >= ' ' && __c <= '~'); \ | ||
229 | }) | ||
230 | #endif | ||
231 | |||
232 | #if C_CTYPE_ASCII | ||
233 | #undef c_ispunct | ||
234 | #define c_ispunct(c) \ | ||
235 | ({ int _c = (c); \ | ||
236 | (c_isgraph (_c) && ! c_isalnum (_c)); \ | ||
237 | }) | ||
238 | #endif | ||
239 | |||
240 | #undef c_isspace | ||
241 | #define c_isspace(c) \ | ||
242 | ({ int __c = (c); \ | ||
243 | (__c == ' ' || __c == '\t' \ | ||
244 | || __c == '\n' || __c == '\v' || __c == '\f' || __c == '\r'); \ | ||
245 | }) | ||
246 | |||
247 | #if C_CTYPE_CONSECUTIVE_UPPERCASE | ||
248 | #undef c_isupper | ||
249 | #define c_isupper(c) \ | ||
250 | ({ int __c = (c); \ | ||
251 | (__c >= 'A' && __c <= 'Z'); \ | ||
252 | }) | ||
253 | #endif | ||
254 | |||
255 | #if C_CTYPE_CONSECUTIVE_DIGITS \ | ||
256 | && C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
257 | #if C_CTYPE_ASCII | ||
258 | #undef c_isxdigit | ||
259 | #define c_isxdigit(c) \ | ||
260 | ({ int __c = (c); \ | ||
261 | ((__c >= '0' && __c <= '9') \ | ||
262 | || ((__c & ~0x20) >= 'A' && (__c & ~0x20) <= 'F')); \ | ||
263 | }) | ||
264 | #else | ||
265 | #undef c_isxdigit | ||
266 | #define c_isxdigit(c) \ | ||
267 | ({ int __c = (c); \ | ||
268 | ((__c >= '0' && __c <= '9') \ | ||
269 | || (__c >= 'A' && __c <= 'F') \ | ||
270 | || (__c >= 'a' && __c <= 'f')); \ | ||
271 | }) | ||
272 | #endif | ||
273 | #endif | ||
274 | |||
275 | #if C_CTYPE_CONSECUTIVE_UPPERCASE && C_CTYPE_CONSECUTIVE_LOWERCASE | ||
276 | #undef c_tolower | ||
277 | #define c_tolower(c) \ | ||
278 | ({ int __c = (c); \ | ||
279 | (__c >= 'A' && __c <= 'Z' ? __c - 'A' + 'a' : __c); \ | ||
280 | }) | ||
281 | #undef c_toupper | ||
282 | #define c_toupper(c) \ | ||
283 | ({ int __c = (c); \ | ||
284 | (__c >= 'a' && __c <= 'z' ? __c - 'a' + 'A' : __c); \ | ||
285 | }) | ||
286 | #endif | ||
287 | |||
288 | #endif /* optimizing for speed */ | ||
289 | |||
290 | |||
291 | #ifdef __cplusplus | ||
292 | } | ||
293 | #endif | ||
294 | |||
295 | #endif /* C_CTYPE_H */ | ||
diff --git a/3rdParty/LibIDN/src/gl/c-strcase.h b/3rdParty/LibIDN/src/gl/c-strcase.h new file mode 100644 index 0000000..5292a0a --- /dev/null +++ b/3rdParty/LibIDN/src/gl/c-strcase.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /* Case-insensitive string comparison functions in C locale. | ||
2 | Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2015 Free Software | ||
3 | Foundation, Inc. | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU Lesser General Public License as published by | ||
7 | the Free Software Foundation; either version 2.1, or (at your option) | ||
8 | any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | #ifndef C_STRCASE_H | ||
19 | #define C_STRCASE_H | ||
20 | |||
21 | #include <stddef.h> | ||
22 | |||
23 | |||
24 | /* The functions defined in this file assume the "C" locale and a character | ||
25 | set without diacritics (ASCII-US or EBCDIC-US or something like that). | ||
26 | Even if the "C" locale on a particular system is an extension of the ASCII | ||
27 | character set (like on BeOS, where it is UTF-8, or on AmigaOS, where it | ||
28 | is ISO-8859-1), the functions in this file recognize only the ASCII | ||
29 | characters. More precisely, one of the string arguments must be an ASCII | ||
30 | string; the other one can also contain non-ASCII characters (but then | ||
31 | the comparison result will be nonzero). */ | ||
32 | |||
33 | |||
34 | #ifdef __cplusplus | ||
35 | extern "C" { | ||
36 | #endif | ||
37 | |||
38 | |||
39 | /* Compare strings S1 and S2, ignoring case, returning less than, equal to or | ||
40 | greater than zero if S1 is lexicographically less than, equal to or greater | ||
41 | than S2. */ | ||
42 | extern int c_strcasecmp (const char *s1, const char *s2) _GL_ATTRIBUTE_PURE; | ||
43 | |||
44 | /* Compare no more than N characters of strings S1 and S2, ignoring case, | ||
45 | returning less than, equal to or greater than zero if S1 is | ||
46 | lexicographically less than, equal to or greater than S2. */ | ||
47 | extern int c_strncasecmp (const char *s1, const char *s2, size_t n) | ||
48 | _GL_ATTRIBUTE_PURE; | ||
49 | |||
50 | |||
51 | #ifdef __cplusplus | ||
52 | } | ||
53 | #endif | ||
54 | |||
55 | |||
56 | #endif /* C_STRCASE_H */ | ||
diff --git a/3rdParty/LibIDN/src/gl/c-strcasecmp.c b/3rdParty/LibIDN/src/gl/c-strcasecmp.c new file mode 100644 index 0000000..afff3e5 --- /dev/null +++ b/3rdParty/LibIDN/src/gl/c-strcasecmp.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* c-strcasecmp.c -- case insensitive string comparator in C locale | ||
2 | Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as published by | ||
6 | the Free Software Foundation; either version 2.1, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | |||
19 | /* Specification. */ | ||
20 | #include "c-strcase.h" | ||
21 | |||
22 | #include <limits.h> | ||
23 | |||
24 | #include "c-ctype.h" | ||
25 | |||
26 | int | ||
27 | c_strcasecmp (const char *s1, const char *s2) | ||
28 | { | ||
29 | register const unsigned char *p1 = (const unsigned char *) s1; | ||
30 | register const unsigned char *p2 = (const unsigned char *) s2; | ||
31 | unsigned char c1, c2; | ||
32 | |||
33 | if (p1 == p2) | ||
34 | return 0; | ||
35 | |||
36 | do | ||
37 | { | ||
38 | c1 = c_tolower (*p1); | ||
39 | c2 = c_tolower (*p2); | ||
40 | |||
41 | if (c1 == '\0') | ||
42 | break; | ||
43 | |||
44 | ++p1; | ||
45 | ++p2; | ||
46 | } | ||
47 | while (c1 == c2); | ||
48 | |||
49 | if (UCHAR_MAX <= INT_MAX) | ||
50 | return c1 - c2; | ||
51 | else | ||
52 | /* On machines where 'char' and 'int' are types of the same size, the | ||
53 | difference of two 'unsigned char' values - including the sign bit - | ||
54 | doesn't fit in an 'int'. */ | ||
55 | return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); | ||
56 | } | ||
diff --git a/3rdParty/LibIDN/src/gl/c-strncasecmp.c b/3rdParty/LibIDN/src/gl/c-strncasecmp.c new file mode 100644 index 0000000..9bd6689 --- /dev/null +++ b/3rdParty/LibIDN/src/gl/c-strncasecmp.c | |||
@@ -0,0 +1,56 @@ | |||
1 | /* c-strncasecmp.c -- case insensitive string comparator in C locale | ||
2 | Copyright (C) 1998-1999, 2005-2006, 2009-2015 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software; you can redistribute it and/or modify | ||
5 | it under the terms of the GNU Lesser General Public License as published by | ||
6 | the Free Software Foundation; either version 2.1, or (at your option) | ||
7 | any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | GNU Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program; if not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #include <config.h> | ||
18 | |||
19 | /* Specification. */ | ||
20 | #include "c-strcase.h" | ||
21 | |||
22 | #include <limits.h> | ||
23 | |||
24 | #include "c-ctype.h" | ||
25 | |||
26 | int | ||
27 | c_strncasecmp (const char *s1, const char *s2, size_t n) | ||
28 | { | ||
29 | register const unsigned char *p1 = (const unsigned char *) s1; | ||
30 | register const unsigned char *p2 = (const unsigned char *) s2; | ||
31 | unsigned char c1, c2; | ||
32 | |||
33 | if (p1 == p2 || n == 0) | ||
34 | return 0; | ||
35 | |||
36 | do | ||
37 | { | ||
38 | c1 = c_tolower (*p1); | ||
39 | c2 = c_tolower (*p2); | ||
40 | |||
41 | if (--n == 0 || c1 == '\0') | ||
42 | break; | ||
43 | |||
44 | ++p1; | ||
45 | ++p2; | ||
46 | } | ||
47 | while (c1 == c2); | ||
48 | |||
49 | if (UCHAR_MAX <= INT_MAX) | ||
50 | return c1 - c2; | ||
51 | else | ||
52 | /* On machines where 'char' and 'int' are types of the same size, the | ||
53 | difference of two 'unsigned char' values - including the sign bit - | ||
54 | doesn't fit in an 'int'. */ | ||
55 | return (c1 > c2 ? 1 : c1 < c2 ? -1 : 0); | ||
56 | } | ||
diff --git a/3rdParty/LibIDN/src/gl/unistr.h b/3rdParty/LibIDN/src/gl/unistr.h new file mode 100644 index 0000000..89e9a56 --- /dev/null +++ b/3rdParty/LibIDN/src/gl/unistr.h | |||
@@ -0,0 +1,750 @@ | |||
1 | /* Elementary Unicode string functions. | ||
2 | Copyright (C) 2001-2002, 2005-2015 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify it | ||
5 | under the terms of the GNU Lesser General Public License as published | ||
6 | by the Free Software Foundation; either version 2.1 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #ifndef _UNISTR_H | ||
18 | #define _UNISTR_H | ||
19 | |||
20 | #include "unitypes.h" | ||
21 | |||
22 | /* Get common macros for C. */ | ||
23 | #include "unused-parameter.h" | ||
24 | |||
25 | /* Get bool. */ | ||
26 | #include <stdbool.h> | ||
27 | |||
28 | /* Get size_t. */ | ||
29 | #include <stddef.h> | ||
30 | |||
31 | #ifdef __cplusplus | ||
32 | extern "C" { | ||
33 | #endif | ||
34 | |||
35 | |||
36 | /* Conventions: | ||
37 | |||
38 | All functions prefixed with u8_ operate on UTF-8 encoded strings. | ||
39 | Their unit is an uint8_t (1 byte). | ||
40 | |||
41 | All functions prefixed with u16_ operate on UTF-16 encoded strings. | ||
42 | Their unit is an uint16_t (a 2-byte word). | ||
43 | |||
44 | All functions prefixed with u32_ operate on UCS-4 encoded strings. | ||
45 | Their unit is an uint32_t (a 4-byte word). | ||
46 | |||
47 | All argument pairs (s, n) denote a Unicode string s[0..n-1] with exactly | ||
48 | n units. | ||
49 | |||
50 | All arguments starting with "str" and the arguments of functions starting | ||
51 | with u8_str/u16_str/u32_str denote a NUL terminated string, i.e. a string | ||
52 | which terminates at the first NUL unit. This termination unit is | ||
53 | considered part of the string for all memory allocation purposes, but | ||
54 | is not considered part of the string for all other logical purposes. | ||
55 | |||
56 | Functions returning a string result take a (resultbuf, lengthp) argument | ||
57 | pair. If resultbuf is not NULL and the result fits into *lengthp units, | ||
58 | it is put in resultbuf, and resultbuf is returned. Otherwise, a freshly | ||
59 | allocated string is returned. In both cases, *lengthp is set to the | ||
60 | length (number of units) of the returned string. In case of error, | ||
61 | NULL is returned and errno is set. */ | ||
62 | |||
63 | |||
64 | /* Elementary string checks. */ | ||
65 | |||
66 | /* Check whether an UTF-8 string is well-formed. | ||
67 | Return NULL if valid, or a pointer to the first invalid unit otherwise. */ | ||
68 | extern const uint8_t * | ||
69 | u8_check (const uint8_t *s, size_t n) | ||
70 | _UC_ATTRIBUTE_PURE; | ||
71 | |||
72 | /* Check whether an UTF-16 string is well-formed. | ||
73 | Return NULL if valid, or a pointer to the first invalid unit otherwise. */ | ||
74 | extern const uint16_t * | ||
75 | u16_check (const uint16_t *s, size_t n) | ||
76 | _UC_ATTRIBUTE_PURE; | ||
77 | |||
78 | /* Check whether an UCS-4 string is well-formed. | ||
79 | Return NULL if valid, or a pointer to the first invalid unit otherwise. */ | ||
80 | extern const uint32_t * | ||
81 | u32_check (const uint32_t *s, size_t n) | ||
82 | _UC_ATTRIBUTE_PURE; | ||
83 | |||
84 | |||
85 | /* Elementary string conversions. */ | ||
86 | |||
87 | /* Convert an UTF-8 string to an UTF-16 string. */ | ||
88 | extern uint16_t * | ||
89 | u8_to_u16 (const uint8_t *s, size_t n, uint16_t *resultbuf, | ||
90 | size_t *lengthp); | ||
91 | |||
92 | /* Convert an UTF-8 string to an UCS-4 string. */ | ||
93 | extern uint32_t * | ||
94 | u8_to_u32 (const uint8_t *s, size_t n, uint32_t *resultbuf, | ||
95 | size_t *lengthp); | ||
96 | |||
97 | /* Convert an UTF-16 string to an UTF-8 string. */ | ||
98 | extern uint8_t * | ||
99 | u16_to_u8 (const uint16_t *s, size_t n, uint8_t *resultbuf, | ||
100 | size_t *lengthp); | ||
101 | |||
102 | /* Convert an UTF-16 string to an UCS-4 string. */ | ||
103 | extern uint32_t * | ||
104 | u16_to_u32 (const uint16_t *s, size_t n, uint32_t *resultbuf, | ||
105 | size_t *lengthp); | ||
106 | |||
107 | /* Convert an UCS-4 string to an UTF-8 string. */ | ||
108 | extern uint8_t * | ||
109 | u32_to_u8 (const uint32_t *s, size_t n, uint8_t *resultbuf, | ||
110 | size_t *lengthp); | ||
111 | |||
112 | /* Convert an UCS-4 string to an UTF-16 string. */ | ||
113 | extern uint16_t * | ||
114 | u32_to_u16 (const uint32_t *s, size_t n, uint16_t *resultbuf, | ||
115 | size_t *lengthp); | ||
116 | |||
117 | |||
118 | /* Elementary string functions. */ | ||
119 | |||
120 | /* Return the length (number of units) of the first character in S, which is | ||
121 | no longer than N. Return 0 if it is the NUL character. Return -1 upon | ||
122 | failure. */ | ||
123 | /* Similar to mblen(), except that s must not be NULL. */ | ||
124 | extern int | ||
125 | u8_mblen (const uint8_t *s, size_t n) | ||
126 | _UC_ATTRIBUTE_PURE; | ||
127 | extern int | ||
128 | u16_mblen (const uint16_t *s, size_t n) | ||
129 | _UC_ATTRIBUTE_PURE; | ||
130 | extern int | ||
131 | u32_mblen (const uint32_t *s, size_t n) | ||
132 | _UC_ATTRIBUTE_PURE; | ||
133 | |||
134 | /* Return the length (number of units) of the first character in S, putting | ||
135 | its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd, | ||
136 | and an appropriate number of units is returned. | ||
137 | The number of available units, N, must be > 0. */ | ||
138 | /* Similar to mbtowc(), except that puc and s must not be NULL, n must be > 0, | ||
139 | and the NUL character is not treated specially. */ | ||
140 | /* The variants with _safe suffix are safe, even if the library is compiled | ||
141 | without --enable-safety. */ | ||
142 | |||
143 | #if GNULIB_UNISTR_U8_MBTOUC_UNSAFE || HAVE_LIBUNISTRING | ||
144 | # if !HAVE_INLINE | ||
145 | extern int | ||
146 | u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n); | ||
147 | # else | ||
148 | extern int | ||
149 | u8_mbtouc_unsafe_aux (ucs4_t *puc, const uint8_t *s, size_t n); | ||
150 | static inline int | ||
151 | u8_mbtouc_unsafe (ucs4_t *puc, const uint8_t *s, size_t n) | ||
152 | { | ||
153 | uint8_t c = *s; | ||
154 | |||
155 | if (c < 0x80) | ||
156 | { | ||
157 | *puc = c; | ||
158 | return 1; | ||
159 | } | ||
160 | else | ||
161 | return u8_mbtouc_unsafe_aux (puc, s, n); | ||
162 | } | ||
163 | # endif | ||
164 | #endif | ||
165 | |||
166 | #if GNULIB_UNISTR_U16_MBTOUC_UNSAFE || HAVE_LIBUNISTRING | ||
167 | # if !HAVE_INLINE | ||
168 | extern int | ||
169 | u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n); | ||
170 | # else | ||
171 | extern int | ||
172 | u16_mbtouc_unsafe_aux (ucs4_t *puc, const uint16_t *s, size_t n); | ||
173 | static inline int | ||
174 | u16_mbtouc_unsafe (ucs4_t *puc, const uint16_t *s, size_t n) | ||
175 | { | ||
176 | uint16_t c = *s; | ||
177 | |||
178 | if (c < 0xd800 || c >= 0xe000) | ||
179 | { | ||
180 | *puc = c; | ||
181 | return 1; | ||
182 | } | ||
183 | else | ||
184 | return u16_mbtouc_unsafe_aux (puc, s, n); | ||
185 | } | ||
186 | # endif | ||
187 | #endif | ||
188 | |||
189 | #if GNULIB_UNISTR_U32_MBTOUC_UNSAFE || HAVE_LIBUNISTRING | ||
190 | # if !HAVE_INLINE | ||
191 | extern int | ||
192 | u32_mbtouc_unsafe (ucs4_t *puc, const uint32_t *s, size_t n); | ||
193 | # else | ||
194 | static inline int | ||
195 | u32_mbtouc_unsafe (ucs4_t *puc, | ||
196 | const uint32_t *s, size_t n _GL_UNUSED_PARAMETER) | ||
197 | { | ||
198 | uint32_t c = *s; | ||
199 | |||
200 | # if CONFIG_UNICODE_SAFETY | ||
201 | if (c < 0xd800 || (c >= 0xe000 && c < 0x110000)) | ||
202 | # endif | ||
203 | *puc = c; | ||
204 | # if CONFIG_UNICODE_SAFETY | ||
205 | else | ||
206 | /* invalid multibyte character */ | ||
207 | *puc = 0xfffd; | ||
208 | # endif | ||
209 | return 1; | ||
210 | } | ||
211 | # endif | ||
212 | #endif | ||
213 | |||
214 | #if GNULIB_UNISTR_U8_MBTOUC || HAVE_LIBUNISTRING | ||
215 | # if !HAVE_INLINE | ||
216 | extern int | ||
217 | u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n); | ||
218 | # else | ||
219 | extern int | ||
220 | u8_mbtouc_aux (ucs4_t *puc, const uint8_t *s, size_t n); | ||
221 | static inline int | ||
222 | u8_mbtouc (ucs4_t *puc, const uint8_t *s, size_t n) | ||
223 | { | ||
224 | uint8_t c = *s; | ||
225 | |||
226 | if (c < 0x80) | ||
227 | { | ||
228 | *puc = c; | ||
229 | return 1; | ||
230 | } | ||
231 | else | ||
232 | return u8_mbtouc_aux (puc, s, n); | ||
233 | } | ||
234 | # endif | ||
235 | #endif | ||
236 | |||
237 | #if GNULIB_UNISTR_U16_MBTOUC || HAVE_LIBUNISTRING | ||
238 | # if !HAVE_INLINE | ||
239 | extern int | ||
240 | u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n); | ||
241 | # else | ||
242 | extern int | ||
243 | u16_mbtouc_aux (ucs4_t *puc, const uint16_t *s, size_t n); | ||
244 | static inline int | ||
245 | u16_mbtouc (ucs4_t *puc, const uint16_t *s, size_t n) | ||
246 | { | ||
247 | uint16_t c = *s; | ||
248 | |||
249 | if (c < 0xd800 || c >= 0xe000) | ||
250 | { | ||
251 | *puc = c; | ||
252 | return 1; | ||
253 | } | ||
254 | else | ||
255 | return u16_mbtouc_aux (puc, s, n); | ||
256 | } | ||
257 | # endif | ||
258 | #endif | ||
259 | |||
260 | #if GNULIB_UNISTR_U32_MBTOUC || HAVE_LIBUNISTRING | ||
261 | # if !HAVE_INLINE | ||
262 | extern int | ||
263 | u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n); | ||
264 | # else | ||
265 | static inline int | ||
266 | u32_mbtouc (ucs4_t *puc, const uint32_t *s, size_t n _GL_UNUSED_PARAMETER) | ||
267 | { | ||
268 | uint32_t c = *s; | ||
269 | |||
270 | if (c < 0xd800 || (c >= 0xe000 && c < 0x110000)) | ||
271 | *puc = c; | ||
272 | else | ||
273 | /* invalid multibyte character */ | ||
274 | *puc = 0xfffd; | ||
275 | return 1; | ||
276 | } | ||
277 | # endif | ||
278 | #endif | ||
279 | |||
280 | /* Return the length (number of units) of the first character in S, putting | ||
281 | its 'ucs4_t' representation in *PUC. Upon failure, *PUC is set to 0xfffd, | ||
282 | and -1 is returned for an invalid sequence of units, -2 is returned for an | ||
283 | incomplete sequence of units. | ||
284 | The number of available units, N, must be > 0. */ | ||
285 | /* Similar to u*_mbtouc(), except that the return value gives more details | ||
286 | about the failure, similar to mbrtowc(). */ | ||
287 | |||
288 | #if GNULIB_UNISTR_U8_MBTOUCR || HAVE_LIBUNISTRING | ||
289 | extern int | ||
290 | u8_mbtoucr (ucs4_t *puc, const uint8_t *s, size_t n); | ||
291 | #endif | ||
292 | |||
293 | #if GNULIB_UNISTR_U16_MBTOUCR || HAVE_LIBUNISTRING | ||
294 | extern int | ||
295 | u16_mbtoucr (ucs4_t *puc, const uint16_t *s, size_t n); | ||
296 | #endif | ||
297 | |||
298 | #if GNULIB_UNISTR_U32_MBTOUCR || HAVE_LIBUNISTRING | ||
299 | extern int | ||
300 | u32_mbtoucr (ucs4_t *puc, const uint32_t *s, size_t n); | ||
301 | #endif | ||
302 | |||
303 | /* Put the multibyte character represented by UC in S, returning its | ||
304 | length. Return -1 upon failure, -2 if the number of available units, N, | ||
305 | is too small. The latter case cannot occur if N >= 6/2/1, respectively. */ | ||
306 | /* Similar to wctomb(), except that s must not be NULL, and the argument n | ||
307 | must be specified. */ | ||
308 | |||
309 | #if GNULIB_UNISTR_U8_UCTOMB || HAVE_LIBUNISTRING | ||
310 | /* Auxiliary function, also used by u8_chr, u8_strchr, u8_strrchr. */ | ||
311 | extern int | ||
312 | u8_uctomb_aux (uint8_t *s, ucs4_t uc, int n); | ||
313 | # if !HAVE_INLINE | ||
314 | extern int | ||
315 | u8_uctomb (uint8_t *s, ucs4_t uc, int n); | ||
316 | # else | ||
317 | static inline int | ||
318 | u8_uctomb (uint8_t *s, ucs4_t uc, int n) | ||
319 | { | ||
320 | if (uc < 0x80 && n > 0) | ||
321 | { | ||
322 | s[0] = uc; | ||
323 | return 1; | ||
324 | } | ||
325 | else | ||
326 | return u8_uctomb_aux (s, uc, n); | ||
327 | } | ||
328 | # endif | ||
329 | #endif | ||
330 | |||
331 | #if GNULIB_UNISTR_U16_UCTOMB || HAVE_LIBUNISTRING | ||
332 | /* Auxiliary function, also used by u16_chr, u16_strchr, u16_strrchr. */ | ||
333 | extern int | ||
334 | u16_uctomb_aux (uint16_t *s, ucs4_t uc, int n); | ||
335 | # if !HAVE_INLINE | ||
336 | extern int | ||
337 | u16_uctomb (uint16_t *s, ucs4_t uc, int n); | ||
338 | # else | ||
339 | static inline int | ||
340 | u16_uctomb (uint16_t *s, ucs4_t uc, int n) | ||
341 | { | ||
342 | if (uc < 0xd800 && n > 0) | ||
343 | { | ||
344 | s[0] = uc; | ||
345 | return 1; | ||
346 | } | ||
347 | else | ||
348 | return u16_uctomb_aux (s, uc, n); | ||
349 | } | ||
350 | # endif | ||
351 | #endif | ||
352 | |||
353 | #if GNULIB_UNISTR_U32_UCTOMB || HAVE_LIBUNISTRING | ||
354 | # if !HAVE_INLINE | ||
355 | extern int | ||
356 | u32_uctomb (uint32_t *s, ucs4_t uc, int n); | ||
357 | # else | ||
358 | static inline int | ||
359 | u32_uctomb (uint32_t *s, ucs4_t uc, int n) | ||
360 | { | ||
361 | if (uc < 0xd800 || (uc >= 0xe000 && uc < 0x110000)) | ||
362 | { | ||
363 | if (n > 0) | ||
364 | { | ||
365 | *s = uc; | ||
366 | return 1; | ||
367 | } | ||
368 | else | ||
369 | return -2; | ||
370 | } | ||
371 | else | ||
372 | return -1; | ||
373 | } | ||
374 | # endif | ||
375 | #endif | ||
376 | |||
377 | /* Copy N units from SRC to DEST. */ | ||
378 | /* Similar to memcpy(). */ | ||
379 | extern uint8_t * | ||
380 | u8_cpy (uint8_t *dest, const uint8_t *src, size_t n); | ||
381 | extern uint16_t * | ||
382 | u16_cpy (uint16_t *dest, const uint16_t *src, size_t n); | ||
383 | extern uint32_t * | ||
384 | u32_cpy (uint32_t *dest, const uint32_t *src, size_t n); | ||
385 | |||
386 | /* Copy N units from SRC to DEST, guaranteeing correct behavior for | ||
387 | overlapping memory areas. */ | ||
388 | /* Similar to memmove(). */ | ||
389 | extern uint8_t * | ||
390 | u8_move (uint8_t *dest, const uint8_t *src, size_t n); | ||
391 | extern uint16_t * | ||
392 | u16_move (uint16_t *dest, const uint16_t *src, size_t n); | ||
393 | extern uint32_t * | ||
394 | u32_move (uint32_t *dest, const uint32_t *src, size_t n); | ||
395 | |||
396 | /* Set the first N characters of S to UC. UC should be a character that | ||
397 | occupies only 1 unit. */ | ||
398 | /* Similar to memset(). */ | ||
399 | extern uint8_t * | ||
400 | u8_set (uint8_t *s, ucs4_t uc, size_t n); | ||
401 | extern uint16_t * | ||
402 | u16_set (uint16_t *s, ucs4_t uc, size_t n); | ||
403 | extern uint32_t * | ||
404 | u32_set (uint32_t *s, ucs4_t uc, size_t n); | ||
405 | |||
406 | /* Compare S1 and S2, each of length N. */ | ||
407 | /* Similar to memcmp(). */ | ||
408 | extern int | ||
409 | u8_cmp (const uint8_t *s1, const uint8_t *s2, size_t n) | ||
410 | _UC_ATTRIBUTE_PURE; | ||
411 | extern int | ||
412 | u16_cmp (const uint16_t *s1, const uint16_t *s2, size_t n) | ||
413 | _UC_ATTRIBUTE_PURE; | ||
414 | extern int | ||
415 | u32_cmp (const uint32_t *s1, const uint32_t *s2, size_t n) | ||
416 | _UC_ATTRIBUTE_PURE; | ||
417 | |||
418 | /* Compare S1 and S2. */ | ||
419 | /* Similar to the gnulib function memcmp2(). */ | ||
420 | extern int | ||
421 | u8_cmp2 (const uint8_t *s1, size_t n1, const uint8_t *s2, size_t n2) | ||
422 | _UC_ATTRIBUTE_PURE; | ||
423 | extern int | ||
424 | u16_cmp2 (const uint16_t *s1, size_t n1, const uint16_t *s2, size_t n2) | ||
425 | _UC_ATTRIBUTE_PURE; | ||
426 | extern int | ||
427 | u32_cmp2 (const uint32_t *s1, size_t n1, const uint32_t *s2, size_t n2) | ||
428 | _UC_ATTRIBUTE_PURE; | ||
429 | |||
430 | /* Search the string at S for UC. */ | ||
431 | /* Similar to memchr(). */ | ||
432 | extern uint8_t * | ||
433 | u8_chr (const uint8_t *s, size_t n, ucs4_t uc) | ||
434 | _UC_ATTRIBUTE_PURE; | ||
435 | extern uint16_t * | ||
436 | u16_chr (const uint16_t *s, size_t n, ucs4_t uc) | ||
437 | _UC_ATTRIBUTE_PURE; | ||
438 | extern uint32_t * | ||
439 | u32_chr (const uint32_t *s, size_t n, ucs4_t uc) | ||
440 | _UC_ATTRIBUTE_PURE; | ||
441 | |||
442 | /* Count the number of Unicode characters in the N units from S. */ | ||
443 | /* Similar to mbsnlen(). */ | ||
444 | extern size_t | ||
445 | u8_mbsnlen (const uint8_t *s, size_t n) | ||
446 | _UC_ATTRIBUTE_PURE; | ||
447 | extern size_t | ||
448 | u16_mbsnlen (const uint16_t *s, size_t n) | ||
449 | _UC_ATTRIBUTE_PURE; | ||
450 | extern size_t | ||
451 | u32_mbsnlen (const uint32_t *s, size_t n) | ||
452 | _UC_ATTRIBUTE_PURE; | ||
453 | |||
454 | /* Elementary string functions with memory allocation. */ | ||
455 | |||
456 | /* Make a freshly allocated copy of S, of length N. */ | ||
457 | extern uint8_t * | ||
458 | u8_cpy_alloc (const uint8_t *s, size_t n); | ||
459 | extern uint16_t * | ||
460 | u16_cpy_alloc (const uint16_t *s, size_t n); | ||
461 | extern uint32_t * | ||
462 | u32_cpy_alloc (const uint32_t *s, size_t n); | ||
463 | |||
464 | /* Elementary string functions on NUL terminated strings. */ | ||
465 | |||
466 | /* Return the length (number of units) of the first character in S. | ||
467 | Return 0 if it is the NUL character. Return -1 upon failure. */ | ||
468 | extern int | ||
469 | u8_strmblen (const uint8_t *s) | ||
470 | _UC_ATTRIBUTE_PURE; | ||
471 | extern int | ||
472 | u16_strmblen (const uint16_t *s) | ||
473 | _UC_ATTRIBUTE_PURE; | ||
474 | extern int | ||
475 | u32_strmblen (const uint32_t *s) | ||
476 | _UC_ATTRIBUTE_PURE; | ||
477 | |||
478 | /* Return the length (number of units) of the first character in S, putting | ||
479 | its 'ucs4_t' representation in *PUC. Return 0 if it is the NUL | ||
480 | character. Return -1 upon failure. */ | ||
481 | extern int | ||
482 | u8_strmbtouc (ucs4_t *puc, const uint8_t *s); | ||
483 | extern int | ||
484 | u16_strmbtouc (ucs4_t *puc, const uint16_t *s); | ||
485 | extern int | ||
486 | u32_strmbtouc (ucs4_t *puc, const uint32_t *s); | ||
487 | |||
488 | /* Forward iteration step. Advances the pointer past the next character, | ||
489 | or returns NULL if the end of the string has been reached. Puts the | ||
490 | character's 'ucs4_t' representation in *PUC. */ | ||
491 | extern const uint8_t * | ||
492 | u8_next (ucs4_t *puc, const uint8_t *s); | ||
493 | extern const uint16_t * | ||
494 | u16_next (ucs4_t *puc, const uint16_t *s); | ||
495 | extern const uint32_t * | ||
496 | u32_next (ucs4_t *puc, const uint32_t *s); | ||
497 | |||
498 | /* Backward iteration step. Advances the pointer to point to the previous | ||
499 | character, or returns NULL if the beginning of the string had been reached. | ||
500 | Puts the character's 'ucs4_t' representation in *PUC. */ | ||
501 | extern const uint8_t * | ||
502 | u8_prev (ucs4_t *puc, const uint8_t *s, const uint8_t *start); | ||
503 | extern const uint16_t * | ||
504 | u16_prev (ucs4_t *puc, const uint16_t *s, const uint16_t *start); | ||
505 | extern const uint32_t * | ||
506 | u32_prev (ucs4_t *puc, const uint32_t *s, const uint32_t *start); | ||
507 | |||
508 | /* Return the number of units in S. */ | ||
509 | /* Similar to strlen(), wcslen(). */ | ||
510 | extern size_t | ||
511 | u8_strlen (const uint8_t *s) | ||
512 | _UC_ATTRIBUTE_PURE; | ||
513 | extern size_t | ||
514 | u16_strlen (const uint16_t *s) | ||
515 | _UC_ATTRIBUTE_PURE; | ||
516 | extern size_t | ||
517 | u32_strlen (const uint32_t *s) | ||
518 | _UC_ATTRIBUTE_PURE; | ||
519 | |||
520 | /* Return the number of units in S, but at most MAXLEN. */ | ||
521 | /* Similar to strnlen(), wcsnlen(). */ | ||
522 | extern size_t | ||
523 | u8_strnlen (const uint8_t *s, size_t maxlen) | ||
524 | _UC_ATTRIBUTE_PURE; | ||
525 | extern size_t | ||
526 | u16_strnlen (const uint16_t *s, size_t maxlen) | ||
527 | _UC_ATTRIBUTE_PURE; | ||
528 | extern size_t | ||
529 | u32_strnlen (const uint32_t *s, size_t maxlen) | ||
530 | _UC_ATTRIBUTE_PURE; | ||
531 | |||
532 | /* Copy SRC to DEST. */ | ||
533 | /* Similar to strcpy(), wcscpy(). */ | ||
534 | extern uint8_t * | ||
535 | u8_strcpy (uint8_t *dest, const uint8_t *src); | ||
536 | extern uint16_t * | ||
537 | u16_strcpy (uint16_t *dest, const uint16_t *src); | ||
538 | extern uint32_t * | ||
539 | u32_strcpy (uint32_t *dest, const uint32_t *src); | ||
540 | |||
541 | /* Copy SRC to DEST, returning the address of the terminating NUL in DEST. */ | ||
542 | /* Similar to stpcpy(). */ | ||
543 | extern uint8_t * | ||
544 | u8_stpcpy (uint8_t *dest, const uint8_t *src); | ||
545 | extern uint16_t * | ||
546 | u16_stpcpy (uint16_t *dest, const uint16_t *src); | ||
547 | extern uint32_t * | ||
548 | u32_stpcpy (uint32_t *dest, const uint32_t *src); | ||
549 | |||
550 | /* Copy no more than N units of SRC to DEST. */ | ||
551 | /* Similar to strncpy(), wcsncpy(). */ | ||
552 | extern uint8_t * | ||
553 | u8_strncpy (uint8_t *dest, const uint8_t *src, size_t n); | ||
554 | extern uint16_t * | ||
555 | u16_strncpy (uint16_t *dest, const uint16_t *src, size_t n); | ||
556 | extern uint32_t * | ||
557 | u32_strncpy (uint32_t *dest, const uint32_t *src, size_t n); | ||
558 | |||
559 | /* Copy no more than N units of SRC to DEST. Return a pointer past the last | ||
560 | non-NUL unit written into DEST. */ | ||
561 | /* Similar to stpncpy(). */ | ||
562 | extern uint8_t * | ||
563 | u8_stpncpy (uint8_t *dest, const uint8_t *src, size_t n); | ||
564 | extern uint16_t * | ||
565 | u16_stpncpy (uint16_t *dest, const uint16_t *src, size_t n); | ||
566 | extern uint32_t * | ||
567 | u32_stpncpy (uint32_t *dest, const uint32_t *src, size_t n); | ||
568 | |||
569 | /* Append SRC onto DEST. */ | ||
570 | /* Similar to strcat(), wcscat(). */ | ||
571 | extern uint8_t * | ||
572 | u8_strcat (uint8_t *dest, const uint8_t *src); | ||
573 | extern uint16_t * | ||
574 | u16_strcat (uint16_t *dest, const uint16_t *src); | ||
575 | extern uint32_t * | ||
576 | u32_strcat (uint32_t *dest, const uint32_t *src); | ||
577 | |||
578 | /* Append no more than N units of SRC onto DEST. */ | ||
579 | /* Similar to strncat(), wcsncat(). */ | ||
580 | extern uint8_t * | ||
581 | u8_strncat (uint8_t *dest, const uint8_t *src, size_t n); | ||
582 | extern uint16_t * | ||
583 | u16_strncat (uint16_t *dest, const uint16_t *src, size_t n); | ||
584 | extern uint32_t * | ||
585 | u32_strncat (uint32_t *dest, const uint32_t *src, size_t n); | ||
586 | |||
587 | /* Compare S1 and S2. */ | ||
588 | /* Similar to strcmp(), wcscmp(). */ | ||
589 | #ifdef __sun | ||
590 | /* Avoid a collision with the u8_strcmp() function in Solaris 11 libc. */ | ||
591 | extern int | ||
592 | u8_strcmp_gnu (const uint8_t *s1, const uint8_t *s2) | ||
593 | _UC_ATTRIBUTE_PURE; | ||
594 | # define u8_strcmp u8_strcmp_gnu | ||
595 | #else | ||
596 | extern int | ||
597 | u8_strcmp (const uint8_t *s1, const uint8_t *s2) | ||
598 | _UC_ATTRIBUTE_PURE; | ||
599 | #endif | ||
600 | extern int | ||
601 | u16_strcmp (const uint16_t *s1, const uint16_t *s2) | ||
602 | _UC_ATTRIBUTE_PURE; | ||
603 | extern int | ||
604 | u32_strcmp (const uint32_t *s1, const uint32_t *s2) | ||
605 | _UC_ATTRIBUTE_PURE; | ||
606 | |||
607 | /* Compare S1 and S2 using the collation rules of the current locale. | ||
608 | Return -1 if S1 < S2, 0 if S1 = S2, 1 if S1 > S2. | ||
609 | Upon failure, set errno and return any value. */ | ||
610 | /* Similar to strcoll(), wcscoll(). */ | ||
611 | extern int | ||
612 | u8_strcoll (const uint8_t *s1, const uint8_t *s2); | ||
613 | extern int | ||
614 | u16_strcoll (const uint16_t *s1, const uint16_t *s2); | ||
615 | extern int | ||
616 | u32_strcoll (const uint32_t *s1, const uint32_t *s2); | ||
617 | |||
618 | /* Compare no more than N units of S1 and S2. */ | ||
619 | /* Similar to strncmp(), wcsncmp(). */ | ||
620 | extern int | ||
621 | u8_strncmp (const uint8_t *s1, const uint8_t *s2, size_t n) | ||
622 | _UC_ATTRIBUTE_PURE; | ||
623 | extern int | ||
624 | u16_strncmp (const uint16_t *s1, const uint16_t *s2, size_t n) | ||
625 | _UC_ATTRIBUTE_PURE; | ||
626 | extern int | ||
627 | u32_strncmp (const uint32_t *s1, const uint32_t *s2, size_t n) | ||
628 | _UC_ATTRIBUTE_PURE; | ||
629 | |||
630 | /* Duplicate S, returning an identical malloc'd string. */ | ||
631 | /* Similar to strdup(), wcsdup(). */ | ||
632 | extern uint8_t * | ||
633 | u8_strdup (const uint8_t *s); | ||
634 | extern uint16_t * | ||
635 | u16_strdup (const uint16_t *s); | ||
636 | extern uint32_t * | ||
637 | u32_strdup (const uint32_t *s); | ||
638 | |||
639 | /* Find the first occurrence of UC in STR. */ | ||
640 | /* Similar to strchr(), wcschr(). */ | ||
641 | extern uint8_t * | ||
642 | u8_strchr (const uint8_t *str, ucs4_t uc) | ||
643 | _UC_ATTRIBUTE_PURE; | ||
644 | extern uint16_t * | ||
645 | u16_strchr (const uint16_t *str, ucs4_t uc) | ||
646 | _UC_ATTRIBUTE_PURE; | ||
647 | extern uint32_t * | ||
648 | u32_strchr (const uint32_t *str, ucs4_t uc) | ||
649 | _UC_ATTRIBUTE_PURE; | ||
650 | |||
651 | /* Find the last occurrence of UC in STR. */ | ||
652 | /* Similar to strrchr(), wcsrchr(). */ | ||
653 | extern uint8_t * | ||
654 | u8_strrchr (const uint8_t *str, ucs4_t uc) | ||
655 | _UC_ATTRIBUTE_PURE; | ||
656 | extern uint16_t * | ||
657 | u16_strrchr (const uint16_t *str, ucs4_t uc) | ||
658 | _UC_ATTRIBUTE_PURE; | ||
659 | extern uint32_t * | ||
660 | u32_strrchr (const uint32_t *str, ucs4_t uc) | ||
661 | _UC_ATTRIBUTE_PURE; | ||
662 | |||
663 | /* Return the length of the initial segment of STR which consists entirely | ||
664 | of Unicode characters not in REJECT. */ | ||
665 | /* Similar to strcspn(), wcscspn(). */ | ||
666 | extern size_t | ||
667 | u8_strcspn (const uint8_t *str, const uint8_t *reject) | ||
668 | _UC_ATTRIBUTE_PURE; | ||
669 | extern size_t | ||
670 | u16_strcspn (const uint16_t *str, const uint16_t *reject) | ||
671 | _UC_ATTRIBUTE_PURE; | ||
672 | extern size_t | ||
673 | u32_strcspn (const uint32_t *str, const uint32_t *reject) | ||
674 | _UC_ATTRIBUTE_PURE; | ||
675 | |||
676 | /* Return the length of the initial segment of STR which consists entirely | ||
677 | of Unicode characters in ACCEPT. */ | ||
678 | /* Similar to strspn(), wcsspn(). */ | ||
679 | extern size_t | ||
680 | u8_strspn (const uint8_t *str, const uint8_t *accept) | ||
681 | _UC_ATTRIBUTE_PURE; | ||
682 | extern size_t | ||
683 | u16_strspn (const uint16_t *str, const uint16_t *accept) | ||
684 | _UC_ATTRIBUTE_PURE; | ||
685 | extern size_t | ||
686 | u32_strspn (const uint32_t *str, const uint32_t *accept) | ||
687 | _UC_ATTRIBUTE_PURE; | ||
688 | |||
689 | /* Find the first occurrence in STR of any character in ACCEPT. */ | ||
690 | /* Similar to strpbrk(), wcspbrk(). */ | ||
691 | extern uint8_t * | ||
692 | u8_strpbrk (const uint8_t *str, const uint8_t *accept) | ||
693 | _UC_ATTRIBUTE_PURE; | ||
694 | extern uint16_t * | ||
695 | u16_strpbrk (const uint16_t *str, const uint16_t *accept) | ||
696 | _UC_ATTRIBUTE_PURE; | ||
697 | extern uint32_t * | ||
698 | u32_strpbrk (const uint32_t *str, const uint32_t *accept) | ||
699 | _UC_ATTRIBUTE_PURE; | ||
700 | |||
701 | /* Find the first occurrence of NEEDLE in HAYSTACK. */ | ||
702 | /* Similar to strstr(), wcsstr(). */ | ||
703 | extern uint8_t * | ||
704 | u8_strstr (const uint8_t *haystack, const uint8_t *needle) | ||
705 | _UC_ATTRIBUTE_PURE; | ||
706 | extern uint16_t * | ||
707 | u16_strstr (const uint16_t *haystack, const uint16_t *needle) | ||
708 | _UC_ATTRIBUTE_PURE; | ||
709 | extern uint32_t * | ||
710 | u32_strstr (const uint32_t *haystack, const uint32_t *needle) | ||
711 | _UC_ATTRIBUTE_PURE; | ||
712 | |||
713 | /* Test whether STR starts with PREFIX. */ | ||
714 | extern bool | ||
715 | u8_startswith (const uint8_t *str, const uint8_t *prefix) | ||
716 | _UC_ATTRIBUTE_PURE; | ||
717 | extern bool | ||
718 | u16_startswith (const uint16_t *str, const uint16_t *prefix) | ||
719 | _UC_ATTRIBUTE_PURE; | ||
720 | extern bool | ||
721 | u32_startswith (const uint32_t *str, const uint32_t *prefix) | ||
722 | _UC_ATTRIBUTE_PURE; | ||
723 | |||
724 | /* Test whether STR ends with SUFFIX. */ | ||
725 | extern bool | ||
726 | u8_endswith (const uint8_t *str, const uint8_t *suffix) | ||
727 | _UC_ATTRIBUTE_PURE; | ||
728 | extern bool | ||
729 | u16_endswith (const uint16_t *str, const uint16_t *suffix) | ||
730 | _UC_ATTRIBUTE_PURE; | ||
731 | extern bool | ||
732 | u32_endswith (const uint32_t *str, const uint32_t *suffix) | ||
733 | _UC_ATTRIBUTE_PURE; | ||
734 | |||
735 | /* Divide STR into tokens separated by characters in DELIM. | ||
736 | This interface is actually more similar to wcstok than to strtok. */ | ||
737 | /* Similar to strtok_r(), wcstok(). */ | ||
738 | extern uint8_t * | ||
739 | u8_strtok (uint8_t *str, const uint8_t *delim, uint8_t **ptr); | ||
740 | extern uint16_t * | ||
741 | u16_strtok (uint16_t *str, const uint16_t *delim, uint16_t **ptr); | ||
742 | extern uint32_t * | ||
743 | u32_strtok (uint32_t *str, const uint32_t *delim, uint32_t **ptr); | ||
744 | |||
745 | |||
746 | #ifdef __cplusplus | ||
747 | } | ||
748 | #endif | ||
749 | |||
750 | #endif /* _UNISTR_H */ | ||
diff --git a/3rdParty/LibIDN/src/gl/unistr/u8-check.c b/3rdParty/LibIDN/src/gl/unistr/u8-check.c new file mode 100644 index 0000000..0e87f11 --- /dev/null +++ b/3rdParty/LibIDN/src/gl/unistr/u8-check.c | |||
@@ -0,0 +1,105 @@ | |||
1 | /* Check UTF-8 string. | ||
2 | Copyright (C) 2002, 2006-2007, 2009-2015 Free Software Foundation, Inc. | ||
3 | Written by Bruno Haible <bruno@clisp.org>, 2002. | ||
4 | |||
5 | This program is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Lesser General Public License as published | ||
7 | by the Free Software Foundation; either version 2.1 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
17 | |||
18 | #include <config.h> | ||
19 | |||
20 | /* Specification. */ | ||
21 | #include "unistr.h" | ||
22 | |||
23 | const uint8_t * | ||
24 | u8_check (const uint8_t *s, size_t n) | ||
25 | { | ||
26 | const uint8_t *s_end = s + n; | ||
27 | |||
28 | while (s < s_end) | ||
29 | { | ||
30 | /* Keep in sync with unistr.h and u8-mbtouc-aux.c. */ | ||
31 | uint8_t c = *s; | ||
32 | |||
33 | if (c < 0x80) | ||
34 | { | ||
35 | s++; | ||
36 | continue; | ||
37 | } | ||
38 | if (c >= 0xc2) | ||
39 | { | ||
40 | if (c < 0xe0) | ||
41 | { | ||
42 | if (s + 2 <= s_end | ||
43 | && (s[1] ^ 0x80) < 0x40) | ||
44 | { | ||
45 | s += 2; | ||
46 | continue; | ||
47 | } | ||
48 | } | ||
49 | else if (c < 0xf0) | ||
50 | { | ||
51 | if (s + 3 <= s_end | ||
52 | && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 | ||
53 | && (c >= 0xe1 || s[1] >= 0xa0) | ||
54 | && (c != 0xed || s[1] < 0xa0)) | ||
55 | { | ||
56 | s += 3; | ||
57 | continue; | ||
58 | } | ||
59 | } | ||
60 | else if (c < 0xf8) | ||
61 | { | ||
62 | if (s + 4 <= s_end | ||
63 | && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 | ||
64 | && (s[3] ^ 0x80) < 0x40 | ||
65 | && (c >= 0xf1 || s[1] >= 0x90) | ||
66 | #if 1 | ||
67 | && (c < 0xf4 || (c == 0xf4 && s[1] < 0x90)) | ||
68 | #endif | ||
69 | ) | ||
70 | { | ||
71 | s += 4; | ||
72 | continue; | ||
73 | } | ||
74 | } | ||
75 | #if 0 | ||
76 | else if (c < 0xfc) | ||
77 | { | ||
78 | if (s + 5 <= s_end | ||
79 | && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 | ||
80 | && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 | ||
81 | && (c >= 0xf9 || s[1] >= 0x88)) | ||
82 | { | ||
83 | s += 5; | ||
84 | continue; | ||
85 | } | ||
86 | } | ||
87 | else if (c < 0xfe) | ||
88 | { | ||
89 | if (s + 6 <= s_end | ||
90 | && (s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 | ||
91 | && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 | ||
92 | && (s[5] ^ 0x80) < 0x40 | ||
93 | && (c >= 0xfd || s[1] >= 0x84)) | ||
94 | { | ||
95 | s += 6; | ||
96 | continue; | ||
97 | } | ||
98 | } | ||
99 | #endif | ||
100 | } | ||
101 | /* invalid or incomplete multibyte character */ | ||
102 | return s; | ||
103 | } | ||
104 | return NULL; | ||
105 | } | ||
diff --git a/3rdParty/LibIDN/src/gl/unitypes.h b/3rdParty/LibIDN/src/gl/unitypes.h new file mode 100644 index 0000000..21c0c3e --- /dev/null +++ b/3rdParty/LibIDN/src/gl/unitypes.h | |||
@@ -0,0 +1,46 @@ | |||
1 | /* Elementary types and macros for the GNU UniString library. | ||
2 | Copyright (C) 2002, 2005-2006, 2009-2015 Free Software Foundation, Inc. | ||
3 | |||
4 | This program is free software: you can redistribute it and/or modify it | ||
5 | under the terms of the GNU Lesser General Public License as published | ||
6 | by the Free Software Foundation; either version 2.1 of the License, or | ||
7 | (at your option) any later version. | ||
8 | |||
9 | This program is distributed in the hope that it will be useful, | ||
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | Lesser General Public License for more details. | ||
13 | |||
14 | You should have received a copy of the GNU Lesser General Public License | ||
15 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | ||
16 | |||
17 | #ifndef _UNITYPES_H | ||
18 | #define _UNITYPES_H | ||
19 | |||
20 | /* Get uint8_t, uint16_t, uint32_t. */ | ||
21 | #include <stdint.h> | ||
22 | |||
23 | /* Type representing a Unicode character. */ | ||
24 | typedef uint32_t ucs4_t; | ||
25 | |||
26 | /* Attribute of a function whose result depends only on the arguments | ||
27 | (not pointers!) and which has no side effects. */ | ||
28 | #ifndef _UC_ATTRIBUTE_CONST | ||
29 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) | ||
30 | # define _UC_ATTRIBUTE_CONST __attribute__ ((__const__)) | ||
31 | # else | ||
32 | # define _UC_ATTRIBUTE_CONST | ||
33 | # endif | ||
34 | #endif | ||
35 | |||
36 | /* Attribute of a function whose result depends only on the arguments | ||
37 | (possibly pointers) and global memory, and which has no side effects. */ | ||
38 | #ifndef _UC_ATTRIBUTE_PURE | ||
39 | # if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96) | ||
40 | # define _UC_ATTRIBUTE_PURE __attribute__ ((__pure__)) | ||
41 | # else | ||
42 | # define _UC_ATTRIBUTE_PURE | ||
43 | # endif | ||
44 | #endif | ||
45 | |||
46 | #endif /* _UNITYPES_H */ | ||
diff --git a/3rdParty/LibIDN/src/gunicomp.h b/3rdParty/LibIDN/src/gunicomp.h index b5fa880..8e61cb1 100644 --- a/3rdParty/LibIDN/src/gunicomp.h +++ b/3rdParty/LibIDN/src/gunicomp.h | |||
@@ -1,7 +1,8 @@ | |||
1 | /* This file is automatically generated. DO NOT EDIT! | 1 | /* This file is automatically generated. DO NOT EDIT! |
2 | Instead, edit gen-unicode-tables.pl and re-run. */ | 2 | Instead, edit gen-unicode-tables.pl and re-run. |
3 | Note that gen-unicode-tables.pl doesn't work with Perl 5.10 or later.. */ | ||
3 | 4 | ||
4 | #define COMPOSE_FIRST_START 1 | 5 | #define COMPOSE_FIRST_START 1 |
5 | #define COMPOSE_FIRST_SINGLE_START 147 | 6 | #define COMPOSE_FIRST_SINGLE_START 147 |
6 | #define COMPOSE_SECOND_START 357 | 7 | #define COMPOSE_SECOND_START 357 |
7 | #define COMPOSE_SECOND_SINGLE_START 388 | 8 | #define COMPOSE_SECOND_SINGLE_START 388 |
diff --git a/3rdParty/LibIDN/src/gunidecomp.h b/3rdParty/LibIDN/src/gunidecomp.h index 1c48c21..a5ad7d7 100644 --- a/3rdParty/LibIDN/src/gunidecomp.h +++ b/3rdParty/LibIDN/src/gunidecomp.h | |||
@@ -1,7 +1,8 @@ | |||
1 | /* This file is automatically generated. DO NOT EDIT! | 1 | /* This file is automatically generated. DO NOT EDIT! |
2 | Instead, edit gen-unicode-tables.pl and re-run. */ | 2 | Instead, edit gen-unicode-tables.pl and re-run. |
3 | Note that gen-unicode-tables.pl doesn't work with Perl 5.10 or later.. */ | ||
3 | 4 | ||
4 | #ifndef DECOMP_H | 5 | #ifndef DECOMP_H |
5 | #define DECOMP_H | 6 | #define DECOMP_H |
6 | 7 | ||
7 | #define G_UNICODE_LAST_CHAR 0x10ffff | 8 | #define G_UNICODE_LAST_CHAR 0x10ffff |
diff --git a/3rdParty/LibIDN/src/idna.c b/3rdParty/LibIDN/src/idna.c index 8061086..5107d73 100644 --- a/3rdParty/LibIDN/src/idna.c +++ b/3rdParty/LibIDN/src/idna.c | |||
@@ -1,25 +1,33 @@ | |||
1 | /* idna.c --- Convert to or from IDN strings. | 1 | /* idna.c --- Prototypes for Internationalized Domain Name library. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | 3 | |
4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
5 | * | 5 | |
6 | * GNU Libidn is free software; you can redistribute it and/or | 6 | GNU Libidn is free software: you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of either: |
8 | * License as published by the Free Software Foundation; either | 8 | |
9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * the GNU Lesser General Public License as published by the Free |
10 | * | 10 | Software Foundation; either version 3 of the License, or (at |
11 | * GNU Libidn is distributed in the hope that it will be useful, | 11 | your option) any later version. |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | or |
14 | * Lesser General Public License for more details. | 14 | |
15 | * | 15 | * the GNU General Public License as published by the Free |
16 | * You should have received a copy of the GNU Lesser General Public | 16 | Software Foundation; either version 2 of the License, or (at |
17 | * License along with GNU Libidn; if not, write to the Free Software | 17 | your option) any later version. |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 18 | |
19 | * | 19 | or both in parallel, as here. |
20 | */ | 20 | |
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
21 | 29 | ||
22 | #ifdef HAVE_CONFIG_H | 30 | #ifdef HAVE_CONFIG_H |
23 | # include "config.h" | 31 | # include "config.h" |
24 | #endif | 32 | #endif |
25 | 33 | ||
@@ -28,17 +36,20 @@ | |||
28 | #include <stringprep.h> | 36 | #include <stringprep.h> |
29 | #include <punycode.h> | 37 | #include <punycode.h> |
30 | 38 | ||
31 | #include "idna.h" | 39 | #include "idna.h" |
32 | 40 | ||
41 | /* Get c_strcasecmp. */ | ||
42 | #include <c-strcase.h> | ||
43 | |||
33 | #define DOTP(c) ((c) == 0x002E || (c) == 0x3002 || \ | 44 | #define DOTP(c) ((c) == 0x002E || (c) == 0x3002 || \ |
34 | (c) == 0xFF0E || (c) == 0xFF61) | 45 | (c) == 0xFF0E || (c) == 0xFF61) |
35 | 46 | ||
36 | /* Core functions */ | 47 | /* Core functions */ |
37 | 48 | ||
38 | /** | 49 | /** |
39 | * idna_to_ascii_4i - convert Unicode domain name label to text | 50 | * idna_to_ascii_4i: |
40 | * @in: input array with unicode code points. | 51 | * @in: input array with unicode code points. |
41 | * @inlen: length of input array with unicode code points. | 52 | * @inlen: length of input array with unicode code points. |
42 | * @out: output zero terminated string that must have room for at | 53 | * @out: output zero terminated string that must have room for at |
43 | * least 63 characters plus the terminating zero. | 54 | * least 63 characters plus the terminating zero. |
44 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 55 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
@@ -107,11 +118,11 @@ idna_to_ascii_4i (const uint32_t * in, size_t inlen, char *out, int flags) | |||
107 | */ | 118 | */ |
108 | 119 | ||
109 | { | 120 | { |
110 | char *p; | 121 | char *p; |
111 | 122 | ||
112 | p = stringprep_ucs4_to_utf8 (in, inlen, NULL, NULL); | 123 | p = stringprep_ucs4_to_utf8 (in, (ssize_t) inlen, NULL, NULL); |
113 | if (p == NULL) | 124 | if (p == NULL) |
114 | return IDNA_MALLOC_ERROR; | 125 | return IDNA_MALLOC_ERROR; |
115 | 126 | ||
116 | len = strlen (p); | 127 | len = strlen (p); |
117 | do | 128 | do |
@@ -141,10 +152,13 @@ idna_to_ascii_4i (const uint32_t * in, size_t inlen, char *out, int flags) | |||
141 | } | 152 | } |
142 | 153 | ||
143 | src = stringprep_utf8_to_ucs4 (p, -1, NULL); | 154 | src = stringprep_utf8_to_ucs4 (p, -1, NULL); |
144 | 155 | ||
145 | free (p); | 156 | free (p); |
157 | |||
158 | if (!src) | ||
159 | return IDNA_MALLOC_ERROR; | ||
146 | } | 160 | } |
147 | 161 | ||
148 | step3: | 162 | step3: |
149 | /* | 163 | /* |
150 | * 3. If the UseSTD3ASCIIRules flag is set, then perform these checks: | 164 | * 3. If the UseSTD3ASCIIRules flag is set, then perform these checks: |
@@ -316,14 +330,16 @@ idna_to_unicode_internal (char *utf8in, | |||
316 | return IDNA_STRINGPREP_ERROR; | 330 | return IDNA_STRINGPREP_ERROR; |
317 | } | 331 | } |
318 | 332 | ||
319 | /* 3. Verify that the sequence begins with the ACE prefix, and save a | 333 | /* 3. Verify that the sequence begins with the ACE prefix, and save a |
320 | * copy of the sequence. | 334 | * copy of the sequence. |
335 | * ... The ToASCII and ToUnicode operations MUST recognize the ACE | ||
336 | prefix in a case-insensitive manner. | ||
321 | */ | 337 | */ |
322 | 338 | ||
323 | step3: | 339 | step3: |
324 | if (memcmp (IDNA_ACE_PREFIX, utf8in, strlen (IDNA_ACE_PREFIX)) != 0) | 340 | if (c_strncasecmp (utf8in, IDNA_ACE_PREFIX, strlen (IDNA_ACE_PREFIX)) != 0) |
325 | { | 341 | { |
326 | free (utf8in); | 342 | free (utf8in); |
327 | return IDNA_NO_ACE_PREFIX; | 343 | return IDNA_NO_ACE_PREFIX; |
328 | } | 344 | } |
329 | 345 | ||
@@ -361,11 +377,11 @@ step3: | |||
361 | 377 | ||
362 | /* 7. Verify that the result of step 6 matches the saved copy from | 378 | /* 7. Verify that the result of step 6 matches the saved copy from |
363 | * step 3, using a case-insensitive ASCII comparison. | 379 | * step 3, using a case-insensitive ASCII comparison. |
364 | */ | 380 | */ |
365 | 381 | ||
366 | if (strcasecmp (utf8in, tmpout + strlen (IDNA_ACE_PREFIX)) != 0) | 382 | if (c_strcasecmp (utf8in, tmpout + strlen (IDNA_ACE_PREFIX)) != 0) |
367 | { | 383 | { |
368 | free (utf8in); | 384 | free (utf8in); |
369 | return IDNA_ROUNDTRIP_VERIFY_ERROR; | 385 | return IDNA_ROUNDTRIP_VERIFY_ERROR; |
370 | } | 386 | } |
371 | 387 | ||
@@ -375,11 +391,11 @@ step3: | |||
375 | free (utf8in); | 391 | free (utf8in); |
376 | return IDNA_SUCCESS; | 392 | return IDNA_SUCCESS; |
377 | } | 393 | } |
378 | 394 | ||
379 | /** | 395 | /** |
380 | * idna_to_unicode_44i - convert domain name label to Unicode | 396 | * idna_to_unicode_44i: |
381 | * @in: input array with unicode code points. | 397 | * @in: input array with unicode code points. |
382 | * @inlen: length of input array with unicode code points. | 398 | * @inlen: length of input array with unicode code points. |
383 | * @out: output array with unicode code points. | 399 | * @out: output array with unicode code points. |
384 | * @outlen: on input, maximum size of output array with unicode code points, | 400 | * @outlen: on input, maximum size of output array with unicode code points, |
385 | * on exit, actual size of output array with unicode code points. | 401 | * on exit, actual size of output array with unicode code points. |
@@ -417,11 +433,11 @@ idna_to_unicode_44i (const uint32_t * in, size_t inlen, | |||
417 | { | 433 | { |
418 | int rc; | 434 | int rc; |
419 | size_t outlensave = *outlen; | 435 | size_t outlensave = *outlen; |
420 | char *p; | 436 | char *p; |
421 | 437 | ||
422 | p = stringprep_ucs4_to_utf8 (in, inlen, NULL, NULL); | 438 | p = stringprep_ucs4_to_utf8 (in, (ssize_t) inlen, NULL, NULL); |
423 | if (p == NULL) | 439 | if (p == NULL) |
424 | return IDNA_MALLOC_ERROR; | 440 | return IDNA_MALLOC_ERROR; |
425 | 441 | ||
426 | rc = idna_to_unicode_internal (p, out, outlen, flags); | 442 | rc = idna_to_unicode_internal (p, out, outlen, flags); |
427 | if (rc != IDNA_SUCCESS) | 443 | if (rc != IDNA_SUCCESS) |
@@ -437,11 +453,11 @@ idna_to_unicode_44i (const uint32_t * in, size_t inlen, | |||
437 | } | 453 | } |
438 | 454 | ||
439 | /* Wrappers that handle several labels */ | 455 | /* Wrappers that handle several labels */ |
440 | 456 | ||
441 | /** | 457 | /** |
442 | * idna_to_ascii_4z - convert Unicode domain name to text | 458 | * idna_to_ascii_4z: |
443 | * @input: zero terminated input Unicode string. | 459 | * @input: zero terminated input Unicode string. |
444 | * @output: pointer to newly allocated output string. | 460 | * @output: pointer to newly allocated output string. |
445 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 461 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
446 | * %IDNA_USE_STD3_ASCII_RULES. | 462 | * %IDNA_USE_STD3_ASCII_RULES. |
447 | * | 463 | * |
@@ -453,11 +469,11 @@ idna_to_unicode_44i (const uint32_t * in, size_t inlen, | |||
453 | **/ | 469 | **/ |
454 | int | 470 | int |
455 | idna_to_ascii_4z (const uint32_t * input, char **output, int flags) | 471 | idna_to_ascii_4z (const uint32_t * input, char **output, int flags) |
456 | { | 472 | { |
457 | const uint32_t *start = input; | 473 | const uint32_t *start = input; |
458 | const uint32_t *end = input; | 474 | const uint32_t *end; |
459 | char buf[64]; | 475 | char buf[64]; |
460 | char *out = NULL; | 476 | char *out = NULL; |
461 | int rc; | 477 | int rc; |
462 | 478 | ||
463 | /* 1) Whenever dots are used as label separators, the following | 479 | /* 1) Whenever dots are used as label separators, the following |
@@ -498,18 +514,22 @@ idna_to_ascii_4z (const uint32_t * input, char **output, int flags) | |||
498 | /* Handle explicit zero-length root label. */ | 514 | /* Handle explicit zero-length root label. */ |
499 | buf[0] = '\0'; | 515 | buf[0] = '\0'; |
500 | } | 516 | } |
501 | else | 517 | else |
502 | { | 518 | { |
503 | rc = idna_to_ascii_4i (start, end - start, buf, flags); | 519 | rc = idna_to_ascii_4i (start, (size_t) (end - start), buf, flags); |
504 | if (rc != IDNA_SUCCESS) | 520 | if (rc != IDNA_SUCCESS) |
505 | return rc; | 521 | { |
522 | free (out); | ||
523 | return rc; | ||
524 | } | ||
506 | } | 525 | } |
507 | 526 | ||
508 | if (out) | 527 | if (out) |
509 | { | 528 | { |
510 | char *newp = realloc (out, strlen (out) + 1 + strlen (buf) + 1); | 529 | size_t l = strlen (out) + 1 + strlen (buf) + 1; |
530 | char *newp = realloc (out, l); | ||
511 | if (!newp) | 531 | if (!newp) |
512 | { | 532 | { |
513 | free (out); | 533 | free (out); |
514 | return IDNA_MALLOC_ERROR; | 534 | return IDNA_MALLOC_ERROR; |
515 | } | 535 | } |
@@ -517,14 +537,13 @@ idna_to_ascii_4z (const uint32_t * input, char **output, int flags) | |||
517 | strcat (out, "."); | 537 | strcat (out, "."); |
518 | strcat (out, buf); | 538 | strcat (out, buf); |
519 | } | 539 | } |
520 | else | 540 | else |
521 | { | 541 | { |
522 | out = (char *) malloc (strlen (buf) + 1); | 542 | out = strdup (buf); |
523 | if (!out) | 543 | if (!out) |
524 | return IDNA_MALLOC_ERROR; | 544 | return IDNA_MALLOC_ERROR; |
525 | strcpy (out, buf); | ||
526 | } | 545 | } |
527 | 546 | ||
528 | start = end + 1; | 547 | start = end + 1; |
529 | } | 548 | } |
530 | while (*end); | 549 | while (*end); |
@@ -533,11 +552,11 @@ idna_to_ascii_4z (const uint32_t * input, char **output, int flags) | |||
533 | 552 | ||
534 | return IDNA_SUCCESS; | 553 | return IDNA_SUCCESS; |
535 | } | 554 | } |
536 | 555 | ||
537 | /** | 556 | /** |
538 | * idna_to_ascii_8z - convert Unicode domain name to text | 557 | * idna_to_ascii_8z: |
539 | * @input: zero terminated input UTF-8 string. | 558 | * @input: zero terminated input UTF-8 string. |
540 | * @output: pointer to newly allocated output string. | 559 | * @output: pointer to newly allocated output string. |
541 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 560 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
542 | * %IDNA_USE_STD3_ASCII_RULES. | 561 | * %IDNA_USE_STD3_ASCII_RULES. |
543 | * | 562 | * |
@@ -565,11 +584,11 @@ idna_to_ascii_8z (const char *input, char **output, int flags) | |||
565 | return rc; | 584 | return rc; |
566 | 585 | ||
567 | } | 586 | } |
568 | 587 | ||
569 | /** | 588 | /** |
570 | * idna_to_ascii_lz - convert Unicode domain name to text | 589 | * idna_to_ascii_lz: |
571 | * @input: zero terminated input string encoded in the current locale's | 590 | * @input: zero terminated input string encoded in the current locale's |
572 | * character set. | 591 | * character set. |
573 | * @output: pointer to newly allocated output string. | 592 | * @output: pointer to newly allocated output string. |
574 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 593 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
575 | * %IDNA_USE_STD3_ASCII_RULES. | 594 | * %IDNA_USE_STD3_ASCII_RULES. |
@@ -596,11 +615,11 @@ idna_to_ascii_lz (const char *input, char **output, int flags) | |||
596 | 615 | ||
597 | return rc; | 616 | return rc; |
598 | } | 617 | } |
599 | 618 | ||
600 | /** | 619 | /** |
601 | * idna_to_unicode_4z4z - convert domain name to Unicode | 620 | * idna_to_unicode_4z4z: |
602 | * @input: zero-terminated Unicode string. | 621 | * @input: zero-terminated Unicode string. |
603 | * @output: pointer to newly allocated output Unicode string. | 622 | * @output: pointer to newly allocated output Unicode string. |
604 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 623 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
605 | * %IDNA_USE_STD3_ASCII_RULES. | 624 | * %IDNA_USE_STD3_ASCII_RULES. |
606 | * | 625 | * |
@@ -613,33 +632,33 @@ idna_to_ascii_lz (const char *input, char **output, int flags) | |||
613 | **/ | 632 | **/ |
614 | int | 633 | int |
615 | idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags) | 634 | idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags) |
616 | { | 635 | { |
617 | const uint32_t *start = input; | 636 | const uint32_t *start = input; |
618 | const uint32_t *end = input; | 637 | const uint32_t *end; |
619 | uint32_t *buf; | 638 | uint32_t *buf; |
620 | size_t buflen; | 639 | size_t buflen; |
621 | uint32_t *out = NULL; | 640 | uint32_t *out = NULL; |
622 | size_t outlen = 0; | 641 | size_t outlen = 0; |
623 | int rc; | ||
624 | 642 | ||
625 | *output = NULL; | 643 | *output = NULL; |
626 | 644 | ||
627 | do | 645 | do |
628 | { | 646 | { |
629 | end = start; | 647 | end = start; |
630 | 648 | ||
631 | for (; *end && !DOTP (*end); end++) | 649 | for (; *end && !DOTP (*end); end++) |
632 | ; | 650 | ; |
633 | 651 | ||
634 | buflen = end - start; | 652 | buflen = (size_t) (end - start); |
635 | buf = malloc (sizeof (buf[0]) * (buflen + 1)); | 653 | buf = malloc (sizeof (buf[0]) * (buflen + 1)); |
636 | if (!buf) | 654 | if (!buf) |
637 | return IDNA_MALLOC_ERROR; | 655 | return IDNA_MALLOC_ERROR; |
638 | 656 | ||
639 | rc = idna_to_unicode_44i (start, end - start, buf, &buflen, flags); | 657 | /* don't check return code as per specification! */ |
640 | /* don't check rc as per specification! */ | 658 | idna_to_unicode_44i (start, (size_t) (end - start), |
659 | buf, &buflen, flags); | ||
641 | 660 | ||
642 | if (out) | 661 | if (out) |
643 | { | 662 | { |
644 | uint32_t *newp = realloc (out, | 663 | uint32_t *newp = realloc (out, |
645 | sizeof (out[0]) | 664 | sizeof (out[0]) |
@@ -672,11 +691,11 @@ idna_to_unicode_4z4z (const uint32_t * input, uint32_t ** output, int flags) | |||
672 | 691 | ||
673 | return IDNA_SUCCESS; | 692 | return IDNA_SUCCESS; |
674 | } | 693 | } |
675 | 694 | ||
676 | /** | 695 | /** |
677 | * idna_to_unicode_8z4z - convert domain name to Unicode | 696 | * idna_to_unicode_8z4z: |
678 | * @input: zero-terminated UTF-8 string. | 697 | * @input: zero-terminated UTF-8 string. |
679 | * @output: pointer to newly allocated output Unicode string. | 698 | * @output: pointer to newly allocated output Unicode string. |
680 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 699 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
681 | * %IDNA_USE_STD3_ASCII_RULES. | 700 | * %IDNA_USE_STD3_ASCII_RULES. |
682 | * | 701 | * |
@@ -703,11 +722,11 @@ idna_to_unicode_8z4z (const char *input, uint32_t ** output, int flags) | |||
703 | 722 | ||
704 | return rc; | 723 | return rc; |
705 | } | 724 | } |
706 | 725 | ||
707 | /** | 726 | /** |
708 | * idna_to_unicode_8z8z - convert domain name to Unicode | 727 | * idna_to_unicode_8z8z: |
709 | * @input: zero-terminated UTF-8 string. | 728 | * @input: zero-terminated UTF-8 string. |
710 | * @output: pointer to newly allocated output UTF-8 string. | 729 | * @output: pointer to newly allocated output UTF-8 string. |
711 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 730 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
712 | * %IDNA_USE_STD3_ASCII_RULES. | 731 | * %IDNA_USE_STD3_ASCII_RULES. |
713 | * | 732 | * |
@@ -723,21 +742,24 @@ idna_to_unicode_8z8z (const char *input, char **output, int flags) | |||
723 | { | 742 | { |
724 | uint32_t *ucs4; | 743 | uint32_t *ucs4; |
725 | int rc; | 744 | int rc; |
726 | 745 | ||
727 | rc = idna_to_unicode_8z4z (input, &ucs4, flags); | 746 | rc = idna_to_unicode_8z4z (input, &ucs4, flags); |
747 | if (rc != IDNA_SUCCESS) | ||
748 | return rc; | ||
749 | |||
728 | *output = stringprep_ucs4_to_utf8 (ucs4, -1, NULL, NULL); | 750 | *output = stringprep_ucs4_to_utf8 (ucs4, -1, NULL, NULL); |
729 | free (ucs4); | 751 | free (ucs4); |
730 | 752 | ||
731 | if (!*output) | 753 | if (!*output) |
732 | return IDNA_ICONV_ERROR; | 754 | return IDNA_ICONV_ERROR; |
733 | 755 | ||
734 | return rc; | 756 | return IDNA_SUCCESS; |
735 | } | 757 | } |
736 | 758 | ||
737 | /** | 759 | /** |
738 | * idna_to_unicode_8zlz - convert domain name to Unicode | 760 | * idna_to_unicode_8zlz: |
739 | * @input: zero-terminated UTF-8 string. | 761 | * @input: zero-terminated UTF-8 string. |
740 | * @output: pointer to newly allocated output string encoded in the | 762 | * @output: pointer to newly allocated output string encoded in the |
741 | * current locale's character set. | 763 | * current locale's character set. |
742 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 764 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
743 | * %IDNA_USE_STD3_ASCII_RULES. | 765 | * %IDNA_USE_STD3_ASCII_RULES. |
@@ -754,21 +776,24 @@ idna_to_unicode_8zlz (const char *input, char **output, int flags) | |||
754 | { | 776 | { |
755 | char *utf8; | 777 | char *utf8; |
756 | int rc; | 778 | int rc; |
757 | 779 | ||
758 | rc = idna_to_unicode_8z8z (input, &utf8, flags); | 780 | rc = idna_to_unicode_8z8z (input, &utf8, flags); |
781 | if (rc != IDNA_SUCCESS) | ||
782 | return rc; | ||
783 | |||
759 | *output = stringprep_utf8_to_locale (utf8); | 784 | *output = stringprep_utf8_to_locale (utf8); |
760 | free (utf8); | 785 | free (utf8); |
761 | 786 | ||
762 | if (!*output) | 787 | if (!*output) |
763 | return IDNA_ICONV_ERROR; | 788 | return IDNA_ICONV_ERROR; |
764 | 789 | ||
765 | return rc; | 790 | return IDNA_SUCCESS; |
766 | } | 791 | } |
767 | 792 | ||
768 | /** | 793 | /** |
769 | * idna_to_unicode_lzlz - convert domain name to Unicode | 794 | * idna_to_unicode_lzlz: |
770 | * @input: zero-terminated string encoded in the current locale's | 795 | * @input: zero-terminated string encoded in the current locale's |
771 | * character set. | 796 | * character set. |
772 | * @output: pointer to newly allocated output string encoded in the | 797 | * @output: pointer to newly allocated output string encoded in the |
773 | * current locale's character set. | 798 | * current locale's character set. |
774 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or | 799 | * @flags: an #Idna_flags value, e.g., %IDNA_ALLOW_UNASSIGNED or |
@@ -810,10 +835,12 @@ idna_to_unicode_lzlz (const char *input, char **output, int flags) | |||
810 | * non-zero values, for logical comparison purposes. | 835 | * non-zero values, for logical comparison purposes. |
811 | * @IDNA_STRINGPREP_ERROR: Error during string preparation. | 836 | * @IDNA_STRINGPREP_ERROR: Error during string preparation. |
812 | * @IDNA_PUNYCODE_ERROR: Error during punycode operation. | 837 | * @IDNA_PUNYCODE_ERROR: Error during punycode operation. |
813 | * @IDNA_CONTAINS_NON_LDH: For IDNA_USE_STD3_ASCII_RULES, indicate that | 838 | * @IDNA_CONTAINS_NON_LDH: For IDNA_USE_STD3_ASCII_RULES, indicate that |
814 | * the string contains non-LDH ASCII characters. | 839 | * the string contains non-LDH ASCII characters. |
840 | * @IDNA_CONTAINS_LDH: Same as @IDNA_CONTAINS_NON_LDH, for compatibility | ||
841 | * with typo in earlier versions. | ||
815 | * @IDNA_CONTAINS_MINUS: For IDNA_USE_STD3_ASCII_RULES, indicate that | 842 | * @IDNA_CONTAINS_MINUS: For IDNA_USE_STD3_ASCII_RULES, indicate that |
816 | * the string contains a leading or trailing hyphen-minus (U+002D). | 843 | * the string contains a leading or trailing hyphen-minus (U+002D). |
817 | * @IDNA_INVALID_LENGTH: The final output string is not within the | 844 | * @IDNA_INVALID_LENGTH: The final output string is not within the |
818 | * (inclusive) range 1 to 63 characters. | 845 | * (inclusive) range 1 to 63 characters. |
819 | * @IDNA_NO_ACE_PREFIX: The string does not contain the ACE prefix | 846 | * @IDNA_NO_ACE_PREFIX: The string does not contain the ACE prefix |
diff --git a/3rdParty/LibIDN/src/idna.h b/3rdParty/LibIDN/src/idna.h index f6b24ac..f214075 100644 --- a/3rdParty/LibIDN/src/idna.h +++ b/3rdParty/LibIDN/src/idna.h | |||
@@ -1,37 +1,57 @@ | |||
1 | /* idna.h --- Declarations for Internationalized Domain Name in Applications. | 1 | /* idna.h --- Prototypes for Internationalized Domain Name library. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | ||
4 | * This file is part of GNU Libidn. | ||
5 | * | ||
6 | * GNU Libidn is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * GNU Libidn is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with GNU Libidn; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #ifndef _IDNA_H | ||
23 | # define _IDNA_H | ||
24 | 3 | ||
25 | # ifdef __cplusplus | 4 | This file is part of GNU Libidn. |
26 | extern "C" | 5 | |
27 | { | 6 | GNU Libidn is free software: you can redistribute it and/or |
7 | modify it under the terms of either: | ||
8 | |||
9 | * the GNU Lesser General Public License as published by the Free | ||
10 | Software Foundation; either version 3 of the License, or (at | ||
11 | your option) any later version. | ||
12 | |||
13 | or | ||
14 | |||
15 | * the GNU General Public License as published by the Free | ||
16 | Software Foundation; either version 2 of the License, or (at | ||
17 | your option) any later version. | ||
18 | |||
19 | or both in parallel, as here. | ||
20 | |||
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
29 | |||
30 | #ifndef IDNA_H | ||
31 | # define IDNA_H | ||
32 | |||
33 | # ifndef IDNAPI | ||
34 | # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY | ||
35 | # define IDNAPI __attribute__((__visibility__("default"))) | ||
36 | # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC | ||
37 | # define IDNAPI __declspec(dllexport) | ||
38 | # elif defined _MSC_VER && ! defined LIBIDN_STATIC | ||
39 | # define IDNAPI __declspec(dllimport) | ||
40 | # else | ||
41 | # define IDNAPI | ||
42 | # endif | ||
28 | # endif | 43 | # endif |
29 | 44 | ||
30 | # include <stddef.h> /* size_t */ | 45 | # include <stddef.h> /* size_t */ |
31 | # include <idn-int.h> /* uint32_t */ | 46 | # include <idn-int.h> /* uint32_t */ |
32 | 47 | ||
48 | # ifdef __cplusplus | ||
49 | extern "C" | ||
50 | { | ||
51 | # endif | ||
52 | |||
33 | /* Error codes. */ | 53 | /* Error codes. */ |
34 | typedef enum | 54 | typedef enum |
35 | { | 55 | { |
36 | IDNA_SUCCESS = 0, | 56 | IDNA_SUCCESS = 0, |
37 | IDNA_STRINGPREP_ERROR = 1, | 57 | IDNA_STRINGPREP_ERROR = 1, |
@@ -59,42 +79,45 @@ extern "C" | |||
59 | 79 | ||
60 | # ifndef IDNA_ACE_PREFIX | 80 | # ifndef IDNA_ACE_PREFIX |
61 | # define IDNA_ACE_PREFIX "xn--" | 81 | # define IDNA_ACE_PREFIX "xn--" |
62 | # endif | 82 | # endif |
63 | 83 | ||
64 | extern const char *idna_strerror (Idna_rc rc); | 84 | extern IDNAPI const char *idna_strerror (Idna_rc rc); |
65 | 85 | ||
66 | /* Core functions */ | 86 | /* Core functions */ |
67 | extern int idna_to_ascii_4i (const uint32_t * in, size_t inlen, | 87 | extern IDNAPI int idna_to_ascii_4i (const uint32_t * in, size_t inlen, |
68 | char *out, int flags); | 88 | char *out, int flags); |
69 | extern int idna_to_unicode_44i (const uint32_t * in, size_t inlen, | 89 | extern IDNAPI int idna_to_unicode_44i (const uint32_t * in, size_t inlen, |
70 | uint32_t * out, size_t * outlen, int flags); | 90 | uint32_t * out, size_t * outlen, |
91 | int flags); | ||
71 | 92 | ||
72 | /* Wrappers that handle several labels */ | 93 | /* Wrappers that handle several labels */ |
73 | 94 | ||
74 | extern int idna_to_ascii_4z (const uint32_t * input, | 95 | extern IDNAPI int idna_to_ascii_4z (const uint32_t * input, |
75 | char **output, int flags); | 96 | char **output, int flags); |
76 | 97 | ||
77 | extern int idna_to_ascii_8z (const char *input, char **output, int flags); | 98 | extern IDNAPI int idna_to_ascii_8z (const char *input, char **output, |
99 | int flags); | ||
78 | 100 | ||
79 | extern int idna_to_ascii_lz (const char *input, char **output, int flags); | 101 | extern IDNAPI int idna_to_ascii_lz (const char *input, char **output, |
102 | int flags); | ||
80 | 103 | ||
104 | extern IDNAPI int idna_to_unicode_4z4z (const uint32_t * input, | ||
105 | uint32_t ** output, int flags); | ||
81 | 106 | ||
82 | extern int idna_to_unicode_4z4z (const uint32_t * input, | 107 | extern IDNAPI int idna_to_unicode_8z4z (const char *input, |
83 | uint32_t ** output, int flags); | 108 | uint32_t ** output, int flags); |
84 | 109 | ||
85 | extern int idna_to_unicode_8z4z (const char *input, | 110 | extern IDNAPI int idna_to_unicode_8z8z (const char *input, |
86 | uint32_t ** output, int flags); | 111 | char **output, int flags); |
87 | 112 | ||
88 | extern int idna_to_unicode_8z8z (const char *input, | 113 | extern IDNAPI int idna_to_unicode_8zlz (const char *input, |
89 | char **output, int flags); | 114 | char **output, int flags); |
90 | 115 | ||
91 | extern int idna_to_unicode_8zlz (const char *input, | 116 | extern IDNAPI int idna_to_unicode_lzlz (const char *input, |
92 | char **output, int flags); | 117 | char **output, int flags); |
93 | |||
94 | extern int idna_to_unicode_lzlz (const char *input, | ||
95 | char **output, int flags); | ||
96 | 118 | ||
97 | # ifdef __cplusplus | 119 | # ifdef __cplusplus |
98 | } | 120 | } |
99 | # endif | 121 | # endif |
100 | #endif /* _IDNA_H */ | 122 | |
123 | #endif /* IDNA_H */ | ||
diff --git a/3rdParty/LibIDN/src/nfkc.c b/3rdParty/LibIDN/src/nfkc.c index 621f749..4992074 100644 --- a/3rdParty/LibIDN/src/nfkc.c +++ b/3rdParty/LibIDN/src/nfkc.c | |||
@@ -1,42 +1,43 @@ | |||
1 | /* nfkc.c --- Unicode normalization utilities. | 1 | /* nfkc.c --- Unicode normalization utilities. |
2 | * Copyright (C) 2002, 2003, 2004, 2006, 2007 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | 3 | |
4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
5 | * | 5 | |
6 | * GNU Libidn is free software; you can redistribute it and/or | 6 | GNU Libidn is free software: you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of either: |
8 | * License as published by the Free Software Foundation; either | 8 | |
9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * the GNU Lesser General Public License as published by the Free |
10 | * | 10 | Software Foundation; either version 3 of the License, or (at |
11 | * GNU Libidn is distributed in the hope that it will be useful, | 11 | your option) any later version. |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | or |
14 | * Lesser General Public License for more details. | 14 | |
15 | * | 15 | * the GNU General Public License as published by the Free |
16 | * You should have received a copy of the GNU Lesser General Public | 16 | Software Foundation; either version 2 of the License, or (at |
17 | * License along with GNU Libidn; if not, write to the Free Software | 17 | your option) any later version. |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 18 | |
19 | * | 19 | or both in parallel, as here. |
20 | */ | 20 | |
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
21 | 29 | ||
22 | #ifdef HAVE_CONFIG_H | 30 | #ifdef HAVE_CONFIG_H |
23 | # include "config.h" | 31 | #include "config.h" |
24 | #endif | 32 | #endif |
25 | 33 | ||
26 | #include <stdlib.h> | 34 | #include <stdlib.h> |
27 | #include <string.h> | 35 | #include <string.h> |
28 | 36 | ||
29 | #include "stringprep.h" | 37 | #include "stringprep.h" |
30 | 38 | ||
31 | /* This file contains functions from GLIB, including gutf8.c and | ||
32 | * gunidecomp.c, all licensed under LGPL and copyright hold by: | ||
33 | * | ||
34 | * Copyright (C) 1999, 2000 Tom Tromey | ||
35 | * Copyright 2000 Red Hat, Inc. | ||
36 | */ | ||
37 | |||
38 | /* Hacks to make syncing with GLIB code easier. */ | 39 | /* Hacks to make syncing with GLIB code easier. */ |
39 | #define gboolean int | 40 | #define gboolean int |
40 | #define gchar char | 41 | #define gchar char |
41 | #define guchar unsigned char | 42 | #define guchar unsigned char |
42 | #define glong long | 43 | #define glong long |
@@ -48,33 +49,71 @@ | |||
48 | #define gunichar uint32_t | 49 | #define gunichar uint32_t |
49 | #define gsize size_t | 50 | #define gsize size_t |
50 | #define gssize ssize_t | 51 | #define gssize ssize_t |
51 | #define g_malloc malloc | 52 | #define g_malloc malloc |
52 | #define g_free free | 53 | #define g_free free |
53 | #define GError void | 54 | #define g_return_val_if_fail(expr,val) { \ |
54 | #define g_set_error(a,b,c,d) ((void) 0) | 55 | if (!(expr)) \ |
55 | #define g_new(struct_type, n_structs) \ | 56 | return (val); \ |
56 | ((struct_type *) g_malloc (((gsize) sizeof (struct_type)) * ((gsize) (n_structs)))) | 57 | } |
57 | # if defined (__GNUC__) && !defined (__STRICT_ANSI__) && !defined (__cplusplus) | 58 | |
58 | # define G_STMT_START (void)( | 59 | /* Code from GLIB gmacros.h starts here. */ |
59 | # define G_STMT_END ) | 60 | |
60 | # else | 61 | /* GLIB - Library of useful routines for C programming |
61 | # if (defined (sun) || defined (__sun__)) | 62 | * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald |
62 | # define G_STMT_START if (1) | 63 | * |
63 | # define G_STMT_END else (void)0 | 64 | * This library is free software; you can redistribute it and/or |
64 | # else | 65 | * modify it under the terms of the GNU Lesser General Public |
65 | # define G_STMT_START do | 66 | * License as published by the Free Software Foundation; either |
66 | # define G_STMT_END while (0) | 67 | * version 2 of the License, or (at your option) any later version. |
67 | # endif | 68 | * |
68 | # endif | 69 | * This library is distributed in the hope that it will be useful, |
69 | #define g_return_val_if_fail(expr,val) G_STMT_START{ (void)0; }G_STMT_END | 70 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
71 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
72 | * Lesser General Public License for more details. | ||
73 | * | ||
74 | * You should have received a copy of the GNU Lesser General Public | ||
75 | * License along with this library; if not, write to the | ||
76 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
77 | * Boston, MA 02111-1307, USA. | ||
78 | */ | ||
79 | |||
80 | #ifndef FALSE | ||
81 | #define FALSE (0) | ||
82 | #endif | ||
83 | |||
84 | #ifndef TRUE | ||
85 | #define TRUE (!FALSE) | ||
86 | #endif | ||
87 | |||
70 | #define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) | 88 | #define G_N_ELEMENTS(arr) (sizeof (arr) / sizeof ((arr)[0])) |
71 | #define TRUE 1 | 89 | |
72 | #define FALSE 0 | 90 | #define G_UNLIKELY(expr) (expr) |
73 | 91 | ||
74 | /* Code from GLIB gunicode.h starts here. */ | 92 | /* Code from GLIB gunicode.h starts here. */ |
75 | 93 | ||
94 | /* gunicode.h - Unicode manipulation functions | ||
95 | * | ||
96 | * Copyright (C) 1999, 2000 Tom Tromey | ||
97 | * Copyright 2000, 2005 Red Hat, Inc. | ||
98 | * | ||
99 | * The Gnome Library is free software; you can redistribute it and/or | ||
100 | * modify it under the terms of the GNU Lesser General Public License as | ||
101 | * published by the Free Software Foundation; either version 2 of the | ||
102 | * License, or (at your option) any later version. | ||
103 | * | ||
104 | * The Gnome Library is distributed in the hope that it will be useful, | ||
105 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
106 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
107 | * Lesser General Public License for more details. | ||
108 | * | ||
109 | * You should have received a copy of the GNU Lesser General Public | ||
110 | * License along with the Gnome Library; see the file COPYING.LIB. If not, | ||
111 | * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
112 | * Boston, MA 02111-1307, USA. | ||
113 | */ | ||
114 | |||
76 | typedef enum | 115 | typedef enum |
77 | { | 116 | { |
78 | G_NORMALIZE_DEFAULT, | 117 | G_NORMALIZE_DEFAULT, |
79 | G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT, | 118 | G_NORMALIZE_NFD = G_NORMALIZE_DEFAULT, |
80 | G_NORMALIZE_DEFAULT_COMPOSE, | 119 | G_NORMALIZE_DEFAULT_COMPOSE, |
@@ -84,12 +123,35 @@ typedef enum | |||
84 | G_NORMALIZE_ALL_COMPOSE, | 123 | G_NORMALIZE_ALL_COMPOSE, |
85 | G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE | 124 | G_NORMALIZE_NFKC = G_NORMALIZE_ALL_COMPOSE |
86 | } | 125 | } |
87 | GNormalizeMode; | 126 | GNormalizeMode; |
88 | 127 | ||
128 | #define g_utf8_next_char(p) ((p) + g_utf8_skip[*(const guchar *)(p)]) | ||
129 | |||
89 | /* Code from GLIB gutf8.c starts here. */ | 130 | /* Code from GLIB gutf8.c starts here. */ |
90 | 131 | ||
132 | /* gutf8.c - Operations on UTF-8 strings. | ||
133 | * | ||
134 | * Copyright (C) 1999 Tom Tromey | ||
135 | * Copyright (C) 2000 Red Hat, Inc. | ||
136 | * | ||
137 | * This library is free software; you can redistribute it and/or | ||
138 | * modify it under the terms of the GNU Lesser General Public | ||
139 | * License as published by the Free Software Foundation; either | ||
140 | * version 2 of the License, or (at your option) any later version. | ||
141 | * | ||
142 | * This library is distributed in the hope that it will be useful, | ||
143 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
144 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
145 | * Lesser General Public License for more details. | ||
146 | * | ||
147 | * You should have received a copy of the GNU Lesser General Public | ||
148 | * License along with this library; if not, write to the | ||
149 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
150 | * Boston, MA 02111-1307, USA. | ||
151 | */ | ||
152 | |||
91 | #define UTF8_COMPUTE(Char, Mask, Len) \ | 153 | #define UTF8_COMPUTE(Char, Mask, Len) \ |
92 | if (Char < 128) \ | 154 | if (Char < 128) \ |
93 | { \ | 155 | { \ |
94 | Len = 1; \ | 156 | Len = 1; \ |
95 | Mask = 0x7f; \ | 157 | Mask = 0x7f; \ |
@@ -127,31 +189,23 @@ GNormalizeMode; | |||
127 | ((Char) < 0x800 ? 2 : \ | 189 | ((Char) < 0x800 ? 2 : \ |
128 | ((Char) < 0x10000 ? 3 : \ | 190 | ((Char) < 0x10000 ? 3 : \ |
129 | ((Char) < 0x200000 ? 4 : \ | 191 | ((Char) < 0x200000 ? 4 : \ |
130 | ((Char) < 0x4000000 ? 5 : 6))))) | 192 | ((Char) < 0x4000000 ? 5 : 6))))) |
131 | 193 | ||
132 | 194 | #define UTF8_GET(Result, Chars, Count, Mask, Len) \ | |
133 | #define UTF8_GET(Result, Chars, Count, Mask, Len) \ | 195 | (Result) = (Chars)[0] & (Mask); \ |
134 | (Result) = (Chars)[0] & (Mask); \ | 196 | for ((Count) = 1; (Count) < (Len); ++(Count)) \ |
135 | for ((Count) = 1; (Count) < (Len); ++(Count)) \ | 197 | { \ |
136 | { \ | 198 | if (((Chars)[(Count)] & 0xc0) != 0x80) \ |
137 | if (((Chars)[(Count)] & 0xc0) != 0x80) \ | 199 | { \ |
138 | { \ | 200 | (Result) = -1; \ |
139 | (Result) = -1; \ | 201 | break; \ |
140 | break; \ | 202 | } \ |
141 | } \ | 203 | (Result) <<= 6; \ |
142 | (Result) <<= 6; \ | 204 | (Result) |= ((Chars)[(Count)] & 0x3f); \ |
143 | (Result) |= ((Chars)[(Count)] & 0x3f); \ | ||
144 | } | 205 | } |
145 | 206 | ||
146 | #define UNICODE_VALID(Char) \ | ||
147 | ((Char) < 0x110000 && \ | ||
148 | (((Char) & 0xFFFFF800) != 0xD800) && \ | ||
149 | ((Char) < 0xFDD0 || (Char) > 0xFDEF) && \ | ||
150 | ((Char) & 0xFFFE) != 0xFFFE) | ||
151 | |||
152 | |||
153 | static const gchar utf8_skip_data[256] = { | 207 | static const gchar utf8_skip_data[256] = { |
154 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 208 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
155 | 1, 1, 1, 1, 1, 1, 1, | 209 | 1, 1, 1, 1, 1, 1, 1, |
156 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 210 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
157 | 1, 1, 1, 1, 1, 1, 1, | 211 | 1, 1, 1, 1, 1, 1, 1, |
@@ -169,21 +223,20 @@ static const gchar utf8_skip_data[256] = { | |||
169 | 5, 5, 5, 6, 6, 1, 1 | 223 | 5, 5, 5, 6, 6, 1, 1 |
170 | }; | 224 | }; |
171 | 225 | ||
172 | static const gchar *const g_utf8_skip = utf8_skip_data; | 226 | static const gchar *const g_utf8_skip = utf8_skip_data; |
173 | 227 | ||
174 | #define g_utf8_next_char(p) (char *)((p) + g_utf8_skip[*(guchar *)(p)]) | ||
175 | |||
176 | /* | 228 | /* |
177 | * g_utf8_strlen: | 229 | * g_utf8_strlen: |
178 | * @p: pointer to the start of a UTF-8 encoded string. | 230 | * @p: pointer to the start of a UTF-8 encoded string |
179 | * @max: the maximum number of bytes to examine. If @max | 231 | * @max: the maximum number of bytes to examine. If @max |
180 | * is less than 0, then the string is assumed to be | 232 | * is less than 0, then the string is assumed to be |
181 | * nul-terminated. If @max is 0, @p will not be examined and | 233 | * nul-terminated. If @max is 0, @p will not be examined and |
182 | * may be %NULL. | 234 | * may be %NULL. |
183 | * | 235 | * |
184 | * Returns the length of the string in characters. | 236 | * Computes the length of the string in characters, not including |
237 | * the terminating nul character. | ||
185 | * | 238 | * |
186 | * Return value: the length of the string in characters | 239 | * Return value: the length of the string in characters |
187 | **/ | 240 | **/ |
188 | static glong | 241 | static glong |
189 | g_utf8_strlen (const gchar * p, gssize max) | 242 | g_utf8_strlen (const gchar * p, gssize max) |
@@ -214,11 +267,11 @@ g_utf8_strlen (const gchar * p, gssize max) | |||
214 | } | 267 | } |
215 | 268 | ||
216 | /* only do the last len increment if we got a complete | 269 | /* only do the last len increment if we got a complete |
217 | * char (don't count partial chars) | 270 | * char (don't count partial chars) |
218 | */ | 271 | */ |
219 | if (p - start == max) | 272 | if (p - start <= max) |
220 | ++len; | 273 | ++len; |
221 | } | 274 | } |
222 | 275 | ||
223 | return len; | 276 | return len; |
224 | } | 277 | } |
@@ -250,11 +303,11 @@ g_utf8_get_char (const gchar * p) | |||
250 | return result; | 303 | return result; |
251 | } | 304 | } |
252 | 305 | ||
253 | /* | 306 | /* |
254 | * g_unichar_to_utf8: | 307 | * g_unichar_to_utf8: |
255 | * @c: a ISO10646 character code | 308 | * @c: a Unicode character code |
256 | * @outbuf: output buffer, must have at least 6 bytes of space. | 309 | * @outbuf: output buffer, must have at least 6 bytes of space. |
257 | * If %NULL, the length will be computed and returned | 310 | * If %NULL, the length will be computed and returned |
258 | * and nothing will be written to @outbuf. | 311 | * and nothing will be written to @outbuf. |
259 | * | 312 | * |
260 | * Converts a single character to UTF-8. | 313 | * Converts a single character to UTF-8. |
@@ -262,10 +315,11 @@ g_utf8_get_char (const gchar * p) | |||
262 | * Return value: number of bytes written | 315 | * Return value: number of bytes written |
263 | **/ | 316 | **/ |
264 | static int | 317 | static int |
265 | g_unichar_to_utf8 (gunichar c, gchar * outbuf) | 318 | g_unichar_to_utf8 (gunichar c, gchar * outbuf) |
266 | { | 319 | { |
320 | /* If this gets modified, also update the copy in g_string_insert_unichar() */ | ||
267 | guint len = 0; | 321 | guint len = 0; |
268 | int first; | 322 | int first; |
269 | int i; | 323 | int i; |
270 | 324 | ||
271 | if (c < 0x80) | 325 | if (c < 0x80) |
@@ -313,29 +367,29 @@ g_unichar_to_utf8 (gunichar c, gchar * outbuf) | |||
313 | } | 367 | } |
314 | 368 | ||
315 | /* | 369 | /* |
316 | * g_utf8_to_ucs4_fast: | 370 | * g_utf8_to_ucs4_fast: |
317 | * @str: a UTF-8 encoded string | 371 | * @str: a UTF-8 encoded string |
318 | * @len: the maximum length of @str to use. If @len < 0, then | 372 | * @len: the maximum length of @str to use, in bytes. If @len < 0, |
319 | * the string is nul-terminated. | 373 | * then the string is nul-terminated. |
320 | * @items_written: location to store the number of characters in the | 374 | * @items_written: location to store the number of characters in the |
321 | * result, or %NULL. | 375 | * result, or %NULL. |
322 | * | 376 | * |
323 | * Convert a string from UTF-8 to a 32-bit fixed width | 377 | * Convert a string from UTF-8 to a 32-bit fixed width |
324 | * representation as UCS-4, assuming valid UTF-8 input. | 378 | * representation as UCS-4, assuming valid UTF-8 input. |
325 | * This function is roughly twice as fast as g_utf8_to_ucs4() | 379 | * This function is roughly twice as fast as g_utf8_to_ucs4() |
326 | * but does no error checking on the input. | 380 | * but does no error checking on the input. A trailing 0 character |
381 | * will be added to the string after the converted text. | ||
327 | * | 382 | * |
328 | * Return value: a pointer to a newly allocated UCS-4 string. | 383 | * Return value: a pointer to a newly allocated UCS-4 string. |
329 | * This value must be freed with g_free(). | 384 | * This value must be freed with g_free(). |
330 | **/ | 385 | **/ |
331 | static gunichar * | 386 | static gunichar * |
332 | g_utf8_to_ucs4_fast (const gchar * str, glong len, glong * items_written) | 387 | g_utf8_to_ucs4_fast (const gchar * str, glong len, glong * items_written) |
333 | { | 388 | { |
334 | gint j, charlen; | ||
335 | gunichar *result; | 389 | gunichar *result; |
336 | gint n_chars, i; | 390 | gsize n_chars, i; |
337 | const gchar *p; | 391 | const gchar *p; |
338 | 392 | ||
339 | g_return_val_if_fail (str != NULL, NULL); | 393 | g_return_val_if_fail (str != NULL, NULL); |
340 | 394 | ||
341 | p = str; | 395 | p = str; |
@@ -355,60 +409,48 @@ g_utf8_to_ucs4_fast (const gchar * str, glong len, glong * items_written) | |||
355 | p = g_utf8_next_char (p); | 409 | p = g_utf8_next_char (p); |
356 | ++n_chars; | 410 | ++n_chars; |
357 | } | 411 | } |
358 | } | 412 | } |
359 | 413 | ||
360 | result = g_new (gunichar, n_chars + 1); | 414 | result = g_malloc (sizeof (gunichar) * (n_chars + 1)); |
361 | if (!result) | 415 | if (!result) |
362 | return NULL; | 416 | return NULL; |
363 | 417 | ||
364 | p = str; | 418 | p = str; |
365 | for (i = 0; i < n_chars; i++) | 419 | for (i = 0; i < n_chars; i++) |
366 | { | 420 | { |
367 | gunichar wc = ((unsigned char *) p)[0]; | 421 | gunichar wc = (guchar) * p++; |
368 | 422 | ||
369 | if (wc < 0x80) | 423 | if (wc < 0x80) |
370 | { | 424 | { |
371 | result[i] = wc; | 425 | result[i] = wc; |
372 | p++; | ||
373 | } | 426 | } |
374 | else | 427 | else |
375 | { | 428 | { |
376 | if (wc < 0xe0) | 429 | gunichar mask = 0x40; |
377 | { | 430 | |
378 | charlen = 2; | 431 | if (G_UNLIKELY ((wc & mask) == 0)) |
379 | wc &= 0x1f; | ||
380 | } | ||
381 | else if (wc < 0xf0) | ||
382 | { | ||
383 | charlen = 3; | ||
384 | wc &= 0x0f; | ||
385 | } | ||
386 | else if (wc < 0xf8) | ||
387 | { | ||
388 | charlen = 4; | ||
389 | wc &= 0x07; | ||
390 | } | ||
391 | else if (wc < 0xfc) | ||
392 | { | ||
393 | charlen = 5; | ||
394 | wc &= 0x03; | ||
395 | } | ||
396 | else | ||
397 | { | 432 | { |
398 | charlen = 6; | 433 | /* It's an out-of-sequence 10xxxxxxx byte. |
399 | wc &= 0x01; | 434 | * Rather than making an ugly hash of this and the next byte |
435 | * and overrunning the buffer, it's more useful to treat it | ||
436 | * with a replacement character */ | ||
437 | result[i] = 0xfffd; | ||
438 | continue; | ||
400 | } | 439 | } |
401 | 440 | ||
402 | for (j = 1; j < charlen; j++) | 441 | do |
403 | { | 442 | { |
404 | wc <<= 6; | 443 | wc <<= 6; |
405 | wc |= ((unsigned char *) p)[j] & 0x3f; | 444 | wc |= (guchar) (*p++) & 0x3f; |
445 | mask <<= 5; | ||
406 | } | 446 | } |
447 | while ((wc & mask) != 0); | ||
448 | |||
449 | wc &= mask - 1; | ||
407 | 450 | ||
408 | result[i] = wc; | 451 | result[i] = wc; |
409 | p += charlen; | ||
410 | } | 452 | } |
411 | } | 453 | } |
412 | result[i] = 0; | 454 | result[i] = 0; |
413 | 455 | ||
414 | if (items_written) | 456 | if (items_written) |
@@ -418,32 +460,34 @@ g_utf8_to_ucs4_fast (const gchar * str, glong len, glong * items_written) | |||
418 | } | 460 | } |
419 | 461 | ||
420 | /* | 462 | /* |
421 | * g_ucs4_to_utf8: | 463 | * g_ucs4_to_utf8: |
422 | * @str: a UCS-4 encoded string | 464 | * @str: a UCS-4 encoded string |
423 | * @len: the maximum length of @str to use. If @len < 0, then | 465 | * @len: the maximum length (number of characters) of @str to use. |
424 | * the string is terminated with a 0 character. | 466 | * If @len < 0, then the string is nul-terminated. |
425 | * @items_read: location to store number of characters read read, or %NULL. | 467 | * @items_read: location to store number of characters read, or %NULL. |
426 | * @items_written: location to store number of bytes written or %NULL. | 468 | * @items_written: location to store number of bytes written or %NULL. |
427 | * The value here stored does not include the trailing 0 | 469 | * The value here stored does not include the trailing 0 |
428 | * byte. | 470 | * byte. |
429 | * @error: location to store the error occuring, or %NULL to ignore | 471 | * @error: location to store the error occurring, or %NULL to ignore |
430 | * errors. Any of the errors in #GConvertError other than | 472 | * errors. Any of the errors in #GConvertError other than |
431 | * %G_CONVERT_ERROR_NO_CONVERSION may occur. | 473 | * %G_CONVERT_ERROR_NO_CONVERSION may occur. |
432 | * | 474 | * |
433 | * Convert a string from a 32-bit fixed width representation as UCS-4. | 475 | * Convert a string from a 32-bit fixed width representation as UCS-4. |
434 | * to UTF-8. The result will be terminated with a 0 byte. | 476 | * to UTF-8. The result will be terminated with a 0 byte. |
435 | * | 477 | * |
436 | * Return value: a pointer to a newly allocated UTF-8 string. | 478 | * Return value: a pointer to a newly allocated UTF-8 string. |
437 | * This value must be freed with g_free(). If an | 479 | * This value must be freed with g_free(). If an |
438 | * error occurs, %NULL will be returned and | 480 | * error occurs, %NULL will be returned and |
439 | * @error set. | 481 | * @error set. In that case, @items_read will be |
482 | * set to the position of the first invalid input | ||
483 | * character. | ||
440 | **/ | 484 | **/ |
441 | static gchar * | 485 | static gchar * |
442 | g_ucs4_to_utf8 (const gunichar * str, | 486 | g_ucs4_to_utf8 (const gunichar * str, |
443 | glong len, | 487 | glong len, |
444 | glong * items_read, glong * items_written, GError ** error) | 488 | glong * items_read, glong * items_written) |
445 | { | 489 | { |
446 | gint result_length; | 490 | gint result_length; |
447 | gchar *result = NULL; | 491 | gchar *result = NULL; |
448 | gchar *p; | 492 | gchar *p; |
449 | gint i; | 493 | gint i; |
@@ -453,19 +497,11 @@ g_ucs4_to_utf8 (const gunichar * str, | |||
453 | { | 497 | { |
454 | if (!str[i]) | 498 | if (!str[i]) |
455 | break; | 499 | break; |
456 | 500 | ||
457 | if (str[i] >= 0x80000000) | 501 | if (str[i] >= 0x80000000) |
458 | { | 502 | goto err_out; |
459 | if (items_read) | ||
460 | *items_read = i; | ||
461 | |||
462 | g_set_error (error, G_CONVERT_ERROR, | ||
463 | G_CONVERT_ERROR_ILLEGAL_SEQUENCE, | ||
464 | _("Character out of range for UTF-8")); | ||
465 | goto err_out; | ||
466 | } | ||
467 | 503 | ||
468 | result_length += UTF8_LENGTH (str[i]); | 504 | result_length += UTF8_LENGTH (str[i]); |
469 | } | 505 | } |
470 | 506 | ||
471 | result = g_malloc (result_length + 1); | 507 | result = g_malloc (result_length + 1); |
@@ -489,28 +525,49 @@ err_out: | |||
489 | return result; | 525 | return result; |
490 | } | 526 | } |
491 | 527 | ||
492 | /* Code from GLIB gunidecomp.c starts here. */ | 528 | /* Code from GLIB gunidecomp.c starts here. */ |
493 | 529 | ||
530 | /* decomp.c - Character decomposition. | ||
531 | * | ||
532 | * Copyright (C) 1999, 2000 Tom Tromey | ||
533 | * Copyright 2000 Red Hat, Inc. | ||
534 | * | ||
535 | * The Gnome Library is free software; you can redistribute it and/or | ||
536 | * modify it under the terms of the GNU Lesser General Public License as | ||
537 | * published by the Free Software Foundation; either version 2 of the | ||
538 | * License, or (at your option) any later version. | ||
539 | * | ||
540 | * The Gnome Library is distributed in the hope that it will be useful, | ||
541 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
542 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
543 | * Lesser General Public License for more details. | ||
544 | * | ||
545 | * You should have received a copy of the GNU Lesser General Public | ||
546 | * License along with the Gnome Library; see the file COPYING.LIB. If not, | ||
547 | * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
548 | * Boston, MA 02111-1307, USA. | ||
549 | */ | ||
550 | |||
494 | #include "gunidecomp.h" | 551 | #include "gunidecomp.h" |
495 | #include "gunicomp.h" | 552 | #include "gunicomp.h" |
496 | 553 | ||
497 | #define CC_PART1(Page, Char) \ | 554 | #define CC_PART1(Page, Char) \ |
498 | ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ | 555 | ((combining_class_table_part1[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ |
499 | ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX) \ | 556 | ? (combining_class_table_part1[Page] - G_UNICODE_MAX_TABLE_INDEX) \ |
500 | : (cclass_data[combining_class_table_part1[Page]][Char])) | 557 | : (cclass_data[combining_class_table_part1[Page]][Char])) |
501 | 558 | ||
502 | #define CC_PART2(Page, Char) \ | 559 | #define CC_PART2(Page, Char) \ |
503 | ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ | 560 | ((combining_class_table_part2[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ |
504 | ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX) \ | 561 | ? (combining_class_table_part2[Page] - G_UNICODE_MAX_TABLE_INDEX) \ |
505 | : (cclass_data[combining_class_table_part2[Page]][Char])) | 562 | : (cclass_data[combining_class_table_part2[Page]][Char])) |
506 | 563 | ||
507 | #define COMBINING_CLASS(Char) \ | 564 | #define COMBINING_CLASS(Char) \ |
508 | (((Char) <= G_UNICODE_LAST_CHAR_PART1) \ | 565 | (((Char) <= G_UNICODE_LAST_CHAR_PART1) \ |
509 | ? CC_PART1 ((Char) >> 8, (Char) & 0xff) \ | 566 | ? CC_PART1 ((Char) >> 8, (Char) & 0xff) \ |
510 | : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR) \ | 567 | : (((Char) >= 0xe0000 && (Char) <= G_UNICODE_LAST_CHAR) \ |
511 | ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \ | 568 | ? CC_PART2 (((Char) - 0xe0000) >> 8, (Char) & 0xff) \ |
512 | : 0)) | 569 | : 0)) |
513 | 570 | ||
514 | /* constants for hangul syllable [de]composition */ | 571 | /* constants for hangul syllable [de]composition */ |
515 | #define SBase 0xAC00 | 572 | #define SBase 0xAC00 |
516 | #define LBase 0x1100 | 573 | #define LBase 0x1100 |
@@ -575,39 +632,26 @@ g_unicode_canonical_ordering (gunichar * string, gsize len) | |||
575 | * characters will always be big enough. */ | 632 | * characters will always be big enough. */ |
576 | static void | 633 | static void |
577 | decompose_hangul (gunichar s, gunichar * r, gsize * result_len) | 634 | decompose_hangul (gunichar s, gunichar * r, gsize * result_len) |
578 | { | 635 | { |
579 | gint SIndex = s - SBase; | 636 | gint SIndex = s - SBase; |
637 | gint TIndex = SIndex % TCount; | ||
580 | 638 | ||
581 | /* not a hangul syllable */ | 639 | if (r) |
582 | if (SIndex < 0 || SIndex >= SCount) | ||
583 | { | 640 | { |
584 | if (r) | 641 | r[0] = LBase + SIndex / NCount; |
585 | r[0] = s; | 642 | r[1] = VBase + (SIndex % NCount) / TCount; |
586 | *result_len = 1; | ||
587 | } | 643 | } |
588 | else | ||
589 | { | ||
590 | gunichar L = LBase + SIndex / NCount; | ||
591 | gunichar V = VBase + (SIndex % NCount) / TCount; | ||
592 | gunichar T = TBase + SIndex % TCount; | ||
593 | 644 | ||
645 | if (TIndex) | ||
646 | { | ||
594 | if (r) | 647 | if (r) |
595 | { | 648 | r[2] = TBase + TIndex; |
596 | r[0] = L; | 649 | *result_len = 3; |
597 | r[1] = V; | ||
598 | } | ||
599 | |||
600 | if (T != TBase) | ||
601 | { | ||
602 | if (r) | ||
603 | r[2] = T; | ||
604 | *result_len = 3; | ||
605 | } | ||
606 | else | ||
607 | *result_len = 2; | ||
608 | } | 650 | } |
651 | else | ||
652 | *result_len = 2; | ||
609 | } | 653 | } |
610 | 654 | ||
611 | /* returns a pointer to a null-terminated UTF-8 string */ | 655 | /* returns a pointer to a null-terminated UTF-8 string */ |
612 | static const gchar * | 656 | static const gchar * |
613 | find_decomposition (gunichar ch, gboolean compat) | 657 | find_decomposition (gunichar ch, gboolean compat) |
@@ -665,26 +709,26 @@ combine_hangul (gunichar a, gunichar b, gunichar * result) | |||
665 | { | 709 | { |
666 | *result = SBase + (LIndex * VCount + VIndex) * TCount; | 710 | *result = SBase + (LIndex * VCount + VIndex) * TCount; |
667 | return TRUE; | 711 | return TRUE; |
668 | } | 712 | } |
669 | else if (0 <= SIndex && SIndex < SCount && (SIndex % TCount) == 0 | 713 | else if (0 <= SIndex && SIndex < SCount && (SIndex % TCount) == 0 |
670 | && 0 <= TIndex && TIndex <= TCount) | 714 | && 0 < TIndex && TIndex < TCount) |
671 | { | 715 | { |
672 | *result = a + TIndex; | 716 | *result = a + TIndex; |
673 | return TRUE; | 717 | return TRUE; |
674 | } | 718 | } |
675 | 719 | ||
676 | return FALSE; | 720 | return FALSE; |
677 | } | 721 | } |
678 | 722 | ||
679 | #define CI(Page, Char) \ | 723 | #define CI(Page, Char) \ |
680 | ((compose_table[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ | 724 | ((compose_table[Page] >= G_UNICODE_MAX_TABLE_INDEX) \ |
681 | ? (compose_table[Page] - G_UNICODE_MAX_TABLE_INDEX) \ | 725 | ? (compose_table[Page] - G_UNICODE_MAX_TABLE_INDEX) \ |
682 | : (compose_data[compose_table[Page]][Char])) | 726 | : (compose_data[compose_table[Page]][Char])) |
683 | 727 | ||
684 | #define COMPOSE_INDEX(Char) \ | 728 | #define COMPOSE_INDEX(Char) \ |
685 | ((((Char) >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff)) | 729 | (((Char >> 8) > (COMPOSE_TABLE_LAST)) ? 0 : CI((Char) >> 8, (Char) & 0xff)) |
686 | 730 | ||
687 | static gboolean | 731 | static gboolean |
688 | combine (gunichar a, gunichar b, gunichar * result) | 732 | combine (gunichar a, gunichar b, gunichar * result) |
689 | { | 733 | { |
690 | gushort index_a, index_b; | 734 | gushort index_a, index_b; |
@@ -754,11 +798,11 @@ _g_utf8_normalize_wc (const gchar * str, gssize max_len, GNormalizeMode mode) | |||
754 | while ((max_len < 0 || p < str + max_len) && *p) | 798 | while ((max_len < 0 || p < str + max_len) && *p) |
755 | { | 799 | { |
756 | const gchar *decomp; | 800 | const gchar *decomp; |
757 | gunichar wc = g_utf8_get_char (p); | 801 | gunichar wc = g_utf8_get_char (p); |
758 | 802 | ||
759 | if (wc >= 0xac00 && wc <= 0xd7af) | 803 | if (wc >= SBase && wc < SBase + SCount) |
760 | { | 804 | { |
761 | gsize result_len; | 805 | gsize result_len; |
762 | decompose_hangul (wc, NULL, &result_len); | 806 | decompose_hangul (wc, NULL, &result_len); |
763 | n_wc += result_len; | 807 | n_wc += result_len; |
764 | } | 808 | } |
@@ -773,11 +817,11 @@ _g_utf8_normalize_wc (const gchar * str, gssize max_len, GNormalizeMode mode) | |||
773 | } | 817 | } |
774 | 818 | ||
775 | p = g_utf8_next_char (p); | 819 | p = g_utf8_next_char (p); |
776 | } | 820 | } |
777 | 821 | ||
778 | wc_buffer = g_new (gunichar, n_wc + 1); | 822 | wc_buffer = g_malloc (sizeof (gunichar) * (n_wc + 1)); |
779 | if (!wc_buffer) | 823 | if (!wc_buffer) |
780 | return NULL; | 824 | return NULL; |
781 | 825 | ||
782 | last_start = 0; | 826 | last_start = 0; |
783 | n_wc = 0; | 827 | n_wc = 0; |
@@ -787,11 +831,11 @@ _g_utf8_normalize_wc (const gchar * str, gssize max_len, GNormalizeMode mode) | |||
787 | gunichar wc = g_utf8_get_char (p); | 831 | gunichar wc = g_utf8_get_char (p); |
788 | const gchar *decomp; | 832 | const gchar *decomp; |
789 | int cc; | 833 | int cc; |
790 | gsize old_n_wc = n_wc; | 834 | gsize old_n_wc = n_wc; |
791 | 835 | ||
792 | if (wc >= 0xac00 && wc <= 0xd7af) | 836 | if (wc >= SBase && wc < SBase + SCount) |
793 | { | 837 | { |
794 | gsize result_len; | 838 | gsize result_len; |
795 | decompose_hangul (wc, wc_buffer + n_wc, &result_len); | 839 | decompose_hangul (wc, wc_buffer + n_wc, &result_len); |
796 | n_wc += result_len; | 840 | n_wc += result_len; |
797 | } | 841 | } |
@@ -826,11 +870,11 @@ _g_utf8_normalize_wc (const gchar * str, gssize max_len, GNormalizeMode mode) | |||
826 | 870 | ||
827 | if (n_wc > 0) | 871 | if (n_wc > 0) |
828 | { | 872 | { |
829 | g_unicode_canonical_ordering (wc_buffer + last_start, | 873 | g_unicode_canonical_ordering (wc_buffer + last_start, |
830 | n_wc - last_start); | 874 | n_wc - last_start); |
831 | last_start = n_wc; | 875 | // dead assignment: last_start = n_wc; |
832 | } | 876 | } |
833 | 877 | ||
834 | wc_buffer[n_wc] = 0; | 878 | wc_buffer[n_wc] = 0; |
835 | 879 | ||
836 | /* All decomposed and reordered */ | 880 | /* All decomposed and reordered */ |
@@ -882,53 +926,53 @@ _g_utf8_normalize_wc (const gchar * str, gssize max_len, GNormalizeMode mode) | |||
882 | * @mode: the type of normalization to perform. | 926 | * @mode: the type of normalization to perform. |
883 | * | 927 | * |
884 | * Converts a string into canonical form, standardizing | 928 | * Converts a string into canonical form, standardizing |
885 | * such issues as whether a character with an accent | 929 | * such issues as whether a character with an accent |
886 | * is represented as a base character and combining | 930 | * is represented as a base character and combining |
887 | * accent or as a single precomposed character. You | 931 | * accent or as a single precomposed character. The |
888 | * should generally call g_utf8_normalize() before | 932 | * string has to be valid UTF-8, otherwise %NULL is |
889 | * comparing two Unicode strings. | 933 | * returned. You should generally call g_utf8_normalize() |
934 | * before comparing two Unicode strings. | ||
890 | * | 935 | * |
891 | * The normalization mode %G_NORMALIZE_DEFAULT only | 936 | * The normalization mode %G_NORMALIZE_DEFAULT only |
892 | * standardizes differences that do not affect the | 937 | * standardizes differences that do not affect the |
893 | * text content, such as the above-mentioned accent | 938 | * text content, such as the above-mentioned accent |
894 | * representation. %G_NORMALIZE_ALL also standardizes | 939 | * representation. %G_NORMALIZE_ALL also standardizes |
895 | * the "compatibility" characters in Unicode, such | 940 | * the "compatibility" characters in Unicode, such |
896 | * as SUPERSCRIPT THREE to the standard forms | 941 | * as SUPERSCRIPT THREE to the standard forms |
897 | * (in this case DIGIT THREE). Formatting information | 942 | * (in this case DIGIT THREE). Formatting information |
898 | * may be lost but for most text operations such | 943 | * may be lost but for most text operations such |
899 | * characters should be considered the same. | 944 | * characters should be considered the same. |
900 | * For example, g_utf8_collate() normalizes | ||
901 | * with %G_NORMALIZE_ALL as its first step. | ||
902 | * | 945 | * |
903 | * %G_NORMALIZE_DEFAULT_COMPOSE and %G_NORMALIZE_ALL_COMPOSE | 946 | * %G_NORMALIZE_DEFAULT_COMPOSE and %G_NORMALIZE_ALL_COMPOSE |
904 | * are like %G_NORMALIZE_DEFAULT and %G_NORMALIZE_ALL, | 947 | * are like %G_NORMALIZE_DEFAULT and %G_NORMALIZE_ALL, |
905 | * but returned a result with composed forms rather | 948 | * but returned a result with composed forms rather |
906 | * than a maximally decomposed form. This is often | 949 | * than a maximally decomposed form. This is often |
907 | * useful if you intend to convert the string to | 950 | * useful if you intend to convert the string to |
908 | * a legacy encoding or pass it to a system with | 951 | * a legacy encoding or pass it to a system with |
909 | * less capable Unicode handling. | 952 | * less capable Unicode handling. |
910 | * | 953 | * |
911 | * Return value: a newly allocated string, that is the | 954 | * Return value: a newly allocated string, that is the |
912 | * normalized form of @str. | 955 | * normalized form of @str, or %NULL if @str is not |
956 | * valid UTF-8. | ||
913 | **/ | 957 | **/ |
914 | static gchar * | 958 | static gchar * |
915 | g_utf8_normalize (const gchar * str, gssize len, GNormalizeMode mode) | 959 | g_utf8_normalize (const gchar * str, gssize len, GNormalizeMode mode) |
916 | { | 960 | { |
917 | gunichar *result_wc = _g_utf8_normalize_wc (str, len, mode); | 961 | gunichar *result_wc = _g_utf8_normalize_wc (str, len, mode); |
918 | gchar *result; | 962 | gchar *result; |
919 | 963 | ||
920 | result = g_ucs4_to_utf8 (result_wc, -1, NULL, NULL, NULL); | 964 | result = g_ucs4_to_utf8 (result_wc, -1, NULL, NULL); |
921 | g_free (result_wc); | 965 | g_free (result_wc); |
922 | 966 | ||
923 | return result; | 967 | return result; |
924 | } | 968 | } |
925 | 969 | ||
926 | /* Public Libidn API starts here. */ | 970 | /* Public Libidn API starts here. */ |
927 | 971 | ||
928 | /** | 972 | /** |
929 | * stringprep_utf8_to_unichar - convert UTF-8 to Unicode code point | 973 | * stringprep_utf8_to_unichar: |
930 | * @p: a pointer to Unicode character encoded as UTF-8 | 974 | * @p: a pointer to Unicode character encoded as UTF-8 |
931 | * | 975 | * |
932 | * Converts a sequence of bytes encoded as UTF-8 to a Unicode character. | 976 | * Converts a sequence of bytes encoded as UTF-8 to a Unicode character. |
933 | * If @p does not point to a valid UTF-8 encoded character, results are | 977 | * If @p does not point to a valid UTF-8 encoded character, results are |
934 | * undefined. | 978 | * undefined. |
@@ -940,11 +984,11 @@ stringprep_utf8_to_unichar (const char *p) | |||
940 | { | 984 | { |
941 | return g_utf8_get_char (p); | 985 | return g_utf8_get_char (p); |
942 | } | 986 | } |
943 | 987 | ||
944 | /** | 988 | /** |
945 | * stringprep_unichar_to_utf8 - convert Unicode code point to UTF-8 | 989 | * stringprep_unichar_to_utf8: |
946 | * @c: a ISO10646 character code | 990 | * @c: a ISO10646 character code |
947 | * @outbuf: output buffer, must have at least 6 bytes of space. | 991 | * @outbuf: output buffer, must have at least 6 bytes of space. |
948 | * If %NULL, the length will be computed and returned | 992 | * If %NULL, the length will be computed and returned |
949 | * and nothing will be written to @outbuf. | 993 | * and nothing will be written to @outbuf. |
950 | * | 994 | * |
@@ -956,33 +1000,46 @@ int | |||
956 | stringprep_unichar_to_utf8 (uint32_t c, char *outbuf) | 1000 | stringprep_unichar_to_utf8 (uint32_t c, char *outbuf) |
957 | { | 1001 | { |
958 | return g_unichar_to_utf8 (c, outbuf); | 1002 | return g_unichar_to_utf8 (c, outbuf); |
959 | } | 1003 | } |
960 | 1004 | ||
1005 | #include <unistr.h> | ||
1006 | |||
961 | /** | 1007 | /** |
962 | * stringprep_utf8_to_ucs4 - convert UTF-8 string to UCS-4 | 1008 | * stringprep_utf8_to_ucs4: |
963 | * @str: a UTF-8 encoded string | 1009 | * @str: a UTF-8 encoded string |
964 | * @len: the maximum length of @str to use. If @len < 0, then | 1010 | * @len: the maximum length of @str to use. If @len < 0, then |
965 | * the string is nul-terminated. | 1011 | * the string is nul-terminated. |
966 | * @items_written: location to store the number of characters in the | 1012 | * @items_written: location to store the number of characters in the |
967 | * result, or %NULL. | 1013 | * result, or %NULL. |
968 | * | 1014 | * |
969 | * Convert a string from UTF-8 to a 32-bit fixed width | 1015 | * Convert a string from UTF-8 to a 32-bit fixed width representation |
970 | * representation as UCS-4, assuming valid UTF-8 input. | 1016 | * as UCS-4. The function now performs error checking to verify that |
971 | * This function does no error checking on the input. | 1017 | * the input is valid UTF-8 (before it was documented to not do error |
1018 | * checking). | ||
972 | * | 1019 | * |
973 | * Return value: a pointer to a newly allocated UCS-4 string. | 1020 | * Return value: a pointer to a newly allocated UCS-4 string. |
974 | * This value must be freed with free(). | 1021 | * This value must be deallocated by the caller. |
975 | **/ | 1022 | **/ |
976 | uint32_t * | 1023 | uint32_t * |
977 | stringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t * items_written) | 1024 | stringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t * items_written) |
978 | { | 1025 | { |
1026 | size_t n; | ||
1027 | |||
1028 | if (len < 0) | ||
1029 | n = strlen (str); | ||
1030 | else | ||
1031 | n = len; | ||
1032 | |||
1033 | if (u8_check ((const uint8_t *) str, n)) | ||
1034 | return NULL; | ||
1035 | |||
979 | return g_utf8_to_ucs4_fast (str, (glong) len, (glong *) items_written); | 1036 | return g_utf8_to_ucs4_fast (str, (glong) len, (glong *) items_written); |
980 | } | 1037 | } |
981 | 1038 | ||
982 | /** | 1039 | /** |
983 | * stringprep_ucs4_to_utf8 - convert UCS-4 string to UTF-8 | 1040 | * stringprep_ucs4_to_utf8: |
984 | * @str: a UCS-4 encoded string | 1041 | * @str: a UCS-4 encoded string |
985 | * @len: the maximum length of @str to use. If @len < 0, then | 1042 | * @len: the maximum length of @str to use. If @len < 0, then |
986 | * the string is terminated with a 0 character. | 1043 | * the string is terminated with a 0 character. |
987 | * @items_read: location to store number of characters read read, or %NULL. | 1044 | * @items_read: location to store number of characters read read, or %NULL. |
988 | * @items_written: location to store number of bytes written or %NULL. | 1045 | * @items_written: location to store number of bytes written or %NULL. |
@@ -991,24 +1048,23 @@ stringprep_utf8_to_ucs4 (const char *str, ssize_t len, size_t * items_written) | |||
991 | * | 1048 | * |
992 | * Convert a string from a 32-bit fixed width representation as UCS-4. | 1049 | * Convert a string from a 32-bit fixed width representation as UCS-4. |
993 | * to UTF-8. The result will be terminated with a 0 byte. | 1050 | * to UTF-8. The result will be terminated with a 0 byte. |
994 | * | 1051 | * |
995 | * Return value: a pointer to a newly allocated UTF-8 string. | 1052 | * Return value: a pointer to a newly allocated UTF-8 string. |
996 | * This value must be freed with free(). If an | 1053 | * This value must be deallocated by the caller. |
997 | * error occurs, %NULL will be returned and | 1054 | * If an error occurs, %NULL will be returned. |
998 | * @error set. | ||
999 | **/ | 1055 | **/ |
1000 | char * | 1056 | char * |
1001 | stringprep_ucs4_to_utf8 (const uint32_t * str, ssize_t len, | 1057 | stringprep_ucs4_to_utf8 (const uint32_t * str, ssize_t len, |
1002 | size_t * items_read, size_t * items_written) | 1058 | size_t * items_read, size_t * items_written) |
1003 | { | 1059 | { |
1004 | return g_ucs4_to_utf8 (str, len, (glong *) items_read, | 1060 | return g_ucs4_to_utf8 (str, len, (glong *) items_read, |
1005 | (glong *) items_written, NULL); | 1061 | (glong *) items_written); |
1006 | } | 1062 | } |
1007 | 1063 | ||
1008 | /** | 1064 | /** |
1009 | * stringprep_utf8_nfkc_normalize - normalize Unicode string | 1065 | * stringprep_utf8_nfkc_normalize: |
1010 | * @str: a UTF-8 encoded string. | 1066 | * @str: a UTF-8 encoded string. |
1011 | * @len: length of @str, in bytes, or -1 if @str is nul-terminated. | 1067 | * @len: length of @str, in bytes, or -1 if @str is nul-terminated. |
1012 | * | 1068 | * |
1013 | * Converts a string into canonical form, standardizing | 1069 | * Converts a string into canonical form, standardizing |
1014 | * such issues as whether a character with an accent | 1070 | * such issues as whether a character with an accent |
@@ -1032,22 +1088,22 @@ stringprep_utf8_nfkc_normalize (const char *str, ssize_t len) | |||
1032 | { | 1088 | { |
1033 | return g_utf8_normalize (str, len, G_NORMALIZE_NFKC); | 1089 | return g_utf8_normalize (str, len, G_NORMALIZE_NFKC); |
1034 | } | 1090 | } |
1035 | 1091 | ||
1036 | /** | 1092 | /** |
1037 | * stringprep_ucs4_nfkc_normalize - normalize Unicode string | 1093 | * stringprep_ucs4_nfkc_normalize: |
1038 | * @str: a Unicode string. | 1094 | * @str: a Unicode string. |
1039 | * @len: length of @str array, or -1 if @str is nul-terminated. | 1095 | * @len: length of @str array, or -1 if @str is nul-terminated. |
1040 | * | 1096 | * |
1041 | * Converts UCS4 string into UTF-8 and runs | 1097 | * Converts a UCS4 string into canonical form, see |
1042 | * stringprep_utf8_nfkc_normalize(). | 1098 | * stringprep_utf8_nfkc_normalize() for more information. |
1043 | * | 1099 | * |
1044 | * Return value: a newly allocated Unicode string, that is the NFKC | 1100 | * Return value: a newly allocated Unicode string, that is the NFKC |
1045 | * normalized form of @str. | 1101 | * normalized form of @str. |
1046 | **/ | 1102 | **/ |
1047 | uint32_t * | 1103 | uint32_t * |
1048 | stringprep_ucs4_nfkc_normalize (uint32_t * str, ssize_t len) | 1104 | stringprep_ucs4_nfkc_normalize (const uint32_t * str, ssize_t len) |
1049 | { | 1105 | { |
1050 | char *p; | 1106 | char *p; |
1051 | uint32_t *result_wc; | 1107 | uint32_t *result_wc; |
1052 | 1108 | ||
1053 | p = stringprep_ucs4_to_utf8 (str, len, 0, 0); | 1109 | p = stringprep_ucs4_to_utf8 (str, len, 0, 0); |
diff --git a/3rdParty/LibIDN/src/profiles.c b/3rdParty/LibIDN/src/profiles.c index f59305f..66c209a 100644 --- a/3rdParty/LibIDN/src/profiles.c +++ b/3rdParty/LibIDN/src/profiles.c | |||
@@ -1,26 +1,35 @@ | |||
1 | /* profiles.c --- Definitions of stringprep profiles. | 1 | /* profiles.c --- Definitions of stringprep profiles. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | ||
4 | * This file is part of GNU Libidn. | ||
5 | * | ||
6 | * GNU Libidn is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | ||
11 | * GNU Libidn is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU Lesser General Public | ||
17 | * License along with GNU Libidn; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | ||
19 | * | ||
20 | */ | ||
21 | 3 | ||
4 | This file is part of GNU Libidn. | ||
5 | |||
6 | GNU Libidn is free software: you can redistribute it and/or | ||
7 | modify it under the terms of either: | ||
8 | |||
9 | * the GNU Lesser General Public License as published by the Free | ||
10 | Software Foundation; either version 3 of the License, or (at | ||
11 | your option) any later version. | ||
12 | |||
13 | or | ||
14 | |||
15 | * the GNU General Public License as published by the Free | ||
16 | Software Foundation; either version 2 of the License, or (at | ||
17 | your option) any later version. | ||
18 | |||
19 | or both in parallel, as here. | ||
20 | |||
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
29 | |||
30 | #include <config.h> | ||
22 | #include "stringprep.h" | 31 | #include "stringprep.h" |
23 | 32 | ||
24 | const Stringprep_profiles stringprep_profiles[] = { | 33 | const Stringprep_profiles stringprep_profiles[] = { |
25 | {"Nameprep", stringprep_nameprep}, | 34 | {"Nameprep", stringprep_nameprep}, |
26 | {"KRBprep", stringprep_kerberos5}, /* Deprecate? */ | 35 | {"KRBprep", stringprep_kerberos5}, /* Deprecate? */ |
diff --git a/3rdParty/LibIDN/src/punycode.c b/3rdParty/LibIDN/src/punycode.c index 36ffee0..166569b 100644 --- a/3rdParty/LibIDN/src/punycode.c +++ b/3rdParty/LibIDN/src/punycode.c | |||
@@ -1,66 +1,74 @@ | |||
1 | /* punycode.c --- Implementation of punycode used to ASCII encode IDN's. | 1 | /* punycode.c --- Implementation of punycode used to ASCII encode IDN's. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | 3 | |
4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
5 | |||
6 | GNU Libidn is free software: you can redistribute it and/or | ||
7 | modify it under the terms of either: | ||
8 | |||
9 | * the GNU Lesser General Public License as published by the Free | ||
10 | Software Foundation; either version 3 of the License, or (at | ||
11 | your option) any later version. | ||
12 | |||
13 | or | ||
14 | |||
15 | * the GNU General Public License as published by the Free | ||
16 | Software Foundation; either version 2 of the License, or (at | ||
17 | your option) any later version. | ||
18 | |||
19 | or both in parallel, as here. | ||
20 | |||
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
29 | |||
30 | /* | ||
31 | * This file is derived from RFC 3492bis written by Adam M. Costello, | ||
32 | * downloaded from http://www.nicemice.net/idn/punycode-spec.gz on | ||
33 | * 2015-03-02 with SHA1 a966a8017f6be579d74a50a226accc7607c40133, a | ||
34 | * copy of which is stored in the GNU Libidn version controlled | ||
35 | * repository under doc/specification/punycode-spec.gz. | ||
5 | * | 36 | * |
6 | * GNU Libidn is free software; you can redistribute it and/or | 37 | * The changes compared to Adam's file include: re-indentation, adding |
7 | * modify it under the terms of the GNU Lesser General Public | 38 | * the license boilerplate and this comment, #include of config.h and |
8 | * License as published by the Free Software Foundation; either | 39 | * punycode.h, adding GTK-DOC comments, changing the return code of |
9 | * version 2.1 of the License, or (at your option) any later version. | 40 | * punycode_encode and punycode_decode from enum to int, renaming the |
41 | * input_length_orig function input variable to input_length (and | ||
42 | * renaming the internal input_length variable to input_len) in | ||
43 | * punycode_encode. | ||
10 | * | 44 | * |
11 | * GNU Libidn is distributed in the hope that it will be useful, | 45 | * Adam's file contains the following: |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | 46 | * |
16 | * You should have received a copy of the GNU Lesser General Public | 47 | * punycode-sample.c 2.0.0 (2004-Mar-21-Sun) |
17 | * License along with GNU Libidn; if not, write to the Free Software | 48 | * http://www.nicemice.net/idn/ |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 49 | * Adam M. Costello |
50 | * http://www.nicemice.net/amc/ | ||
19 | * | 51 | * |
20 | */ | 52 | * This is ANSI C code (C89) implementing Punycode 1.0.x. |
21 | |||
22 | /* | ||
23 | * This file is derived from RFC 3492bis written by Adam M. Costello. | ||
24 | * | 53 | * |
25 | * Disclaimer and license: Regarding this entire document or any | 54 | * Disclaimer and license: Regarding this entire document or any |
26 | * portion of it (including the pseudocode and C code), the author | 55 | * portion of it (including the pseudocode and C code), the author |
27 | * makes no guarantees and is not responsible for any damage resulting | 56 | * makes no guarantees and is not responsible for any damage resulting |
28 | * from its use. The author grants irrevocable permission to anyone | 57 | * from its use. The author grants irrevocable permission to anyone |
29 | * to use, modify, and distribute it in any way that does not diminish | 58 | * to use, modify, and distribute it in any way that does not diminish |
30 | * the rights of anyone else to use, modify, and distribute it, | 59 | * the rights of anyone else to use, modify, and distribute it, |
31 | * provided that redistributed derivative works do not contain | 60 | * provided that redistributed derivative works do not contain |
32 | * misleading author or version information. Derivative works need | 61 | * misleading author or version information. Derivative works need |
33 | * not be licensed under similar terms. | 62 | * not be licensed under similar terms. |
34 | * | ||
35 | * Copyright (C) The Internet Society (2003). All Rights Reserved. | ||
36 | * | ||
37 | * This document and translations of it may be copied and furnished to | ||
38 | * others, and derivative works that comment on or otherwise explain it | ||
39 | * or assist in its implementation may be prepared, copied, published | ||
40 | * and distributed, in whole or in part, without restriction of any | ||
41 | * kind, provided that the above copyright notice and this paragraph are | ||
42 | * included on all such copies and derivative works. However, this | ||
43 | * document itself may not be modified in any way, such as by removing | ||
44 | * the copyright notice or references to the Internet Society or other | ||
45 | * Internet organizations, except as needed for the purpose of | ||
46 | * developing Internet standards in which case the procedures for | ||
47 | * copyrights defined in the Internet Standards process must be | ||
48 | * followed, or as required to translate it into languages other than | ||
49 | * English. | ||
50 | * | ||
51 | * The limited permissions granted above are perpetual and will not be | ||
52 | * revoked by the Internet Society or its successors or assigns. | ||
53 | * | ||
54 | * This document and the information contained herein is provided on an | ||
55 | * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING | ||
56 | * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING | ||
57 | * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION | ||
58 | * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF | ||
59 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | ||
60 | */ | 63 | */ |
61 | 64 | ||
65 | #include <config.h> | ||
66 | |||
67 | /**********************************************************/ | ||
68 | /* Implementation (would normally go in its own .c file): */ | ||
69 | |||
62 | #include <string.h> | 70 | #include <string.h> |
63 | 71 | ||
64 | #include "punycode.h" | 72 | #include "punycode.h" |
65 | 73 | ||
66 | /*** Bootstring parameters for Punycode ***/ | 74 | /*** Bootstring parameters for Punycode ***/ |
@@ -146,11 +154,11 @@ adapt (punycode_uint delta, punycode_uint numpoints, int firsttime) | |||
146 | } | 154 | } |
147 | 155 | ||
148 | /*** Main encode function ***/ | 156 | /*** Main encode function ***/ |
149 | 157 | ||
150 | /** | 158 | /** |
151 | * punycode_encode - encode Unicode to Punycode | 159 | * punycode_encode: |
152 | * @input_length: The number of code points in the @input array and | 160 | * @input_length: The number of code points in the @input array and |
153 | * the number of flags in the @case_flags array. | 161 | * the number of flags in the @case_flags array. |
154 | * @input: An array of code points. They are presumed to be Unicode | 162 | * @input: An array of code points. They are presumed to be Unicode |
155 | * code points, but that is not strictly REQUIRED. The array | 163 | * code points, but that is not strictly REQUIRED. The array |
156 | * contains code points, not code units. UTF-16 uses code units | 164 | * contains code points, not code units. UTF-16 uses code units |
@@ -297,11 +305,11 @@ punycode_encode (size_t input_length, | |||
297 | } | 305 | } |
298 | 306 | ||
299 | /*** Main decode function ***/ | 307 | /*** Main decode function ***/ |
300 | 308 | ||
301 | /** | 309 | /** |
302 | * punycode_decode - decode Punycode to Unicode | 310 | * punycode_decode: |
303 | * @input_length: The number of ASCII code points in the @input array. | 311 | * @input_length: The number of ASCII code points in the @input array. |
304 | * @input: An array of ASCII code points (0..7F). | 312 | * @input: An array of ASCII code points (0..7F). |
305 | * @output_length: The caller passes in the maximum number of code | 313 | * @output_length: The caller passes in the maximum number of code |
306 | * points that it can receive into the @output array (which is also | 314 | * points that it can receive into the @output array (which is also |
307 | * the maximum number of flags that it can receive into the | 315 | * the maximum number of flags that it can receive into the |
@@ -413,11 +421,11 @@ punycode_decode (size_t input_length, | |||
413 | i %= (out + 1); | 421 | i %= (out + 1); |
414 | 422 | ||
415 | /* Insert n at position i of the output: */ | 423 | /* Insert n at position i of the output: */ |
416 | 424 | ||
417 | /* not needed for Punycode: */ | 425 | /* not needed for Punycode: */ |
418 | /* if (basic(n)) return punycode_invalid_input; */ | 426 | /* if (basic(n)) return punycode_bad_input; */ |
419 | if (out >= max_out) | 427 | if (out >= max_out) |
420 | return punycode_big_output; | 428 | return punycode_big_output; |
421 | 429 | ||
422 | if (case_flags) | 430 | if (case_flags) |
423 | { | 431 | { |
diff --git a/3rdParty/LibIDN/src/punycode.h b/3rdParty/LibIDN/src/punycode.h index 4872417..dff2105 100644 --- a/3rdParty/LibIDN/src/punycode.h +++ b/3rdParty/LibIDN/src/punycode.h | |||
@@ -1,74 +1,93 @@ | |||
1 | /* punycode.h --- Declarations for punycode functions. | 1 | /* punycode.h --- Declarations for punycode functions. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | 3 | |
4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
5 | |||
6 | GNU Libidn is free software: you can redistribute it and/or | ||
7 | modify it under the terms of either: | ||
8 | |||
9 | * the GNU Lesser General Public License as published by the Free | ||
10 | Software Foundation; either version 3 of the License, or (at | ||
11 | your option) any later version. | ||
12 | |||
13 | or | ||
14 | |||
15 | * the GNU General Public License as published by the Free | ||
16 | Software Foundation; either version 2 of the License, or (at | ||
17 | your option) any later version. | ||
18 | |||
19 | or both in parallel, as here. | ||
20 | |||
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
29 | |||
30 | /* | ||
31 | * This file is derived from RFC 3492bis written by Adam M. Costello, | ||
32 | * downloaded from http://www.nicemice.net/idn/punycode-spec.gz on | ||
33 | * 2015-03-02 with SHA1 a966a8017f6be579d74a50a226accc7607c40133, a | ||
34 | * copy of which is stored in the GNU Libidn version controlled | ||
35 | * repository under doc/specification/punycode-spec.gz. | ||
5 | * | 36 | * |
6 | * GNU Libidn is free software; you can redistribute it and/or | 37 | * The changes compared to Adam's file include: re-indentation, adding |
7 | * modify it under the terms of the GNU Lesser General Public | 38 | * the license boilerplate and this comment, adding the #ifndef |
8 | * License as published by the Free Software Foundation; either | 39 | * PUNYCODE_H and IDNAPI blocks, changing the return code of |
9 | * version 2.1 of the License, or (at your option) any later version. | 40 | * punycode_encode and punycode_decode from enum to int, simplifying |
41 | * the definition of punycode_uint by #include'ing idn-int.h and using | ||
42 | * uint32_t instead of limit.h-based code, adding Punycode_status and | ||
43 | * punycode_strerror, adding 'extern IDNAPI' declarations to function | ||
44 | * prototypes, and mentioning variable names in function prototypes. | ||
10 | * | 45 | * |
11 | * GNU Libidn is distributed in the hope that it will be useful, | 46 | * Adam's file contains the following: |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
14 | * Lesser General Public License for more details. | ||
15 | * | 47 | * |
16 | * You should have received a copy of the GNU Lesser General Public | 48 | * punycode-sample.c 2.0.0 (2004-Mar-21-Sun) |
17 | * License along with GNU Libidn; if not, write to the Free Software | 49 | * http://www.nicemice.net/idn/ |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 50 | * Adam M. Costello |
51 | * http://www.nicemice.net/amc/ | ||
19 | * | 52 | * |
20 | */ | 53 | * This is ANSI C code (C89) implementing Punycode 1.0.x. |
21 | |||
22 | /* | ||
23 | * This file is derived from RFC 3492bis written by Adam M. Costello. | ||
24 | * | 54 | * |
25 | * Disclaimer and license: Regarding this entire document or any | 55 | * Disclaimer and license: Regarding this entire document or any |
26 | * portion of it (including the pseudocode and C code), the author | 56 | * portion of it (including the pseudocode and C code), the author |
27 | * makes no guarantees and is not responsible for any damage resulting | 57 | * makes no guarantees and is not responsible for any damage resulting |
28 | * from its use. The author grants irrevocable permission to anyone | 58 | * from its use. The author grants irrevocable permission to anyone |
29 | * to use, modify, and distribute it in any way that does not diminish | 59 | * to use, modify, and distribute it in any way that does not diminish |
30 | * the rights of anyone else to use, modify, and distribute it, | 60 | * the rights of anyone else to use, modify, and distribute it, |
31 | * provided that redistributed derivative works do not contain | 61 | * provided that redistributed derivative works do not contain |
32 | * misleading author or version information. Derivative works need | 62 | * misleading author or version information. Derivative works need |
33 | * not be licensed under similar terms. | 63 | * not be licensed under similar terms. |
34 | * | ||
35 | * Copyright (C) The Internet Society (2003). All Rights Reserved. | ||
36 | * | ||
37 | * This document and translations of it may be copied and furnished to | ||
38 | * others, and derivative works that comment on or otherwise explain it | ||
39 | * or assist in its implementation may be prepared, copied, published | ||
40 | * and distributed, in whole or in part, without restriction of any | ||
41 | * kind, provided that the above copyright notice and this paragraph are | ||
42 | * included on all such copies and derivative works. However, this | ||
43 | * document itself may not be modified in any way, such as by removing | ||
44 | * the copyright notice or references to the Internet Society or other | ||
45 | * Internet organizations, except as needed for the purpose of | ||
46 | * developing Internet standards in which case the procedures for | ||
47 | * copyrights defined in the Internet Standards process must be | ||
48 | * followed, or as required to translate it into languages other than | ||
49 | * English. | ||
50 | * | ||
51 | * The limited permissions granted above are perpetual and will not be | ||
52 | * revoked by the Internet Society or its successors or assigns. | ||
53 | * | ||
54 | * This document and the information contained herein is provided on an | ||
55 | * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING | ||
56 | * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING | ||
57 | * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION | ||
58 | * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF | ||
59 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | ||
60 | */ | 64 | */ |
61 | 65 | ||
62 | #ifndef _PUNYCODE_H | 66 | #ifndef PUNYCODE_H |
63 | #define _PUNYCODE_H | 67 | # define PUNYCODE_H |
68 | |||
69 | # ifndef IDNAPI | ||
70 | # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY | ||
71 | # define IDNAPI __attribute__((__visibility__("default"))) | ||
72 | # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC | ||
73 | # define IDNAPI __declspec(dllexport) | ||
74 | # elif defined _MSC_VER && ! defined LIBIDN_STATIC | ||
75 | # define IDNAPI __declspec(dllimport) | ||
76 | # else | ||
77 | # define IDNAPI | ||
78 | # endif | ||
79 | # endif | ||
64 | 80 | ||
65 | #ifdef __cplusplus | 81 | #ifdef __cplusplus |
66 | extern "C" | 82 | extern "C" |
67 | { | 83 | { |
68 | #endif | 84 | #endif |
69 | 85 | ||
86 | /************************************************************/ | ||
87 | /* Public interface (would normally go in its own .h file): */ | ||
88 | |||
70 | #include <stddef.h> /* size_t */ | 89 | #include <stddef.h> /* size_t */ |
71 | #include <idn-int.h> /* uint32_t */ | 90 | #include <idn-int.h> /* uint32_t */ |
72 | 91 | ||
73 | enum punycode_status | 92 | enum punycode_status |
74 | { | 93 | { |
@@ -84,21 +103,23 @@ extern "C" | |||
84 | PUNYCODE_BAD_INPUT = punycode_bad_input, | 103 | PUNYCODE_BAD_INPUT = punycode_bad_input, |
85 | PUNYCODE_BIG_OUTPUT = punycode_big_output, | 104 | PUNYCODE_BIG_OUTPUT = punycode_big_output, |
86 | PUNYCODE_OVERFLOW = punycode_overflow | 105 | PUNYCODE_OVERFLOW = punycode_overflow |
87 | } Punycode_status; | 106 | } Punycode_status; |
88 | 107 | ||
89 | extern const char *punycode_strerror (Punycode_status rc); | 108 | extern IDNAPI const char *punycode_strerror (Punycode_status rc); |
90 | 109 | ||
91 | /* punycode_uint needs to be unsigned and needs to be */ | 110 | /* punycode_uint needs to be unsigned and needs to be */ |
92 | /* at least 26 bits wide. */ | 111 | /* at least 26 bits wide. The particular type can be */ |
112 | /* specified by defining PUNYCODE_UINT, otherwise a */ | ||
113 | /* suitable type will be chosen automatically. */ | ||
93 | 114 | ||
94 | typedef uint32_t punycode_uint; | 115 | typedef uint32_t punycode_uint; |
95 | 116 | ||
96 | extern int punycode_encode (size_t input_length, | 117 | extern IDNAPI int punycode_encode (size_t input_length, |
97 | const punycode_uint input[], | 118 | const punycode_uint input[], |
98 | const unsigned char case_flags[], | 119 | const unsigned char case_flags[], |
99 | size_t * output_length, char output[]); | 120 | size_t * output_length, char output[]); |
100 | 121 | ||
101 | /* | 122 | /* |
102 | punycode_encode() converts a sequence of code points (presumed to be | 123 | punycode_encode() converts a sequence of code points (presumed to be |
103 | Unicode code points) to Punycode. | 124 | Unicode code points) to Punycode. |
104 | 125 | ||
@@ -108,11 +129,11 @@ extern "C" | |||
108 | The number of code points in the input array and the number | 129 | The number of code points in the input array and the number |
109 | of flags in the case_flags array. | 130 | of flags in the case_flags array. |
110 | 131 | ||
111 | input | 132 | input |
112 | An array of code points. They are presumed to be Unicode | 133 | An array of code points. They are presumed to be Unicode |
113 | code points, but that is not strictly REQUIRED. The | 134 | code points, but that is not strictly necessary. The |
114 | array contains code points, not code units. UTF-16 uses | 135 | array contains code points, not code units. UTF-16 uses |
115 | code units D800 through DFFF to refer to code points | 136 | code units D800 through DFFF to refer to code points |
116 | 10000..10FFFF. The code points D800..DFFF do not occur in | 137 | 10000..10FFFF. The code points D800..DFFF do not occur in |
117 | any valid Unicode string. The code points that can occur in | 138 | any valid Unicode string. The code points that can occur in |
118 | Unicode strings (0..D7FF and E000..10FFFF) are also called | 139 | Unicode strings (0..D7FF and E000..10FFFF) are also called |
@@ -151,15 +172,15 @@ extern "C" | |||
151 | Can be any of the punycode_status values defined above except | 172 | Can be any of the punycode_status values defined above except |
152 | punycode_bad_input. If not punycode_success, then output_size | 173 | punycode_bad_input. If not punycode_success, then output_size |
153 | and output might contain garbage. | 174 | and output might contain garbage. |
154 | */ | 175 | */ |
155 | 176 | ||
156 | extern int punycode_decode (size_t input_length, | 177 | extern IDNAPI int punycode_decode (size_t input_length, |
157 | const char input[], | 178 | const char input[], |
158 | size_t * output_length, | 179 | size_t * output_length, |
159 | punycode_uint output[], | 180 | punycode_uint output[], |
160 | unsigned char case_flags[]); | 181 | unsigned char case_flags[]); |
161 | 182 | ||
162 | /* | 183 | /* |
163 | punycode_decode() converts Punycode to a sequence of code points | 184 | punycode_decode() converts Punycode to a sequence of code points |
164 | (presumed to be Unicode code points). | 185 | (presumed to be Unicode code points). |
165 | 186 | ||
@@ -213,6 +234,6 @@ extern "C" | |||
213 | */ | 234 | */ |
214 | 235 | ||
215 | #ifdef __cplusplus | 236 | #ifdef __cplusplus |
216 | } | 237 | } |
217 | #endif | 238 | #endif |
218 | #endif /* _PUNYCODE_H */ | 239 | #endif /* PUNYCODE_H */ |
diff --git a/3rdParty/LibIDN/src/rfc3454.c b/3rdParty/LibIDN/src/rfc3454.c index 856b67a..f4e411f 100644 --- a/3rdParty/LibIDN/src/rfc3454.c +++ b/3rdParty/LibIDN/src/rfc3454.c | |||
@@ -1,8 +1,9 @@ | |||
1 | /* This file is automatically generated. DO NOT EDIT! | 1 | /* This file is automatically generated. DO NOT EDIT! |
2 | Instead, edit gen-stringprep-tables.pl and re-run. */ | 2 | Instead, edit gen-stringprep-tables.pl and re-run. */ |
3 | 3 | ||
4 | #include <config.h> | ||
4 | #include "stringprep.h" | 5 | #include "stringprep.h" |
5 | 6 | ||
6 | /* | 7 | /* |
7 | * So we can use this material. There may be other legal analysis that | 8 | * So we can use this material. There may be other legal analysis that |
8 | * also reach the same conclusion. | 9 | * also reach the same conclusion. |
diff --git a/3rdParty/LibIDN/src/stringprep.c b/3rdParty/LibIDN/src/stringprep.c index 96fa316..8ff28e6 100644 --- a/3rdParty/LibIDN/src/stringprep.c +++ b/3rdParty/LibIDN/src/stringprep.c | |||
@@ -1,25 +1,33 @@ | |||
1 | /* stringprep.c --- Core stringprep implementation. | 1 | /* stringprep.c --- Core stringprep implementation. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | 3 | |
4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
5 | * | 5 | |
6 | * GNU Libidn is free software; you can redistribute it and/or | 6 | GNU Libidn is free software: you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of either: |
8 | * License as published by the Free Software Foundation; either | 8 | |
9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * the GNU Lesser General Public License as published by the Free |
10 | * | 10 | Software Foundation; either version 3 of the License, or (at |
11 | * GNU Libidn is distributed in the hope that it will be useful, | 11 | your option) any later version. |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | or |
14 | * Lesser General Public License for more details. | 14 | |
15 | * | 15 | * the GNU General Public License as published by the Free |
16 | * You should have received a copy of the GNU Lesser General Public | 16 | Software Foundation; either version 2 of the License, or (at |
17 | * License along with GNU Libidn; if not, write to the Free Software | 17 | your option) any later version. |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 18 | |
19 | * | 19 | or both in parallel, as here. |
20 | */ | 20 | |
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
21 | 29 | ||
22 | #ifdef HAVE_CONFIG_H | 30 | #ifdef HAVE_CONFIG_H |
23 | # include "config.h" | 31 | # include "config.h" |
24 | #endif | 32 | #endif |
25 | 33 | ||
@@ -102,11 +110,11 @@ stringprep_apply_table_to_string (uint32_t * ucs4, | |||
102 | #define UNAPPLICAPLEFLAGS(flags, profileflags) \ | 110 | #define UNAPPLICAPLEFLAGS(flags, profileflags) \ |
103 | ((!INVERTED(profileflags) && !(profileflags & flags) && profileflags) || \ | 111 | ((!INVERTED(profileflags) && !(profileflags & flags) && profileflags) || \ |
104 | ( INVERTED(profileflags) && (profileflags & flags))) | 112 | ( INVERTED(profileflags) && (profileflags & flags))) |
105 | 113 | ||
106 | /** | 114 | /** |
107 | * stringprep_4i - prepare internationalized string | 115 | * stringprep_4i: |
108 | * @ucs4: input/output array with string to prepare. | 116 | * @ucs4: input/output array with string to prepare. |
109 | * @len: on input, length of input array with Unicode code points, | 117 | * @len: on input, length of input array with Unicode code points, |
110 | * on exit, length of output array with Unicode code points. | 118 | * on exit, length of output array with Unicode code points. |
111 | * @maxucs4len: maximum length of input/output array. | 119 | * @maxucs4len: maximum length of input/output array. |
112 | * @flags: a #Stringprep_profile_flags value, or 0. | 120 | * @flags: a #Stringprep_profile_flags value, or 0. |
@@ -290,11 +298,11 @@ stringprep_4zi_1 (uint32_t * ucs4, size_t ucs4len, size_t maxucs4len, | |||
290 | 298 | ||
291 | return STRINGPREP_OK; | 299 | return STRINGPREP_OK; |
292 | } | 300 | } |
293 | 301 | ||
294 | /** | 302 | /** |
295 | * stringprep_4zi - prepare internationalized string | 303 | * stringprep_4zi: |
296 | * @ucs4: input/output array with zero terminated string to prepare. | 304 | * @ucs4: input/output array with zero terminated string to prepare. |
297 | * @maxucs4len: maximum length of input/output array. | 305 | * @maxucs4len: maximum length of input/output array. |
298 | * @flags: a #Stringprep_profile_flags value, or 0. | 306 | * @flags: a #Stringprep_profile_flags value, or 0. |
299 | * @profile: pointer to #Stringprep_profile to use. | 307 | * @profile: pointer to #Stringprep_profile to use. |
300 | * | 308 | * |
@@ -327,11 +335,11 @@ stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, | |||
327 | 335 | ||
328 | return stringprep_4zi_1 (ucs4, ucs4len, maxucs4len, flags, profile); | 336 | return stringprep_4zi_1 (ucs4, ucs4len, maxucs4len, flags, profile); |
329 | } | 337 | } |
330 | 338 | ||
331 | /** | 339 | /** |
332 | * stringprep - prepare internationalized string | 340 | * stringprep: |
333 | * @in: input/ouput array with string to prepare. | 341 | * @in: input/ouput array with string to prepare. |
334 | * @maxlen: maximum length of input/output array. | 342 | * @maxlen: maximum length of input/output array. |
335 | * @flags: a #Stringprep_profile_flags value, or 0. | 343 | * @flags: a #Stringprep_profile_flags value, or 0. |
336 | * @profile: pointer to #Stringprep_profile to use. | 344 | * @profile: pointer to #Stringprep_profile to use. |
337 | * | 345 | * |
@@ -368,13 +376,14 @@ stringprep (char *in, | |||
368 | 376 | ||
369 | do | 377 | do |
370 | { | 378 | { |
371 | uint32_t *newp; | 379 | uint32_t *newp; |
372 | 380 | ||
373 | if (ucs4) | 381 | free (ucs4); |
374 | free (ucs4); | ||
375 | ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len); | 382 | ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len); |
383 | if (ucs4 == NULL) | ||
384 | return STRINGPREP_ICONV_ERROR; | ||
376 | maxucs4len = ucs4len + adducs4len; | 385 | maxucs4len = ucs4len + adducs4len; |
377 | newp = realloc (ucs4, maxucs4len * sizeof (uint32_t)); | 386 | newp = realloc (ucs4, maxucs4len * sizeof (uint32_t)); |
378 | if (!newp) | 387 | if (!newp) |
379 | { | 388 | { |
380 | free (ucs4); | 389 | free (ucs4); |
@@ -393,11 +402,11 @@ stringprep (char *in, | |||
393 | } | 402 | } |
394 | 403 | ||
395 | utf8 = stringprep_ucs4_to_utf8 (ucs4, ucs4len, 0, 0); | 404 | utf8 = stringprep_ucs4_to_utf8 (ucs4, ucs4len, 0, 0); |
396 | free (ucs4); | 405 | free (ucs4); |
397 | if (!utf8) | 406 | if (!utf8) |
398 | return STRINGPREP_MALLOC_ERROR; | 407 | return STRINGPREP_ICONV_ERROR; |
399 | 408 | ||
400 | if (strlen (utf8) >= maxlen) | 409 | if (strlen (utf8) >= maxlen) |
401 | { | 410 | { |
402 | free (utf8); | 411 | free (utf8); |
403 | return STRINGPREP_TOO_SMALL_BUFFER; | 412 | return STRINGPREP_TOO_SMALL_BUFFER; |
@@ -409,11 +418,11 @@ stringprep (char *in, | |||
409 | 418 | ||
410 | return STRINGPREP_OK; | 419 | return STRINGPREP_OK; |
411 | } | 420 | } |
412 | 421 | ||
413 | /** | 422 | /** |
414 | * stringprep_profile - prepare internationalized string | 423 | * stringprep_profile: |
415 | * @in: input array with UTF-8 string to prepare. | 424 | * @in: input array with UTF-8 string to prepare. |
416 | * @out: output variable with pointer to newly allocate string. | 425 | * @out: output variable with pointer to newly allocate string. |
417 | * @profile: name of stringprep profile to use. | 426 | * @profile: name of stringprep profile to use. |
418 | * @flags: a #Stringprep_profile_flags value, or 0. | 427 | * @flags: a #Stringprep_profile_flags value, or 0. |
419 | * | 428 | * |
@@ -451,12 +460,11 @@ stringprep_profile (const char *in, | |||
451 | if (!p || !p->name || !p->tables) | 460 | if (!p || !p->name || !p->tables) |
452 | return STRINGPREP_UNKNOWN_PROFILE; | 461 | return STRINGPREP_UNKNOWN_PROFILE; |
453 | 462 | ||
454 | do | 463 | do |
455 | { | 464 | { |
456 | if (str) | 465 | free (str); |
457 | free (str); | ||
458 | str = (char *) malloc (len); | 466 | str = (char *) malloc (len); |
459 | if (str == NULL) | 467 | if (str == NULL) |
460 | return STRINGPREP_MALLOC_ERROR; | 468 | return STRINGPREP_MALLOC_ERROR; |
461 | 469 | ||
462 | strcpy (str, in); | 470 | strcpy (str, in); |
@@ -582,10 +590,11 @@ stringprep_profile (const char *in, | |||
582 | * This usually indicate an internal error in the library. | 590 | * This usually indicate an internal error in the library. |
583 | * @STRINGPREP_FLAG_ERROR: The supplied flag conflicted with profile. | 591 | * @STRINGPREP_FLAG_ERROR: The supplied flag conflicted with profile. |
584 | * This usually indicate a problem in the calling application. | 592 | * This usually indicate a problem in the calling application. |
585 | * @STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not | 593 | * @STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not |
586 | * known to the library. | 594 | * known to the library. |
595 | * @STRINGPREP_ICONV_ERROR: Could not convert string in locale encoding. | ||
587 | * @STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed. This | 596 | * @STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed. This |
588 | * usually indicate an internal error in the library. | 597 | * usually indicate an internal error in the library. |
589 | * @STRINGPREP_MALLOC_ERROR: The malloc() was out of memory. This is | 598 | * @STRINGPREP_MALLOC_ERROR: The malloc() was out of memory. This is |
590 | * usually a fatal error. | 599 | * usually a fatal error. |
591 | * | 600 | * |
@@ -609,10 +618,18 @@ stringprep_profile (const char *in, | |||
609 | * Stringprep profile flags. | 618 | * Stringprep profile flags. |
610 | */ | 619 | */ |
611 | 620 | ||
612 | /** | 621 | /** |
613 | * Stringprep_profile_steps: | 622 | * Stringprep_profile_steps: |
623 | * @STRINGPREP_NFKC: The NFKC step. | ||
624 | * @STRINGPREP_BIDI: The BIDI step. | ||
625 | * @STRINGPREP_MAP_TABLE: The MAP step. | ||
626 | * @STRINGPREP_UNASSIGNED_TABLE: The Unassigned step. | ||
627 | * @STRINGPREP_PROHIBIT_TABLE: The Prohibited step. | ||
628 | * @STRINGPREP_BIDI_PROHIBIT_TABLE: The BIDI-Prohibited step. | ||
629 | * @STRINGPREP_BIDI_RAL_TABLE: The BIDI-RAL step. | ||
630 | * @STRINGPREP_BIDI_L_TABLE: The BIDI-L step. | ||
614 | * | 631 | * |
615 | * Various steps in the stringprep algorithm. You really want to | 632 | * Various steps in the stringprep algorithm. You really want to |
616 | * study the source code to understand this one. Only useful if you | 633 | * study the source code to understand this one. Only useful if you |
617 | * want to add another profile. | 634 | * want to add another profile. |
618 | */ | 635 | */ |
diff --git a/3rdParty/LibIDN/src/stringprep.h b/3rdParty/LibIDN/src/stringprep.h index fa822e8..d69faa7 100644 --- a/3rdParty/LibIDN/src/stringprep.h +++ b/3rdParty/LibIDN/src/stringprep.h | |||
@@ -1,53 +1,59 @@ | |||
1 | /* stringprep.h --- Header file for stringprep functions. | 1 | /* stringprep.h --- Header file for stringprep functions. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | 3 | |
4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
5 | * | 5 | |
6 | * GNU Libidn is free software; you can redistribute it and/or | 6 | GNU Libidn is free software: you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of either: |
8 | * License as published by the Free Software Foundation; either | 8 | |
9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * the GNU Lesser General Public License as published by the Free |
10 | * | 10 | Software Foundation; either version 3 of the License, or (at |
11 | * GNU Libidn is distributed in the hope that it will be useful, | 11 | your option) any later version. |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | or |
14 | * Lesser General Public License for more details. | 14 | |
15 | * | 15 | * the GNU General Public License as published by the Free |
16 | * You should have received a copy of the GNU Lesser General Public | 16 | Software Foundation; either version 2 of the License, or (at |
17 | * License along with GNU Libidn; if not, write to the Free Software | 17 | your option) any later version. |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 18 | |
19 | * | 19 | or both in parallel, as here. |
20 | */ | 20 | |
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
21 | 29 | ||
22 | #ifndef STRINGPREP_H | 30 | #ifndef STRINGPREP_H |
23 | # define STRINGPREP_H | 31 | # define STRINGPREP_H |
24 | 32 | ||
25 | # include <stddef.h> /* size_t */ | 33 | # ifndef IDNAPI |
26 | # include <unistd.h> /* ssize_t */ | 34 | # if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY |
27 | # include <idn-int.h> /* uint32_t */ | 35 | # define IDNAPI __attribute__((__visibility__("default"))) |
28 | 36 | # elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC | |
29 | /* Libidn Windows DLL. Only needed when this file is used in Visual | 37 | # define IDNAPI __declspec(dllexport) |
30 | Studio. Export and import happens automatically in MinGW. */ | 38 | # elif defined _MSC_VER && ! defined LIBIDN_STATIC |
31 | # ifndef IDNA_API | 39 | # define IDNAPI __declspec(dllimport) |
32 | # if defined(_MSC_VER) && !defined(IDNA_STATIC) | ||
33 | # ifdef IDNA_EXPORTS | ||
34 | # define IDNA_API __declspec(dllexport) | ||
35 | # else | ||
36 | # define IDNA_API __declspec(dllimport) | ||
37 | # endif | ||
38 | # else | 40 | # else |
39 | # define IDNA_API | 41 | # define IDNAPI |
40 | # endif | 42 | # endif |
41 | # endif | 43 | # endif |
42 | 44 | ||
45 | # include <stddef.h> /* size_t */ | ||
46 | # include <sys/types.h> /* ssize_t */ | ||
47 | # include <idn-int.h> /* uint32_t */ | ||
48 | |||
43 | # ifdef __cplusplus | 49 | # ifdef __cplusplus |
44 | extern "C" | 50 | extern "C" |
45 | { | 51 | { |
46 | # endif | 52 | # endif |
47 | 53 | ||
48 | # define STRINGPREP_VERSION "1.11" | 54 | # define STRINGPREP_VERSION "1.32" |
49 | 55 | ||
50 | /* Error codes. */ | 56 | /* Error codes. */ |
51 | typedef enum | 57 | typedef enum |
52 | { | 58 | { |
53 | STRINGPREP_OK = 0, | 59 | STRINGPREP_OK = 0, |
@@ -60,10 +66,11 @@ extern "C" | |||
60 | /* Error in calling application. */ | 66 | /* Error in calling application. */ |
61 | STRINGPREP_TOO_SMALL_BUFFER = 100, | 67 | STRINGPREP_TOO_SMALL_BUFFER = 100, |
62 | STRINGPREP_PROFILE_ERROR = 101, | 68 | STRINGPREP_PROFILE_ERROR = 101, |
63 | STRINGPREP_FLAG_ERROR = 102, | 69 | STRINGPREP_FLAG_ERROR = 102, |
64 | STRINGPREP_UNKNOWN_PROFILE = 103, | 70 | STRINGPREP_UNKNOWN_PROFILE = 103, |
71 | STRINGPREP_ICONV_ERROR = 104, | ||
65 | /* Internal errors. */ | 72 | /* Internal errors. */ |
66 | STRINGPREP_NFKC_FAILED = 200, | 73 | STRINGPREP_NFKC_FAILED = 200, |
67 | STRINGPREP_MALLOC_ERROR = 201 | 74 | STRINGPREP_MALLOC_ERROR = 201 |
68 | } Stringprep_rc; | 75 | } Stringprep_rc; |
69 | 76 | ||
@@ -111,122 +118,124 @@ extern "C" | |||
111 | const char *name; | 118 | const char *name; |
112 | const Stringprep_profile *tables; | 119 | const Stringprep_profile *tables; |
113 | }; | 120 | }; |
114 | typedef struct Stringprep_profiles Stringprep_profiles; | 121 | typedef struct Stringprep_profiles Stringprep_profiles; |
115 | 122 | ||
116 | extern IDNA_API const Stringprep_profiles stringprep_profiles[]; | 123 | extern IDNAPI const Stringprep_profiles stringprep_profiles[]; |
117 | 124 | ||
118 | /* Profiles */ | 125 | /* Profiles */ |
119 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_A_1[]; | 126 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_A_1[]; |
120 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_B_1[]; | 127 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_1[]; |
121 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_B_2[]; | 128 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_2[]; |
122 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_B_3[]; | 129 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_B_3[]; |
123 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_1_1[]; | 130 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_1[]; |
124 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_1_2[]; | 131 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_1_2[]; |
125 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_2_1[]; | 132 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_1[]; |
126 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_2_2[]; | 133 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_2_2[]; |
127 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_3[]; | 134 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_3[]; |
128 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_4[]; | 135 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_4[]; |
129 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_5[]; | 136 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_5[]; |
130 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_6[]; | 137 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_6[]; |
131 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_7[]; | 138 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_7[]; |
132 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_8[]; | 139 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_8[]; |
133 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_C_9[]; | 140 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_C_9[]; |
134 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_D_1[]; | 141 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_1[]; |
135 | extern IDNA_API const Stringprep_table_element stringprep_rfc3454_D_2[]; | 142 | extern IDNAPI const Stringprep_table_element stringprep_rfc3454_D_2[]; |
136 | 143 | ||
137 | /* Nameprep */ | 144 | /* Nameprep */ |
138 | 145 | ||
139 | extern IDNA_API const Stringprep_profile stringprep_nameprep[]; | 146 | extern IDNAPI const Stringprep_profile stringprep_nameprep[]; |
140 | 147 | ||
141 | # define stringprep_nameprep(in, maxlen) \ | 148 | # define stringprep_nameprep(in, maxlen) \ |
142 | stringprep(in, maxlen, 0, stringprep_nameprep) | 149 | stringprep(in, maxlen, 0, stringprep_nameprep) |
143 | 150 | ||
144 | # define stringprep_nameprep_no_unassigned(in, maxlen) \ | 151 | # define stringprep_nameprep_no_unassigned(in, maxlen) \ |
145 | stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep) | 152 | stringprep(in, maxlen, STRINGPREP_NO_UNASSIGNED, stringprep_nameprep) |
146 | 153 | ||
147 | /* SASL */ | 154 | /* SASL */ |
148 | 155 | ||
149 | extern IDNA_API const Stringprep_profile stringprep_saslprep[]; | 156 | extern IDNAPI const Stringprep_profile stringprep_saslprep[]; |
150 | extern IDNA_API const Stringprep_profile stringprep_plain[]; | 157 | extern IDNAPI const Stringprep_table_element stringprep_saslprep_space_map[]; |
151 | extern IDNA_API const Stringprep_profile stringprep_trace[]; | 158 | extern IDNAPI const Stringprep_profile stringprep_plain[]; |
159 | extern IDNAPI const Stringprep_profile stringprep_trace[]; | ||
152 | 160 | ||
153 | # define stringprep_plain(in, maxlen) \ | 161 | # define stringprep_plain(in, maxlen) \ |
154 | stringprep(in, maxlen, 0, stringprep_plain) | 162 | stringprep(in, maxlen, 0, stringprep_plain) |
155 | 163 | ||
156 | /* Kerberos */ | 164 | /* Kerberos */ |
157 | 165 | ||
158 | extern IDNA_API const Stringprep_profile stringprep_kerberos5[]; | 166 | extern IDNAPI const Stringprep_profile stringprep_kerberos5[]; |
159 | 167 | ||
160 | # define stringprep_kerberos5(in, maxlen) \ | 168 | # define stringprep_kerberos5(in, maxlen) \ |
161 | stringprep(in, maxlen, 0, stringprep_kerberos5) | 169 | stringprep(in, maxlen, 0, stringprep_kerberos5) |
162 | 170 | ||
163 | /* XMPP */ | 171 | /* XMPP */ |
164 | 172 | ||
165 | extern IDNA_API const Stringprep_profile stringprep_xmpp_nodeprep[]; | 173 | extern IDNAPI const Stringprep_profile stringprep_xmpp_nodeprep[]; |
166 | extern IDNA_API const Stringprep_profile stringprep_xmpp_resourceprep[]; | 174 | extern IDNAPI const Stringprep_profile stringprep_xmpp_resourceprep[]; |
167 | extern IDNA_API const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[]; | 175 | extern IDNAPI const Stringprep_table_element stringprep_xmpp_nodeprep_prohibit[]; |
168 | 176 | ||
169 | # define stringprep_xmpp_nodeprep(in, maxlen) \ | 177 | # define stringprep_xmpp_nodeprep(in, maxlen) \ |
170 | stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep) | 178 | stringprep(in, maxlen, 0, stringprep_xmpp_nodeprep) |
171 | # define stringprep_xmpp_resourceprep(in, maxlen) \ | 179 | # define stringprep_xmpp_resourceprep(in, maxlen) \ |
172 | stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep) | 180 | stringprep(in, maxlen, 0, stringprep_xmpp_resourceprep) |
173 | 181 | ||
174 | /* iSCSI */ | 182 | /* iSCSI */ |
175 | 183 | ||
176 | extern IDNA_API const Stringprep_profile stringprep_iscsi[]; | 184 | extern IDNAPI const Stringprep_profile stringprep_iscsi[]; |
185 | extern IDNAPI const Stringprep_table_element stringprep_iscsi_prohibit[]; | ||
177 | 186 | ||
178 | # define stringprep_iscsi(in, maxlen) \ | 187 | # define stringprep_iscsi(in, maxlen) \ |
179 | stringprep(in, maxlen, 0, stringprep_iscsi) | 188 | stringprep(in, maxlen, 0, stringprep_iscsi) |
180 | 189 | ||
181 | /* API */ | 190 | /* API */ |
182 | 191 | ||
183 | extern IDNA_API int stringprep_4i (uint32_t * ucs4, size_t * len, | 192 | extern IDNAPI int stringprep_4i (uint32_t * ucs4, size_t * len, |
184 | size_t maxucs4len, | 193 | size_t maxucs4len, |
185 | Stringprep_profile_flags flags, | 194 | Stringprep_profile_flags flags, |
186 | const Stringprep_profile * profile); | 195 | const Stringprep_profile * profile); |
187 | extern IDNA_API int stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, | 196 | extern IDNAPI int stringprep_4zi (uint32_t * ucs4, size_t maxucs4len, |
188 | Stringprep_profile_flags flags, | 197 | Stringprep_profile_flags flags, |
189 | const Stringprep_profile * profile); | 198 | const Stringprep_profile * profile); |
190 | extern IDNA_API int stringprep (char *in, size_t maxlen, | 199 | extern IDNAPI int stringprep (char *in, size_t maxlen, |
191 | Stringprep_profile_flags flags, | 200 | Stringprep_profile_flags flags, |
192 | const Stringprep_profile * profile); | 201 | const Stringprep_profile * profile); |
193 | 202 | ||
194 | extern IDNA_API int stringprep_profile (const char *in, | 203 | extern IDNAPI int stringprep_profile (const char *in, |
195 | char **out, | 204 | char **out, |
196 | const char *profile, | 205 | const char *profile, |
197 | Stringprep_profile_flags flags); | 206 | Stringprep_profile_flags flags); |
198 | 207 | ||
199 | extern IDNA_API const char *stringprep_strerror (Stringprep_rc rc); | 208 | extern IDNAPI const char *stringprep_strerror (Stringprep_rc rc); |
200 | 209 | ||
201 | extern IDNA_API const char *stringprep_check_version (const char | 210 | extern IDNAPI const char *stringprep_check_version (const char |
202 | *req_version); | 211 | *req_version); |
203 | 212 | ||
204 | /* Utility */ | 213 | /* Utility */ |
205 | 214 | ||
206 | extern IDNA_API int stringprep_unichar_to_utf8 (uint32_t c, char *outbuf); | 215 | extern IDNAPI int stringprep_unichar_to_utf8 (uint32_t c, char *outbuf); |
207 | extern IDNA_API uint32_t stringprep_utf8_to_unichar (const char *p); | 216 | extern IDNAPI uint32_t stringprep_utf8_to_unichar (const char *p); |
208 | 217 | ||
209 | extern IDNA_API uint32_t *stringprep_utf8_to_ucs4 (const char *str, | 218 | extern IDNAPI uint32_t *stringprep_utf8_to_ucs4 (const char *str, |
210 | ssize_t len, | 219 | ssize_t len, |
211 | size_t * items_written); | 220 | size_t * items_written); |
212 | extern IDNA_API char *stringprep_ucs4_to_utf8 (const uint32_t * str, | 221 | extern IDNAPI char *stringprep_ucs4_to_utf8 (const uint32_t * str, |
213 | ssize_t len, | 222 | ssize_t len, |
214 | size_t * items_read, | 223 | size_t * items_read, |
215 | size_t * items_written); | 224 | size_t * items_written); |
216 | 225 | ||
217 | extern IDNA_API char *stringprep_utf8_nfkc_normalize (const char *str, | 226 | extern IDNAPI char *stringprep_utf8_nfkc_normalize (const char *str, |
218 | ssize_t len); | 227 | ssize_t len); |
219 | extern IDNA_API uint32_t *stringprep_ucs4_nfkc_normalize (uint32_t * str, | 228 | extern IDNAPI uint32_t *stringprep_ucs4_nfkc_normalize (const uint32_t * str, |
220 | ssize_t len); | 229 | ssize_t len); |
221 | 230 | ||
222 | extern IDNA_API const char *stringprep_locale_charset (void); | 231 | extern IDNAPI const char *stringprep_locale_charset (void); |
223 | extern IDNA_API char *stringprep_convert (const char *str, | 232 | extern IDNAPI char *stringprep_convert (const char *str, |
224 | const char *to_codeset, | 233 | const char *to_codeset, |
225 | const char *from_codeset); | 234 | const char *from_codeset); |
226 | extern IDNA_API char *stringprep_locale_to_utf8 (const char *str); | 235 | extern IDNAPI char *stringprep_locale_to_utf8 (const char *str); |
227 | extern IDNA_API char *stringprep_utf8_to_locale (const char *str); | 236 | extern IDNAPI char *stringprep_utf8_to_locale (const char *str); |
228 | 237 | ||
229 | # ifdef __cplusplus | 238 | # ifdef __cplusplus |
230 | } | 239 | } |
231 | # endif | 240 | # endif |
232 | 241 | ||
diff --git a/3rdParty/LibIDN/src/toutf8.c b/3rdParty/LibIDN/src/toutf8.c index 0d82717..b7126e2 100644 --- a/3rdParty/LibIDN/src/toutf8.c +++ b/3rdParty/LibIDN/src/toutf8.c | |||
@@ -1,25 +1,33 @@ | |||
1 | /* toutf8.c --- Convert strings from system locale into UTF-8. | 1 | /* toutf8.c --- Convert strings from system locale into UTF-8. |
2 | * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Simon Josefsson | 2 | Copyright (C) 2002-2015 Simon Josefsson |
3 | * | 3 | |
4 | * This file is part of GNU Libidn. | 4 | This file is part of GNU Libidn. |
5 | * | 5 | |
6 | * GNU Libidn is free software; you can redistribute it and/or | 6 | GNU Libidn is free software: you can redistribute it and/or |
7 | * modify it under the terms of the GNU Lesser General Public | 7 | modify it under the terms of either: |
8 | * License as published by the Free Software Foundation; either | 8 | |
9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * the GNU Lesser General Public License as published by the Free |
10 | * | 10 | Software Foundation; either version 3 of the License, or (at |
11 | * GNU Libidn is distributed in the hope that it will be useful, | 11 | your option) any later version. |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | or |
14 | * Lesser General Public License for more details. | 14 | |
15 | * | 15 | * the GNU General Public License as published by the Free |
16 | * You should have received a copy of the GNU Lesser General Public | 16 | Software Foundation; either version 2 of the License, or (at |
17 | * License along with GNU Libidn; if not, write to the Free Software | 17 | your option) any later version. |
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA | 18 | |
19 | * | 19 | or both in parallel, as here. |
20 | */ | 20 | |
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
21 | 29 | ||
22 | #ifdef HAVE_CONFIG_H | 30 | #ifdef HAVE_CONFIG_H |
23 | # include "config.h" | 31 | # include "config.h" |
24 | #endif | 32 | #endif |
25 | 33 | ||
@@ -42,23 +50,21 @@ | |||
42 | # define HAVE_ICONV 1 | 50 | # define HAVE_ICONV 1 |
43 | # define HAVE_LOCALE_H 1 | 51 | # define HAVE_LOCALE_H 1 |
44 | # define HAVE_LANGINFO_CODESET 1 | 52 | # define HAVE_LANGINFO_CODESET 1 |
45 | #endif | 53 | #endif |
46 | 54 | ||
47 | #if HAVE_LOCALE_H | 55 | #include <locale.h> |
48 | # include <locale.h> | ||
49 | #endif | ||
50 | 56 | ||
51 | #if HAVE_LANGINFO_CODESET | 57 | #ifdef HAVE_LANGINFO_CODESET |
52 | # include <langinfo.h> | 58 | # include <langinfo.h> |
53 | #endif | 59 | #endif |
54 | 60 | ||
55 | #ifdef _LIBC | 61 | #ifdef _LIBC |
56 | # define stringprep_locale_charset() nl_langinfo (CODESET) | 62 | # define stringprep_locale_charset() nl_langinfo (CODESET) |
57 | #else | 63 | #else |
58 | /** | 64 | /** |
59 | * stringprep_locale_charset - return charset used in current locale | 65 | * stringprep_locale_charset: |
60 | * | 66 | * |
61 | * Find out current locale charset. The function respect the CHARSET | 67 | * Find out current locale charset. The function respect the CHARSET |
62 | * environment variable, but typically uses nl_langinfo(CODESET) when | 68 | * environment variable, but typically uses nl_langinfo(CODESET) when |
63 | * it is supported. It fall back on "ASCII" if CHARSET isn't set and | 69 | * it is supported. It fall back on "ASCII" if CHARSET isn't set and |
64 | * nl_langinfo isn't supported or return anything. | 70 | * nl_langinfo isn't supported or return anything. |
@@ -93,11 +99,11 @@ stringprep_locale_charset (void) | |||
93 | return "ASCII"; | 99 | return "ASCII"; |
94 | } | 100 | } |
95 | #endif | 101 | #endif |
96 | 102 | ||
97 | /** | 103 | /** |
98 | * stringprep_convert - encode string using new character set | 104 | * stringprep_convert: |
99 | * @str: input zero-terminated string. | 105 | * @str: input zero-terminated string. |
100 | * @to_codeset: name of destination character set. | 106 | * @to_codeset: name of destination character set. |
101 | * @from_codeset: name of origin character set, as used by @str. | 107 | * @from_codeset: name of origin character set, as used by @str. |
102 | * | 108 | * |
103 | * Convert the string from one character set to another using the | 109 | * Convert the string from one character set to another using the |
@@ -122,11 +128,11 @@ stringprep_convert (const char *str, | |||
122 | return strcpy (p, str); | 128 | return strcpy (p, str); |
123 | #endif | 129 | #endif |
124 | } | 130 | } |
125 | 131 | ||
126 | /** | 132 | /** |
127 | * stringprep_locale_to_utf8 - convert locale encoded string to UTF-8 | 133 | * stringprep_locale_to_utf8: |
128 | * @str: input zero terminated string. | 134 | * @str: input zero terminated string. |
129 | * | 135 | * |
130 | * Convert string encoded in the locale's character set into UTF-8 by | 136 | * Convert string encoded in the locale's character set into UTF-8 by |
131 | * using stringprep_convert(). | 137 | * using stringprep_convert(). |
132 | * | 138 | * |
@@ -138,11 +144,11 @@ stringprep_locale_to_utf8 (const char *str) | |||
138 | { | 144 | { |
139 | return stringprep_convert (str, "UTF-8", stringprep_locale_charset ()); | 145 | return stringprep_convert (str, "UTF-8", stringprep_locale_charset ()); |
140 | } | 146 | } |
141 | 147 | ||
142 | /** | 148 | /** |
143 | * stringprep_utf8_to_locale - encode UTF-8 string to locale encoding | 149 | * stringprep_utf8_to_locale: |
144 | * @str: input zero terminated string. | 150 | * @str: input zero terminated string. |
145 | * | 151 | * |
146 | * Convert string encoded in UTF-8 into the locale's character set by | 152 | * Convert string encoded in UTF-8 into the locale's character set by |
147 | * using stringprep_convert(). | 153 | * using stringprep_convert(). |
148 | * | 154 | * |
diff --git a/3rdParty/LibIDN/stubs/unused-parameter.h b/3rdParty/LibIDN/stubs/unused-parameter.h new file mode 100644 index 0000000..2bea489 --- /dev/null +++ b/3rdParty/LibIDN/stubs/unused-parameter.h | |||
@@ -0,0 +1,3 @@ | |||
1 | #ifndef _GL_UNUSED_PARAMETER | ||
2 | #define _GL_UNUSED_PARAMETER | ||
3 | #endif | ||
diff --git a/3rdParty/LibIDN/stubs/win32/stdbool.h b/3rdParty/LibIDN/stubs/win32/stdbool.h new file mode 100644 index 0000000..c789c92 --- /dev/null +++ b/3rdParty/LibIDN/stubs/win32/stdbool.h | |||
@@ -0,0 +1,40 @@ | |||
1 | /* Copyright (C) 2008-2015 Free Software Foundation, Inc. | ||
2 | Written by Adam Strzelecki <ono@java.pl> | ||
3 | |||
4 | This file is part of GNU Libidn. | ||
5 | |||
6 | GNU Libidn is free software: you can redistribute it and/or | ||
7 | modify it under the terms of either: | ||
8 | |||
9 | * the GNU Lesser General Public License as published by the Free | ||
10 | Software Foundation; either version 3 of the License, or (at | ||
11 | your option) any later version. | ||
12 | |||
13 | or | ||
14 | |||
15 | * the GNU General Public License as published by the Free | ||
16 | Software Foundation; either version 2 of the License, or (at | ||
17 | your option) any later version. | ||
18 | |||
19 | or both in parallel, as here. | ||
20 | |||
21 | GNU Libidn is distributed in the hope that it will be useful, | ||
22 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
23 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
24 | General Public License for more details. | ||
25 | |||
26 | You should have received copies of the GNU General Public License and | ||
27 | the GNU Lesser General Public License along with this program. If | ||
28 | not, see <http://www.gnu.org/licenses/>. */ | ||
29 | |||
30 | #ifndef _STDBOOL_H | ||
31 | #define _STDBOOL_H | ||
32 | |||
33 | #define _Bool signed char | ||
34 | enum { false = 0, true = 1 }; | ||
35 | #define bool _Bool | ||
36 | #define false 0 | ||
37 | #define true 1 | ||
38 | #define __bool_true_false_are_defined 1 | ||
39 | |||
40 | #endif /* _STDBOOL_H */ | ||