libidn: strerror-stringprep.c Source File

libidn 1.29

- Main Page
- Data Structures
- Files

- File List
- Globals

strerror-stringprep.c
Go to the documentation of this file.
1 /* strerror-stringprep.c --- Convert stringprep errors into text.
2 Copyright (C) 2004-2014 Simon Josefsson
3
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 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33
34 #include "stringprep.h"
35
36 #include "gettext.h"
37 #define _(String) dgettext (PACKAGE, String)
38
76 const char *
77 stringprep_strerror (Stringprep_rc rc)
78 {
79 const char *p;
80
81 bindtextdomain (PACKAGE, LOCALEDIR);
82
83 switch (rc)
84 {
85 case STRINGPREP_OK:
86 p = _("Success");
87 break;
88
89 case STRINGPREP_CONTAINS_UNASSIGNED:
90 p = _("Forbidden unassigned code points in input");
91 break;
92
93 case STRINGPREP_CONTAINS_PROHIBITED:
94 p = _("Prohibited code points in input");
95 break;
96
97 case STRINGPREP_BIDI_BOTH_L_AND_RAL:
98 p = _("Conflicting bidirectional properties in input");
99 break;
100
101 case STRINGPREP_BIDI_LEADTRAIL_NOT_RAL:
102 p = _("Malformed bidirectional string");
103 break;
104
105 case STRINGPREP_BIDI_CONTAINS_PROHIBITED:
106 p = _("Prohibited bidirectional code points in input");
107 break;
108
109 case STRINGPREP_TOO_SMALL_BUFFER:
110 p = _("Output would exceed the buffer space provided");
111 break;
112
113 case STRINGPREP_PROFILE_ERROR:
114 p = _("Error in stringprep profile definition");
115 break;
116
117 case STRINGPREP_FLAG_ERROR:
118 p = _("Flag conflict with profile");
119 break;
120
121 case STRINGPREP_UNKNOWN_PROFILE:
122 p = _("Unknown profile");
123 break;
124
125 case STRINGPREP_NFKC_FAILED:
126 p = _("Unicode normalization failed (internal error)");
127 break;
128
129 case STRINGPREP_MALLOC_ERROR:
130 p = _("Cannot allocate memory");
131 break;
132
133 default:
134 p = _("Unknown error");
135 break;
136 }
137
138 return p;
139 }
STRINGPREP_FLAG_ERROR
Definition: stringprep.h:69
STRINGPREP_BIDI_BOTH_L_AND_RAL
Definition: stringprep.h:63
STRINGPREP_CONTAINS_PROHIBITED
Definition: stringprep.h:62
stringprep_strerror
const char * stringprep_strerror(Stringprep_rc rc)
Definition: strerror-stringprep.c:77
STRINGPREP_PROFILE_ERROR
Definition: stringprep.h:68
STRINGPREP_TOO_SMALL_BUFFER
Definition: stringprep.h:67
stringprep.h
STRINGPREP_MALLOC_ERROR
Definition: stringprep.h:73
STRINGPREP_CONTAINS_UNASSIGNED
Definition: stringprep.h:61
STRINGPREP_BIDI_CONTAINS_PROHIBITED
Definition: stringprep.h:65
_
#define _(String)
Definition: strerror-stringprep.c:37
STRINGPREP_NFKC_FAILED
Definition: stringprep.h:72
Stringprep_rc
Stringprep_rc
Definition: stringprep.h:57
STRINGPREP_OK
Definition: stringprep.h:59
STRINGPREP_BIDI_LEADTRAIL_NOT_RAL
Definition: stringprep.h:64
STRINGPREP_UNKNOWN_PROFILE
Definition: stringprep.h:70