strerr.c

filter: Statementstmt 0.0% 0 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 18 SCAR 0
CC
0
Cov
0%
CRAP 0
« pcodes.c ↑ Summary blib/lib/URI/UTF8/Punycode.pm »
1 /* strerror-punycode.c --- Convert punycode errors into text.
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Simon
3 * Josefsson
4 *
5 * This file is part of GNU Libidn.
6 *
7 * GNU Libidn is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * GNU Libidn is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with GNU Libidn; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 *
21 */
22  
23 #include "pcodes.h"
24  
25 /**
26 * punycode_strerror:
27 * @rc: an #Punycode_status return code.
28 *
29 * Convert a return code integer to a text string. This string can be
30 * used to output a diagnostic message to the user.
31 *
32 * PUNYCODE_SUCCESS: Successful operation. This value is guaranteed
33 * to always be zero, the remaining ones are only guaranteed to hold
34 * non-zero values, for logical comparison purposes.
35 * PUNYCODE_BAD_INPUT: Input is invalid.
36 * PUNYCODE_BIG_OUTPUT: Output would exceed the space provided.
37 * PUNYCODE_OVERFLOW: Input needs wider integers to process.
38 *
39 * Return value: Returns a pointer to a statically allocated string
40 * containing a description of the error with the return code @rc.
41 **/
42 const char *
43 0 punycode_strerror (Punycode_status rc)
44 {
45 const char *p;
46  
47 0 switch (rc)
48 {
49 0 case PUNYCODE_SUCCESS:
50 0 p = "Success\0";
51 0 break;
52  
53 0 case PUNYCODE_BAD_INPUT:
54 0 p = "Invalid input\0";
55 0 break;
56  
57 0 case PUNYCODE_BIG_OUTPUT:
58 0 p = "Output would exceed the buffer space provided\0";
59 0 break;
60  
61 0 case PUNYCODE_OVERFLOW:
62 0 p = "String size limit exceeded\0";
63 0 break;
64  
65 0 default:
66 0 p = "Unknown error\0";
67 0 break;
68 }
69  
70 0 return p;
71 }
« pcodes.c ↑ Summary blib/lib/URI/UTF8/Punycode.pm »