summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-09-24 18:59:52 (GMT)
committerSwift Review <review@swift.im>2015-10-30 14:13:39 (GMT)
commit3d62970e1b929cf676202fc6cebc1cf426c14ff2 (patch)
treea68c82c3829a001c6f8cadbb2d68d91c98f617bf /3rdParty/LibIDN/src/punycode.c
parent3cc7e86420e4b3d67c5882d8d68e1e6a003c6154 (diff)
downloadswift-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
Diffstat (limited to '3rdParty/LibIDN/src/punycode.c')
-rw-r--r--3rdParty/LibIDN/src/punycode.c102
1 files changed, 55 insertions, 47 deletions
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 {