1 /*
2  * uriparser - RFC 3986 URI parsing library
3  *
4  * Copyright (C) 2007, Weijia Song <songweijia@gmail.com>
5  * Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
6  * All rights reserved.
7  *
8  * Redistribution  and use in source and binary forms, with or without
9  * modification,  are permitted provided that the following conditions
10  * are met:
11  *
12  *     * Redistributions   of  source  code  must  retain  the   above
13  *       copyright  notice, this list of conditions and the  following
14  *       disclaimer.
15  *
16  *     * Redistributions  in  binary  form must  reproduce  the  above
17  *       copyright  notice, this list of conditions and the  following
18  *       disclaimer   in  the  documentation  and/or  other  materials
19  *       provided with the distribution.
20  *
21  *     * Neither  the name of the <ORGANIZATION> nor the names of  its
22  *       contributors  may  be  used to endorse  or  promote  products
23  *       derived  from  this software without specific  prior  written
24  *       permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS  IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT  NOT
28  * LIMITED  TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND  FITNESS
29  * FOR  A  PARTICULAR  PURPOSE ARE DISCLAIMED. IN NO EVENT  SHALL  THE
30  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31  * INCIDENTAL,    SPECIAL,   EXEMPLARY,   OR   CONSEQUENTIAL   DAMAGES
32  * (INCLUDING,  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
33  * SERVICES;  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35  * STRICT  LIABILITY,  OR  TORT (INCLUDING  NEGLIGENCE  OR  OTHERWISE)
36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
37  * OF THE POSSIBILITY OF SUCH DAMAGE.
38  */
39 
40 #ifndef URI_DOXYGEN
41 # include "UriNormalizeBase.h"
42 #endif
43 
44 
45 
uriIsUnreserved(int code)46 UriBool uriIsUnreserved(int code) {
47 	switch (code) {
48 	case L'a': /* ALPHA */
49 	case L'A':
50 	case L'b':
51 	case L'B':
52 	case L'c':
53 	case L'C':
54 	case L'd':
55 	case L'D':
56 	case L'e':
57 	case L'E':
58 	case L'f':
59 	case L'F':
60 	case L'g':
61 	case L'G':
62 	case L'h':
63 	case L'H':
64 	case L'i':
65 	case L'I':
66 	case L'j':
67 	case L'J':
68 	case L'k':
69 	case L'K':
70 	case L'l':
71 	case L'L':
72 	case L'm':
73 	case L'M':
74 	case L'n':
75 	case L'N':
76 	case L'o':
77 	case L'O':
78 	case L'p':
79 	case L'P':
80 	case L'q':
81 	case L'Q':
82 	case L'r':
83 	case L'R':
84 	case L's':
85 	case L'S':
86 	case L't':
87 	case L'T':
88 	case L'u':
89 	case L'U':
90 	case L'v':
91 	case L'V':
92 	case L'w':
93 	case L'W':
94 	case L'x':
95 	case L'X':
96 	case L'y':
97 	case L'Y':
98 	case L'z':
99 	case L'Z':
100 	case L'0': /* DIGIT */
101 	case L'1':
102 	case L'2':
103 	case L'3':
104 	case L'4':
105 	case L'5':
106 	case L'6':
107 	case L'7':
108 	case L'8':
109 	case L'9':
110 	case L'-': /* "-" / "." / "_" / "~" */
111 	case L'.':
112 	case L'_':
113 	case L'~':
114 		return URI_TRUE;
115 
116 	default:
117 		return URI_FALSE;
118 	}
119 }
120