libidn: strerror-stringprep.c Source File

libidn 1.41

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