00001 /* strerror-stringprep.c --- Convert stringprep errors into text. 00002 * Copyright (C) 2004 Simon Josefsson 00003 * 00004 * This file is part of GNU Libidn. 00005 * 00006 * GNU Libidn is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public 00008 * License as published by the Free Software Foundation; either 00009 * version 2.1 of the License, or (at your option) any later version. 00010 * 00011 * GNU Libidn is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00014 * Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public 00017 * License along with GNU Libidn; if not, write to the Free Software 00018 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 00019 * 00020 */ 00021 00022 #if HAVE_CONFIG_H 00023 # include "config.h" 00024 #endif 00025 00026 #include "stringprep.h" 00027 00028 #include "gettext.h" 00029 #define _(String) dgettext (PACKAGE, String) 00030 00068 const char * 00069 stringprep_strerror (Stringprep_rc rc) 00070 { 00071 const char *p; 00072 00073 bindtextdomain (PACKAGE, LOCALEDIR); 00074 00075 switch (rc) 00076 { 00077 case STRINGPREP_OK: 00078 p = _("Success"); 00079 break; 00080 00081 case STRINGPREP_CONTAINS_UNASSIGNED: 00082 p = _("Forbidden unassigned code points in input"); 00083 break; 00084 00085 case STRINGPREP_CONTAINS_PROHIBITED: 00086 p = _("Prohibited code points in input"); 00087 break; 00088 00089 case STRINGPREP_BIDI_BOTH_L_AND_RAL: 00090 p = _("Conflicting bidirectional properties in input"); 00091 break; 00092 00093 case STRINGPREP_BIDI_LEADTRAIL_NOT_RAL: 00094 p = _("Malformed bidirectional string"); 00095 break; 00096 00097 case STRINGPREP_BIDI_CONTAINS_PROHIBITED: 00098 p = _("Prohibited bidirectional code points in input"); 00099 break; 00100 00101 case STRINGPREP_TOO_SMALL_BUFFER: 00102 p = _("Output would exceed the buffer space provided"); 00103 break; 00104 00105 case STRINGPREP_PROFILE_ERROR: 00106 p = _("Error in stringprep profile definition"); 00107 break; 00108 00109 case STRINGPREP_FLAG_ERROR: 00110 p = _("Flag conflict with profile"); 00111 break; 00112 00113 case STRINGPREP_UNKNOWN_PROFILE: 00114 p = _("Unknown profile"); 00115 break; 00116 00117 case STRINGPREP_NFKC_FAILED: 00118 p = _("Unicode normalization failed (internal error)"); 00119 break; 00120 00121 case STRINGPREP_MALLOC_ERROR: 00122 p = _("Cannot allocate memory"); 00123 break; 00124 00125 default: 00126 p = _("Unknown error"); 00127 break; 00128 } 00129 00130 return p; 00131 }