/src/php-src/ext/uri/uriparser/src/UriNormalizeBase.c
Line | Count | Source |
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 | | * 1. Redistributions of source code must retain the above |
13 | | * copyright notice, this list of conditions and the following |
14 | | * disclaimer. |
15 | | * |
16 | | * 2. 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 | | * 3. Neither the name of the copyright holder nor the names of |
22 | | * its 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 |
30 | | * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
31 | | * INDIRECT, 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 | 0 | UriBool uriIsUnreserved(int code) { |
45 | 0 | switch (code) { |
46 | 0 | case L'a': /* ALPHA */ |
47 | 0 | case L'A': |
48 | 0 | case L'b': |
49 | 0 | case L'B': |
50 | 0 | case L'c': |
51 | 0 | case L'C': |
52 | 0 | case L'd': |
53 | 0 | case L'D': |
54 | 0 | case L'e': |
55 | 0 | case L'E': |
56 | 0 | case L'f': |
57 | 0 | case L'F': |
58 | 0 | case L'g': |
59 | 0 | case L'G': |
60 | 0 | case L'h': |
61 | 0 | case L'H': |
62 | 0 | case L'i': |
63 | 0 | case L'I': |
64 | 0 | case L'j': |
65 | 0 | case L'J': |
66 | 0 | case L'k': |
67 | 0 | case L'K': |
68 | 0 | case L'l': |
69 | 0 | case L'L': |
70 | 0 | case L'm': |
71 | 0 | case L'M': |
72 | 0 | case L'n': |
73 | 0 | case L'N': |
74 | 0 | case L'o': |
75 | 0 | case L'O': |
76 | 0 | case L'p': |
77 | 0 | case L'P': |
78 | 0 | case L'q': |
79 | 0 | case L'Q': |
80 | 0 | case L'r': |
81 | 0 | case L'R': |
82 | 0 | case L's': |
83 | 0 | case L'S': |
84 | 0 | case L't': |
85 | 0 | case L'T': |
86 | 0 | case L'u': |
87 | 0 | case L'U': |
88 | 0 | case L'v': |
89 | 0 | case L'V': |
90 | 0 | case L'w': |
91 | 0 | case L'W': |
92 | 0 | case L'x': |
93 | 0 | case L'X': |
94 | 0 | case L'y': |
95 | 0 | case L'Y': |
96 | 0 | case L'z': |
97 | 0 | case L'Z': |
98 | 0 | case L'0': /* DIGIT */ |
99 | 0 | case L'1': |
100 | 0 | case L'2': |
101 | 0 | case L'3': |
102 | 0 | case L'4': |
103 | 0 | case L'5': |
104 | 0 | case L'6': |
105 | 0 | case L'7': |
106 | 0 | case L'8': |
107 | 0 | case L'9': |
108 | 0 | case L'-': /* "-" / "." / "_" / "~" */ |
109 | 0 | case L'.': |
110 | 0 | case L'_': |
111 | 0 | case L'~': |
112 | 0 | return URI_TRUE; |
113 | | |
114 | 0 | default: |
115 | 0 | return URI_FALSE; |
116 | 0 | } |
117 | 0 | } |