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