summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/LibIDN/src/punycode.h')
-rw-r--r--3rdParty/LibIDN/src/punycode.h139
1 files changed, 80 insertions, 59 deletions
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,26 +1,56 @@
/* punycode.h --- Declarations for punycode functions.
- * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 Simon Josefsson
- *
- * This file is part of GNU Libidn.
+ Copyright (C) 2002-2015 Simon Josefsson
+
+ This file is part of GNU Libidn.
+
+ GNU Libidn is free software: you can redistribute it and/or
+ modify it under the terms of either:
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version.
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version.
+
+ or both in parallel, as here.
+
+ GNU Libidn is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+/*
+ * This file is derived from RFC 3492bis written by Adam M. Costello,
+ * downloaded from http://www.nicemice.net/idn/punycode-spec.gz on
+ * 2015-03-02 with SHA1 a966a8017f6be579d74a50a226accc7607c40133, a
+ * copy of which is stored in the GNU Libidn version controlled
+ * repository under doc/specification/punycode-spec.gz.
*
- * GNU Libidn is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * The changes compared to Adam's file include: re-indentation, adding
+ * the license boilerplate and this comment, adding the #ifndef
+ * PUNYCODE_H and IDNAPI blocks, changing the return code of
+ * punycode_encode and punycode_decode from enum to int, simplifying
+ * the definition of punycode_uint by #include'ing idn-int.h and using
+ * uint32_t instead of limit.h-based code, adding Punycode_status and
+ * punycode_strerror, adding 'extern IDNAPI' declarations to function
+ * prototypes, and mentioning variable names in function prototypes.
*
- * GNU Libidn is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
+ * Adam's file contains the following:
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with GNU Libidn; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ * punycode-sample.c 2.0.0 (2004-Mar-21-Sun)
+ * http://www.nicemice.net/idn/
+ * Adam M. Costello
+ * http://www.nicemice.net/amc/
*
- */
-
-/*
- * This file is derived from RFC 3492bis written by Adam M. Costello.
+ * This is ANSI C code (C89) implementing Punycode 1.0.x.
*
* Disclaimer and license: Regarding this entire document or any
* portion of it (including the pseudocode and C code), the author
@@ -31,42 +61,31 @@
* provided that redistributed derivative works do not contain
* misleading author or version information. Derivative works need
* not be licensed under similar terms.
- *
- * Copyright (C) The Internet Society (2003). All Rights Reserved.
- *
- * This document and translations of it may be copied and furnished to
- * others, and derivative works that comment on or otherwise explain it
- * or assist in its implementation may be prepared, copied, published
- * and distributed, in whole or in part, without restriction of any
- * kind, provided that the above copyright notice and this paragraph are
- * included on all such copies and derivative works. However, this
- * document itself may not be modified in any way, such as by removing
- * the copyright notice or references to the Internet Society or other
- * Internet organizations, except as needed for the purpose of
- * developing Internet standards in which case the procedures for
- * copyrights defined in the Internet Standards process must be
- * followed, or as required to translate it into languages other than
- * English.
- *
- * The limited permissions granted above are perpetual and will not be
- * revoked by the Internet Society or its successors or assigns.
- *
- * This document and the information contained herein is provided on an
- * "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
- * TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
- * BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
- * HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*/
-#ifndef _PUNYCODE_H
-#define _PUNYCODE_H
+#ifndef PUNYCODE_H
+# define PUNYCODE_H
+
+# ifndef IDNAPI
+# if defined LIBIDN_BUILDING && defined HAVE_VISIBILITY && HAVE_VISIBILITY
+# define IDNAPI __attribute__((__visibility__("default")))
+# elif defined LIBIDN_BUILDING && defined _MSC_VER && ! defined LIBIDN_STATIC
+# define IDNAPI __declspec(dllexport)
+# elif defined _MSC_VER && ! defined LIBIDN_STATIC
+# define IDNAPI __declspec(dllimport)
+# else
+# define IDNAPI
+# endif
+# endif
#ifdef __cplusplus
extern "C"
{
#endif
+/************************************************************/
+/* Public interface (would normally go in its own .h file): */
+
#include <stddef.h> /* size_t */
#include <idn-int.h> /* uint32_t */
@@ -86,17 +105,19 @@ extern "C"
PUNYCODE_OVERFLOW = punycode_overflow
} Punycode_status;
- extern const char *punycode_strerror (Punycode_status rc);
+ extern IDNAPI const char *punycode_strerror (Punycode_status rc);
/* punycode_uint needs to be unsigned and needs to be */
-/* at least 26 bits wide. */
+/* at least 26 bits wide. The particular type can be */
+/* specified by defining PUNYCODE_UINT, otherwise a */
+/* suitable type will be chosen automatically. */
typedef uint32_t punycode_uint;
- extern int punycode_encode (size_t input_length,
- const punycode_uint input[],
- const unsigned char case_flags[],
- size_t * output_length, char output[]);
+ extern IDNAPI int punycode_encode (size_t input_length,
+ const punycode_uint input[],
+ const unsigned char case_flags[],
+ size_t * output_length, char output[]);
/*
punycode_encode() converts a sequence of code points (presumed to be
@@ -110,7 +131,7 @@ extern "C"
input
An array of code points. They are presumed to be Unicode
- code points, but that is not strictly REQUIRED. The
+ code points, but that is not strictly necessary. The
array contains code points, not code units. UTF-16 uses
code units D800 through DFFF to refer to code points
10000..10FFFF. The code points D800..DFFF do not occur in
@@ -153,11 +174,11 @@ extern "C"
and output might contain garbage.
*/
- extern int punycode_decode (size_t input_length,
- const char input[],
- size_t * output_length,
- punycode_uint output[],
- unsigned char case_flags[]);
+ extern IDNAPI int punycode_decode (size_t input_length,
+ const char input[],
+ size_t * output_length,
+ punycode_uint output[],
+ unsigned char case_flags[]);
/*
punycode_decode() converts Punycode to a sequence of code points
@@ -215,4 +236,4 @@ extern "C"
#ifdef __cplusplus
}
#endif
-#endif /* _PUNYCODE_H */
+#endif /* PUNYCODE_H */