libidn-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CVS libidn/lib


From: libidn-commit
Subject: CVS libidn/lib
Date: Sat, 02 Oct 2004 19:03:37 +0200

Update of /home/cvs/libidn/lib
In directory dopio:/tmp/cvs-serv1788/lib

Modified Files:
        Makefile.am idna.h pr29.h punycode.h stringprep.h.in tld.c 
        tld.h 
Added Files:
        strerror-idna.c strerror-pr29.c strerror-punycode.c 
        strerror-stringprep.c strerror-tld.c 
Log Message:
Add idna_strerror, pr29_strerror, punycode_strerror, stringprep_strerror,
and tld_strerror, suggested by Daniel Stenberg <address@hidden>.
Make idn.c use them.
Rename TLD_NOTLD to TLD_NO_TLD.


--- /home/cvs/libidn/lib/Makefile.am    2004/09/26 07:04:33     1.22
+++ /home/cvs/libidn/lib/Makefile.am    2004/10/02 17:03:37     1.23
@@ -40,7 +40,9 @@
        punycode.h punycode.c \
        idna.h idna.c \
        pr29.h pr29.c \
-       idn-free.h idn-free.c
+       idn-free.h idn-free.c \
+       strerror-idna.c strerror-pr29.c strerror-punycode.c \
+       strerror-stringprep.c strerror-tld.c
 if TLD
 libidn_la_SOURCES += tld.h tld.c tlds.c
 endif
--- /home/cvs/libidn/lib/idna.h 2004/03/08 15:25:09     1.5
+++ /home/cvs/libidn/lib/idna.h 2004/10/02 17:03:37     1.6
@@ -1,4 +1,4 @@
-/* idna.h      Declarations for IDNA.
+/* idna.h --- Declarations for Internationalized Domain Name in Applications.
  * Copyright (C) 2002, 2003, 2004  Simon Josefsson
  *
  * This file is part of GNU Libidn.
@@ -20,15 +20,15 @@
  */
 
 #ifndef _IDNA_H
-#define _IDNA_H
+# define _IDNA_H
 
-#ifdef __cplusplus
+# ifdef __cplusplus
 extern "C"
 {
-#endif
+# endif
 
-#include <stddef.h>            /* size_t */
-#include <idn-int.h>           /* uint32_t */
+# include <stddef.h>           /* size_t */
+# include <idn-int.h>          /* uint32_t */
 
   /* Error codes. */
   typedef enum
@@ -57,9 +57,11 @@
     IDNA_USE_STD3_ASCII_RULES = 0x0002
   } Idna_flags;
 
-#ifndef IDNA_ACE_PREFIX
-#define IDNA_ACE_PREFIX "xn--"
-#endif
+# ifndef IDNA_ACE_PREFIX
+#  define IDNA_ACE_PREFIX "xn--"
+# endif
+
+  extern const char *idna_strerror (Idna_rc rc);
 
   /* Core functions */
   extern int idna_to_ascii_4i (const uint32_t * in, size_t inlen,
@@ -92,7 +94,7 @@
   extern int idna_to_unicode_lzlz (const char *input,
                                   char **output, int flags);
 
-#ifdef __cplusplus
+# ifdef __cplusplus
 }
-#endif
-#endif                         /* _PUNYCODE_H */
+# endif
+#endif /* _IDNA_H */
--- /home/cvs/libidn/lib/pr29.h 2004/06/26 11:06:22     1.2
+++ /home/cvs/libidn/lib/pr29.h 2004/10/02 17:03:37     1.3
@@ -20,18 +20,18 @@
  */
 
 #ifndef PR29_H
-#define PR29_H
+# define PR29_H
 
-#ifdef __cplusplus
+# ifdef __cplusplus
 extern "C"
 {
-#endif
+# endif
 
   /* Get size_t. */
-#include <stdlib.h>
+# include <stdlib.h>
 
   /* Get uint32_t. */
-#include <idn-int.h>
+# include <idn-int.h>
 
   /* Error codes. */
   typedef enum
@@ -41,11 +41,13 @@
       PR29_STRINGPREP_ERROR = 2   /* Charset conversion failed (p29_8*). */
     } Pr29_rc;
 
+  extern const char *pr29_strerror (Pr29_rc rc);
+
   extern int pr29_4 (const uint32_t *in, size_t len);
   extern int pr29_4z (const uint32_t *in);
   extern int pr29_8z (const char *in);
 
-#ifdef __cplusplus
+# ifdef __cplusplus
 }
-#endif
+# endif
 #endif                         /* PR29_H */
--- /home/cvs/libidn/lib/punycode.h     2003/10/17 02:12:16     1.9
+++ /home/cvs/libidn/lib/punycode.h     2004/10/02 17:03:37     1.10
@@ -1,5 +1,5 @@
-/* punycode.h  Declarations for punycode functions.
- * Copyright (C) 2002, 2003  Simon Josefsson
+/* punycode.h --- Declarations for punycode functions.
+ * Copyright (C) 2002, 2003, 2004  Simon Josefsson
  *
  * This file is part of GNU Libidn.
  *
@@ -86,6 +86,8 @@
     PUNYCODE_OVERFLOW = punycode_overflow
   } Punycode_status;
 
+  extern const char *punycode_strerror (Punycode_status rc);
+
 /* punycode_uint needs to be unsigned and needs to be */
 /* at least 26 bits wide.                             */
 
--- /home/cvs/libidn/lib/stringprep.h.in        2004/03/08 15:23:49     1.11
+++ /home/cvs/libidn/lib/stringprep.h.in        2004/10/02 17:03:37     1.12
@@ -1,4 +1,4 @@
-/* stringprep.h                Header file for stringprep functions.         
-*- c -*-
+/* stringprep.h --- Header file for stringprep functions.             -*- c -*-
  * Copyright (C) 2002, 2003, 2004  Simon Josefsson
  *
  * This file is part of GNU Libidn.
@@ -181,6 +181,8 @@
                                 const char *profile,
                                 Stringprep_profile_flags flags);
 
+  extern const char *stringprep_strerror (Stringprep_rc rc);
+
   extern const char *stringprep_check_version (const char *req_version);
 
 /* Utility */
--- /home/cvs/libidn/lib/tld.c  2004/02/28 14:05:10     1.35
+++ /home/cvs/libidn/lib/tld.c  2004/10/02 17:03:37     1.36
@@ -139,7 +139,7 @@
       return TLD_SUCCESS;
     }
 
-  return TLD_NOTLD;
+  return TLD_NO_TLD;
 }
 
 /**
@@ -357,7 +357,7 @@
 
   if (rc != TLD_SUCCESS)
     {
-      if (rc == TLD_NOTLD)     /* No TLD, say OK */
+      if (rc == TLD_NO_TLD)    /* No TLD, say OK */
        return TLD_SUCCESS;
       else
        return rc;
@@ -498,13 +498,13 @@
 /**
  * Tld_rc:
  * @TLD_SUCCESS: Successful operation.  This value is guaranteed to
- * always be zero, the remaining ones are only guaranteed to hold
- * non-zero values, for logical comparison purposes.
+ *   always be zero, the remaining ones are only guaranteed to hold
+ *   non-zero values, for logical comparison purposes.
  * @TLD_INVALID: Invalid character found.
  * @TLD_NODATA: No input data was provided.
  * @TLD_MALLOC_ERROR: Error during memory allocation.
  * @TLD_ICONV_ERROR: Error during iconv string conversion.
- * @TLD_NOTLD: No top-level domain found in domain string.
+ * @TLD_NO_TLD: No top-level domain found in domain string.
  *
  * Enumerated return codes of the TLD checking functions.
  * The value 0 is guaranteed to always correspond to success.
--- /home/cvs/libidn/lib/tld.h  2004/04/22 11:35:27     1.30
+++ /home/cvs/libidn/lib/tld.h  2004/10/02 17:03:37     1.31
@@ -62,9 +62,13 @@
     TLD_NODATA = 2,            /* Char, domain or inlen = 0. */
     TLD_MALLOC_ERROR = 3,
     TLD_ICONV_ERROR = 4,
-    TLD_NOTLD = 5
+    TLD_NO_TLD = 5,
+    /* Workaround typo in earlier versions. */
+    TLD_NOTLD = TLD_NO_TLD
   } Tld_rc;
 
+  extern const char *tld_strerror (Tld_rc rc);
+
   /* Extract TLD, as ASCII string, of UCS4 domain name into "out". */
   int tld_get_4 (const uint32_t * in, size_t inlen, char **out);
   int tld_get_4z (const uint32_t * in, char **out);

--- /home/cvs/libidn/lib/strerror-idna.c        2004/10/02 17:03:37     NONE
+++ /home/cvs/libidn/lib/strerror-idna.c        2004/10/02 17:03:37     1.1
/* strerror-idna.c --- Convert IDNA errors into text.
 * Copyright (C) 2004  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 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.
 *
 * 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.
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "idna.h"

#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)

/**
 * idna_strerror:
 * @rc: idna return code
 *
 * Convert a return code integer to a text string.  This string can be
 * used to output a diagnostic message to the user.
 *
 * IDNA_SUCCESS: Successful operation.  This value is guaranteed to
 *   always be zero, the remaining ones are only guaranteed to hold
 *   non-zero values, for logical comparison purposes.
 * IDNA_STRINGPREP_ERROR:  Error during string preparation.
 * IDNA_PUNYCODE_ERROR: Error during punycode operation.
 * IDNA_CONTAINS_NON_LDH: For IDNA_USE_STD3_ASCII_RULES, indicate that
 *   the string contains non-LDH ASCII characters.
 * IDNA_CONTAINS_MINUS: For IDNA_USE_STD3_ASCII_RULES, indicate that
 *   the string contains a leading or trailing hyphen-minus (U+002D).
 * IDNA_INVALID_LENGTH: The final output string is not within the
 *   (inclusive) range 1 to 63 characters.
 * IDNA_NO_ACE_PREFIX: The string does not contain the ACE prefix
 *   (for ToUnicode).
 * IDNA_ROUNDTRIP_VERIFY_ERROR: The ToASCII operation on output
 *   string does not equal the input.
 * IDNA_CONTAINS_ACE_PREFIX: The input contains the ACE prefix (for
 *   ToASCII).
 * IDNA_ICONV_ERROR: Could not convert string in locale encoding.
 * IDNA_MALLOC_ERROR: Could not allocate buffer (this is typically a
 *   fatal error).
 * IDNA_DLOPEN_ERROR: Could not dlopen the libcidn DSO (only used
 *   internally in libc).
 *
 * Return value: Returns a pointer to a statically allocated string
 * containing a description of the error with the return code @rc.
 **/
const char *
idna_strerror (Idna_rc rc)
{
  const char *p;

  switch (rc)
    {
    case IDNA_SUCCESS:
      p = _("Success");
      break;

    case IDNA_STRINGPREP_ERROR:
      p = _("String preparation failed");
      break;

    case IDNA_PUNYCODE_ERROR:
      p = _("Punycode failed");
      break;

    case IDNA_CONTAINS_NON_LDH:
      p = _("Non-digit/letter/hyphen in input");
      break;

    case IDNA_CONTAINS_MINUS:
      p = _("Forbidden leading or trailing minus sign (`-')");
      break;

    case IDNA_INVALID_LENGTH:
      p = _("Output would be too large or too small");
      break;

    case IDNA_NO_ACE_PREFIX:
      p = _("Input does not start with ACE prefix (`" IDNA_ACE_PREFIX "')");
      break;

    case IDNA_ROUNDTRIP_VERIFY_ERROR:
      p = _("String not idempotent under ToASCII");
      break;

    case IDNA_CONTAINS_ACE_PREFIX:
      p = _("Input already contain ACE prefix (`" IDNA_ACE_PREFIX "')");
      break;

    case IDNA_ICONV_ERROR:
      p = _("System iconv failed");
      break;

    case IDNA_MALLOC_ERROR:
      p = _("Cannot allocate memory");
      break;

    case IDNA_DLOPEN_ERROR:
      p = _("System dlopen failed");
      break;

    default:
      p = _("Unknown error");
      break;
    }

  return p;
}
--- /home/cvs/libidn/lib/strerror-pr29.c        2004/10/02 17:03:37     NONE
+++ /home/cvs/libidn/lib/strerror-pr29.c        2004/10/02 17:03:37     1.1
/* strerror-pr29.c --- Convert PR29 errors into text.
 * Copyright (C) 2004  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 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.
 *
 * 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.
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "pr29.h"

#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)

/**
 * pr29_strerror:
 * @rc: pr29 return code
 *
 * Convert a return code integer to a text string.  This string can be
 * used to output a diagnostic message to the user.
 *
 * PR29_SUCCESS: Successful operation.  This value is guaranteed to
 *   always be zero, the remaining ones are only guaranteed to hold
 *   non-zero values, for logical comparison purposes.
 * PR29_PROBLEM: A problem sequence was encountered.
 * PR29_STRINGPREP_ERROR: The character set conversion failed (only
 *   for pr29_8() and pr29_8z()).
 *
 * Return value: Returns a pointer to a statically allocated string
 * containing a description of the error with the return code @rc.
 **/
const char *
pr29_strerror (Pr29_rc rc)
{
  const char *p;

  switch (rc)
    {
    case PR29_SUCCESS:
      p = _("Success");
      break;

    case PR29_PROBLEM:
      p = _("String not idempotent under Unicode NFKC normalization");
      break;

    case PR29_STRINGPREP_ERROR:
      p = _("String preparation failed");
      break;

    default:
      p = _("Unknown error");
      break;
    }

  return p;
}
--- /home/cvs/libidn/lib/strerror-punycode.c    2004/10/02 17:03:37     NONE
+++ /home/cvs/libidn/lib/strerror-punycode.c    2004/10/02 17:03:37     1.1
/* strerror-punycode.c --- Convert punycode errors into text.
 * Copyright (C) 2004  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 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.
 *
 * 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.
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "punycode.h"

#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)

/**
 * punycode_strerror:
 * @rc: punycode return code
 *
 * Convert a return code integer to a text string.  This string can be
 * used to output a diagnostic message to the user.
 *
 * PUNYCODE_SUCCESS: Successful operation.  This value is guaranteed
 *   to always be zero, the remaining ones are only guaranteed to hold
 *   non-zero values, for logical comparison purposes.
 * PUNYCODE_BAD_INPUT: Input is invalid.
 * PUNYCODE_BIG_OUTPUT: Output would exceed the space provided.
 * PUNYCODE_OVERFLOW: Input needs wider integers to process.
 *
 * Return value: Returns a pointer to a statically allocated string
 * containing a description of the error with the return code @rc.
 **/
const char *
punycode_strerror (Punycode_status rc)
{
  const char *p;

  switch (rc)
    {
    case PUNYCODE_SUCCESS:
      p = _("Success");
      break;

    case PUNYCODE_BAD_INPUT:
      p = _("Invalid input");
      break;

    case PUNYCODE_BIG_OUTPUT:
      p = _("Output would exceed the buffer space provided");
      break;

    case PUNYCODE_OVERFLOW:
      p = _("String size limit exceeded");
      break;

    default:
      p = _("Unknown error");
      break;
    }

  return p;
}
--- /home/cvs/libidn/lib/strerror-stringprep.c  2004/10/02 17:03:37     NONE
+++ /home/cvs/libidn/lib/strerror-stringprep.c  2004/10/02 17:03:37     1.1
/* strerror-stringprep.c --- Convert stringprep errors into text.
 * Copyright (C) 2004  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 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.
 *
 * 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.
 *
 * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#include "stringprep.h"

#include "gettext.h"
#define _(String) dgettext (PACKAGE, String)

/**
 * stringprep_strerror:
 * @rc: stringprep return code
 *
 * Convert a return code integer to a text string.  This string can be
 * used to output a diagnostic message to the user.
 *
 * STRINGPREP_OK: Successful operation.  This value is guaranteed to
 *   always be zero, the remaining ones are only guaranteed to hold
 *   non-zero values, for logical comparison purposes.
 * STRINGPREP_CONTAINS_UNASSIGNED: String contain unassigned Unicode
 *   code points, which is forbidden by the profile.
 * STRINGPREP_CONTAINS_PROHIBITED: String contain code points
 *   prohibited by the profile.
 * STRINGPREP_BIDI_BOTH_L_AND_RAL: String contain code points with
 *   conflicting bidirection category.
 * STRINGPREP_BIDI_LEADTRAIL_NOT_RAL: Leading and trailing character
 *   in string not of proper bidirectional category.
 * STRINGPREP_BIDI_CONTAINS_PROHIBITED: Contains prohibited code
 *   points detected by bidirectional code.
 * STRINGPREP_TOO_SMALL_BUFFER: Buffer handed to function was too
 *   small.  This usually indicate a problem in the calling
 *   application.
 * STRINGPREP_PROFILE_ERROR: The stringprep profile was inconsistent.
 *   This usually indicate an internal error in the library.
 * STRINGPREP_FLAG_ERROR: The supplied flag conflicted with profile.
 *   This usually indicate a problem in the calling application.
 * STRINGPREP_UNKNOWN_PROFILE: The supplied profile name was not
 *   known to the library.
 * STRINGPREP_NFKC_FAILED: The Unicode NFKC operation failed.  This
 *   usually indicate an internal error in the library.
 * STRINGPREP_MALLOC_ERROR: The malloc() was out of memory.  This is
 *   usually a fatal error.
 *
 * Return value: Returns a pointer to a statically allocated string
 * containing a description of the error with the return code @rc.
 **/
const char *
stringprep_strerror (Stringprep_rc rc)
{
  const char *p;

  switch (rc)
    {
    case STRINGPREP_OK:
      p = _("Success");
      break;

    case STRINGPREP_CONTAINS_UNASSIGNED:
      p = _("Forbidden unassigned code points in input");
      break;

    case STRINGPREP_CONTAINS_PROHIBITED:
      p = _("Prohibited code points in input");
      break;

    case STRINGPREP_BIDI_BOTH_L_AND_RAL:
      p = _("Conflicting bidirectional properties in input");
      break;

    case STRINGPREP_BIDI_LEADTRAIL_NOT_RAL:
      p = _("Malformed bidirectional string");
      break;

    case STRINGPREP_BIDI_CONTAINS_PROHIBITED:
      p = _("Prohibited bidirectional code points in input");
      break;

    case STRINGPREP_TOO_SMALL_BUFFER:
      p = _("Output would exceed the buffer space provided");
      break;

    case STRINGPREP_PROFILE_ERROR:
      p = _("Error in stringprep profile definition");
      break;

    case STRINGPREP_FLAG_ERROR:
      p = _("Flag conflict with profile");
      break;

    case STRINGPREP_UNKNOWN_PROFILE:
      p = _("Unknown profile");
      break;

    case STRINGPREP_NFKC_FAILED:
      p = _("Unicode normalization failed (internal error)");
      break;

    case STRINGPREP_MALLOC_ERROR:
      p = _("Cannot allocate memory");
      break;

    default:
      p = _("Unknown error");

[5 lines skipped]
--- /home/cvs/libidn/lib/strerror-tld.c 2004/10/02 17:03:37     NONE
+++ /home/cvs/libidn/lib/strerror-tld.c 2004/10/02 17:03:37     1.1

[88 lines skipped]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]