/src/uriparser/src/UriResolve.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 | | /* What encodings are enabled? */ |
41 | | #include <uriparser/UriDefsConfig.h> |
42 | | #if (!defined(URI_PASS_ANSI) && !defined(URI_PASS_UNICODE)) |
43 | | /* Include SELF twice */ |
44 | | # ifdef URI_ENABLE_ANSI |
45 | | # define URI_PASS_ANSI 1 |
46 | | # include "UriResolve.c" |
47 | | # undef URI_PASS_ANSI |
48 | | # endif |
49 | | # ifdef URI_ENABLE_UNICODE |
50 | | # define URI_PASS_UNICODE 1 |
51 | | # include "UriResolve.c" |
52 | | # undef URI_PASS_UNICODE |
53 | | # endif |
54 | | #else |
55 | | # ifdef URI_PASS_ANSI |
56 | | # include <uriparser/UriDefsAnsi.h> |
57 | | # else |
58 | | # include <uriparser/UriDefsUnicode.h> |
59 | | # include <wchar.h> |
60 | | # endif |
61 | | |
62 | | # ifndef URI_DOXYGEN |
63 | | # include <uriparser/Uri.h> |
64 | | # include "UriCommon.h" |
65 | | # include "UriMemory.h" |
66 | | # endif |
67 | | |
68 | | /* Appends a relative URI to an absolute. The last path segment of |
69 | | * the absolute URI is replaced. */ |
70 | | static URI_INLINE UriBool URI_FUNC(MergePath)(URI_TYPE(Uri) * absWork, |
71 | 165 | const URI_TYPE(Uri) * relAppend, UriMemoryManager * memory) { |
72 | 165 | URI_TYPE(PathSegment) * sourceWalker; |
73 | 165 | URI_TYPE(PathSegment) * destPrev; |
74 | 165 | if (relAppend->pathHead == NULL) { |
75 | 0 | return URI_TRUE; |
76 | 0 | } |
77 | | |
78 | | /* Replace last segment ("" if trailing slash) with first of append chain */ |
79 | 165 | if (absWork->pathHead == NULL) { |
80 | 61 | URI_TYPE(PathSegment) * const dup = |
81 | 61 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); |
82 | 61 | if (dup == NULL) { |
83 | 0 | return URI_FALSE; /* Raises malloc error */ |
84 | 0 | } |
85 | 61 | dup->next = NULL; |
86 | 61 | absWork->pathHead = dup; |
87 | 61 | absWork->pathTail = dup; |
88 | 61 | } |
89 | 165 | absWork->pathTail->text.first = relAppend->pathHead->text.first; |
90 | 165 | absWork->pathTail->text.afterLast = relAppend->pathHead->text.afterLast; |
91 | | |
92 | | /* Append all the others */ |
93 | 165 | sourceWalker = relAppend->pathHead->next; |
94 | 165 | if (sourceWalker == NULL) { |
95 | 98 | return URI_TRUE; |
96 | 98 | } |
97 | 67 | destPrev = absWork->pathTail; |
98 | | |
99 | 1.03k | for (;;) { |
100 | 1.03k | URI_TYPE(PathSegment) * const dup = |
101 | 1.03k | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); |
102 | 1.03k | if (dup == NULL) { |
103 | 0 | destPrev->next = NULL; |
104 | 0 | absWork->pathTail = destPrev; |
105 | 0 | return URI_FALSE; /* Raises malloc error */ |
106 | 0 | } |
107 | 1.03k | dup->text = sourceWalker->text; |
108 | 1.03k | destPrev->next = dup; |
109 | | |
110 | 1.03k | if (sourceWalker->next == NULL) { |
111 | 67 | absWork->pathTail = dup; |
112 | 67 | absWork->pathTail->next = NULL; |
113 | 67 | break; |
114 | 67 | } |
115 | 964 | destPrev = dup; |
116 | 964 | sourceWalker = sourceWalker->next; |
117 | 964 | } |
118 | | |
119 | 67 | return URI_TRUE; |
120 | 67 | } UriResolve.c:uriMergePathA Line | Count | Source | 71 | 85 | const URI_TYPE(Uri) * relAppend, UriMemoryManager * memory) { | 72 | 85 | URI_TYPE(PathSegment) * sourceWalker; | 73 | 85 | URI_TYPE(PathSegment) * destPrev; | 74 | 85 | if (relAppend->pathHead == NULL) { | 75 | 0 | return URI_TRUE; | 76 | 0 | } | 77 | | | 78 | | /* Replace last segment ("" if trailing slash) with first of append chain */ | 79 | 85 | if (absWork->pathHead == NULL) { | 80 | 33 | URI_TYPE(PathSegment) * const dup = | 81 | 33 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); | 82 | 33 | if (dup == NULL) { | 83 | 0 | return URI_FALSE; /* Raises malloc error */ | 84 | 0 | } | 85 | 33 | dup->next = NULL; | 86 | 33 | absWork->pathHead = dup; | 87 | 33 | absWork->pathTail = dup; | 88 | 33 | } | 89 | 85 | absWork->pathTail->text.first = relAppend->pathHead->text.first; | 90 | 85 | absWork->pathTail->text.afterLast = relAppend->pathHead->text.afterLast; | 91 | | | 92 | | /* Append all the others */ | 93 | 85 | sourceWalker = relAppend->pathHead->next; | 94 | 85 | if (sourceWalker == NULL) { | 95 | 53 | return URI_TRUE; | 96 | 53 | } | 97 | 32 | destPrev = absWork->pathTail; | 98 | | | 99 | 585 | for (;;) { | 100 | 585 | URI_TYPE(PathSegment) * const dup = | 101 | 585 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); | 102 | 585 | if (dup == NULL) { | 103 | 0 | destPrev->next = NULL; | 104 | 0 | absWork->pathTail = destPrev; | 105 | 0 | return URI_FALSE; /* Raises malloc error */ | 106 | 0 | } | 107 | 585 | dup->text = sourceWalker->text; | 108 | 585 | destPrev->next = dup; | 109 | | | 110 | 585 | if (sourceWalker->next == NULL) { | 111 | 32 | absWork->pathTail = dup; | 112 | 32 | absWork->pathTail->next = NULL; | 113 | 32 | break; | 114 | 32 | } | 115 | 553 | destPrev = dup; | 116 | 553 | sourceWalker = sourceWalker->next; | 117 | 553 | } | 118 | | | 119 | 32 | return URI_TRUE; | 120 | 32 | } |
UriResolve.c:uriMergePathW Line | Count | Source | 71 | 80 | const URI_TYPE(Uri) * relAppend, UriMemoryManager * memory) { | 72 | 80 | URI_TYPE(PathSegment) * sourceWalker; | 73 | 80 | URI_TYPE(PathSegment) * destPrev; | 74 | 80 | if (relAppend->pathHead == NULL) { | 75 | 0 | return URI_TRUE; | 76 | 0 | } | 77 | | | 78 | | /* Replace last segment ("" if trailing slash) with first of append chain */ | 79 | 80 | if (absWork->pathHead == NULL) { | 80 | 28 | URI_TYPE(PathSegment) * const dup = | 81 | 28 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); | 82 | 28 | if (dup == NULL) { | 83 | 0 | return URI_FALSE; /* Raises malloc error */ | 84 | 0 | } | 85 | 28 | dup->next = NULL; | 86 | 28 | absWork->pathHead = dup; | 87 | 28 | absWork->pathTail = dup; | 88 | 28 | } | 89 | 80 | absWork->pathTail->text.first = relAppend->pathHead->text.first; | 90 | 80 | absWork->pathTail->text.afterLast = relAppend->pathHead->text.afterLast; | 91 | | | 92 | | /* Append all the others */ | 93 | 80 | sourceWalker = relAppend->pathHead->next; | 94 | 80 | if (sourceWalker == NULL) { | 95 | 45 | return URI_TRUE; | 96 | 45 | } | 97 | 35 | destPrev = absWork->pathTail; | 98 | | | 99 | 446 | for (;;) { | 100 | 446 | URI_TYPE(PathSegment) * const dup = | 101 | 446 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); | 102 | 446 | if (dup == NULL) { | 103 | 0 | destPrev->next = NULL; | 104 | 0 | absWork->pathTail = destPrev; | 105 | 0 | return URI_FALSE; /* Raises malloc error */ | 106 | 0 | } | 107 | 446 | dup->text = sourceWalker->text; | 108 | 446 | destPrev->next = dup; | 109 | | | 110 | 446 | if (sourceWalker->next == NULL) { | 111 | 35 | absWork->pathTail = dup; | 112 | 35 | absWork->pathTail->next = NULL; | 113 | 35 | break; | 114 | 35 | } | 115 | 411 | destPrev = dup; | 116 | 411 | sourceWalker = sourceWalker->next; | 117 | 411 | } | 118 | | | 119 | 35 | return URI_TRUE; | 120 | 35 | } |
|
121 | | |
122 | | static int URI_FUNC(ResolveAbsolutePathFlag)( |
123 | 10 | URI_TYPE(Uri) * absWork, UriMemoryManager * memory) { |
124 | 10 | if (absWork == NULL) { |
125 | 0 | return URI_ERROR_NULL; |
126 | 0 | } |
127 | | |
128 | 10 | if (URI_FUNC(HasHost)(absWork) && absWork->absolutePath) { |
129 | | /* Empty segment needed, instead? */ |
130 | 4 | if (absWork->pathHead == NULL) { |
131 | 2 | URI_TYPE(PathSegment) * const segment = |
132 | 2 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); |
133 | 2 | if (segment == NULL) { |
134 | 0 | return URI_ERROR_MALLOC; |
135 | 0 | } |
136 | 2 | segment->text.first = URI_FUNC(SafeToPointTo); |
137 | 2 | segment->text.afterLast = URI_FUNC(SafeToPointTo); |
138 | 2 | segment->next = NULL; |
139 | | |
140 | 2 | absWork->pathHead = segment; |
141 | 2 | absWork->pathTail = segment; |
142 | 2 | } |
143 | | |
144 | 4 | absWork->absolutePath = URI_FALSE; |
145 | 4 | } |
146 | | |
147 | 10 | return URI_SUCCESS; |
148 | 10 | } UriResolve.c:uriResolveAbsolutePathFlagA Line | Count | Source | 123 | 3 | URI_TYPE(Uri) * absWork, UriMemoryManager * memory) { | 124 | 3 | if (absWork == NULL) { | 125 | 0 | return URI_ERROR_NULL; | 126 | 0 | } | 127 | | | 128 | 3 | if (URI_FUNC(HasHost)(absWork) && absWork->absolutePath) { | 129 | | /* Empty segment needed, instead? */ | 130 | 2 | if (absWork->pathHead == NULL) { | 131 | 1 | URI_TYPE(PathSegment) * const segment = | 132 | 1 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); | 133 | 1 | if (segment == NULL) { | 134 | 0 | return URI_ERROR_MALLOC; | 135 | 0 | } | 136 | 1 | segment->text.first = URI_FUNC(SafeToPointTo); | 137 | 1 | segment->text.afterLast = URI_FUNC(SafeToPointTo); | 138 | 1 | segment->next = NULL; | 139 | | | 140 | 1 | absWork->pathHead = segment; | 141 | 1 | absWork->pathTail = segment; | 142 | 1 | } | 143 | | | 144 | 2 | absWork->absolutePath = URI_FALSE; | 145 | 2 | } | 146 | | | 147 | 3 | return URI_SUCCESS; | 148 | 3 | } |
UriResolve.c:uriResolveAbsolutePathFlagW Line | Count | Source | 123 | 7 | URI_TYPE(Uri) * absWork, UriMemoryManager * memory) { | 124 | 7 | if (absWork == NULL) { | 125 | 0 | return URI_ERROR_NULL; | 126 | 0 | } | 127 | | | 128 | 7 | if (URI_FUNC(HasHost)(absWork) && absWork->absolutePath) { | 129 | | /* Empty segment needed, instead? */ | 130 | 2 | if (absWork->pathHead == NULL) { | 131 | 1 | URI_TYPE(PathSegment) * const segment = | 132 | 1 | memory->malloc(memory, sizeof(URI_TYPE(PathSegment))); | 133 | 1 | if (segment == NULL) { | 134 | 0 | return URI_ERROR_MALLOC; | 135 | 0 | } | 136 | 1 | segment->text.first = URI_FUNC(SafeToPointTo); | 137 | 1 | segment->text.afterLast = URI_FUNC(SafeToPointTo); | 138 | 1 | segment->next = NULL; | 139 | | | 140 | 1 | absWork->pathHead = segment; | 141 | 1 | absWork->pathTail = segment; | 142 | 1 | } | 143 | | | 144 | 2 | absWork->absolutePath = URI_FALSE; | 145 | 2 | } | 146 | | | 147 | 7 | return URI_SUCCESS; | 148 | 7 | } |
|
149 | | |
150 | | static int URI_FUNC(AddBaseUriImpl)(URI_TYPE(Uri) * absDest, |
151 | | const URI_TYPE(Uri) * relSource, const URI_TYPE(Uri) * absBase, |
152 | 13.3k | UriResolutionOptions options, UriMemoryManager * memory) { |
153 | 13.3k | UriBool relSourceHasScheme; |
154 | | |
155 | 13.3k | if (absDest == NULL) { |
156 | 0 | return URI_ERROR_NULL; |
157 | 0 | } |
158 | 13.3k | URI_FUNC(ResetUri)(absDest); |
159 | | |
160 | 13.3k | if ((relSource == NULL) || (absBase == NULL)) { |
161 | 0 | return URI_ERROR_NULL; |
162 | 0 | } |
163 | | |
164 | | /* absBase absolute? */ |
165 | 13.3k | if (absBase->scheme.first == NULL) { |
166 | 12.6k | return URI_ERROR_ADDBASE_REL_BASE; |
167 | 12.6k | } |
168 | | |
169 | | /* NOTE: The curly brackets here force deeper indent (and that's all) */ |
170 | 706 | { |
171 | 706 | { |
172 | 706 | { |
173 | | /* clang-format off */ |
174 | | /* [00/32] -- A non-strict parser may ignore a scheme in the reference */ |
175 | | /* [00/32] -- if it is identical to the base URI's scheme. */ |
176 | | /* [00/32] if ((not strict) and (R.scheme == Base.scheme)) then */ |
177 | | /* clang-format on */ |
178 | 706 | relSourceHasScheme = |
179 | 706 | (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE; |
180 | 706 | if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT) |
181 | 0 | && (absBase->scheme.first != NULL) |
182 | 0 | && (relSource->scheme.first != NULL) |
183 | 0 | && (URI_FUNC(RangeEquals)( |
184 | 0 | &(absBase->scheme), &(relSource->scheme)))) { |
185 | | /* clang-format off */ |
186 | | /* [00/32] undefine(R.scheme); */ |
187 | | /* clang-format on */ |
188 | 0 | relSourceHasScheme = URI_FALSE; |
189 | | /* clang-format off */ |
190 | | /* [00/32] endif; */ |
191 | | /* clang-format on */ |
192 | 0 | } |
193 | | |
194 | | /* clang-format off */ |
195 | | /* [01/32] if defined(R.scheme) then */ |
196 | | /* clang-format on */ |
197 | 706 | if (relSourceHasScheme) { |
198 | | /* clang-format off */ |
199 | | /* [02/32] T.scheme = R.scheme; */ |
200 | | /* clang-format on */ |
201 | 378 | absDest->scheme = relSource->scheme; |
202 | | /* clang-format off */ |
203 | | /* [03/32] T.authority = R.authority; */ |
204 | | /* clang-format on */ |
205 | 378 | if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) { |
206 | 0 | return URI_ERROR_MALLOC; |
207 | 0 | } |
208 | | /* clang-format off */ |
209 | | /* [04/32] T.path = remove_dot_segments(R.path); */ |
210 | | /* clang-format on */ |
211 | 378 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { |
212 | 0 | return URI_ERROR_MALLOC; |
213 | 0 | } |
214 | 378 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) { |
215 | 0 | return URI_ERROR_MALLOC; |
216 | 0 | } |
217 | | /* clang-format off */ |
218 | | /* [05/32] T.query = R.query; */ |
219 | | /* clang-format on */ |
220 | 378 | absDest->query = relSource->query; |
221 | | /* clang-format off */ |
222 | | /* [06/32] else */ |
223 | | /* clang-format on */ |
224 | 378 | } else { |
225 | | /* clang-format off */ |
226 | | /* [07/32] if defined(R.authority) then */ |
227 | | /* clang-format on */ |
228 | 328 | if (URI_FUNC(HasHost)(relSource)) { |
229 | | /* clang-format off */ |
230 | | /* [08/32] T.authority = R.authority; */ |
231 | | /* clang-format on */ |
232 | 12 | if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) { |
233 | 0 | return URI_ERROR_MALLOC; |
234 | 0 | } |
235 | | /* clang-format off */ |
236 | | /* [09/32] T.path = remove_dot_segments(R.path); */ |
237 | | /* clang-format on */ |
238 | 12 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { |
239 | 0 | return URI_ERROR_MALLOC; |
240 | 0 | } |
241 | 12 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) { |
242 | 0 | return URI_ERROR_MALLOC; |
243 | 0 | } |
244 | | /* clang-format off */ |
245 | | /* [10/32] T.query = R.query; */ |
246 | | /* clang-format on */ |
247 | 12 | absDest->query = relSource->query; |
248 | | /* clang-format off */ |
249 | | /* [11/32] else */ |
250 | | /* clang-format on */ |
251 | 316 | } else { |
252 | | /* clang-format off */ |
253 | | /* [28/32] T.authority = Base.authority; */ |
254 | | /* clang-format on */ |
255 | 316 | if (!URI_FUNC(CopyAuthority)(absDest, absBase, memory)) { |
256 | 0 | return URI_ERROR_MALLOC; |
257 | 0 | } |
258 | | /* clang-format off */ |
259 | | /* [12/32] if (R.path == "") then */ |
260 | | /* clang-format on */ |
261 | 316 | if (relSource->pathHead == NULL && !relSource->absolutePath) { |
262 | | /* clang-format off */ |
263 | | /* [13/32] T.path = Base.path; */ |
264 | | /* clang-format on */ |
265 | 141 | if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) { |
266 | 0 | return URI_ERROR_MALLOC; |
267 | 0 | } |
268 | | /* clang-format off */ |
269 | | /* [14/32] if defined(R.query) then */ |
270 | | /* clang-format on */ |
271 | 141 | if (relSource->query.first != NULL) { |
272 | | /* clang-format off */ |
273 | | /* [15/32] T.query = R.query; */ |
274 | | /* clang-format on */ |
275 | 2 | absDest->query = relSource->query; |
276 | | /* clang-format off */ |
277 | | /* [16/32] else */ |
278 | | /* clang-format on */ |
279 | 139 | } else { |
280 | | /* clang-format off */ |
281 | | /* [17/32] T.query = Base.query; */ |
282 | | /* clang-format on */ |
283 | 139 | absDest->query = absBase->query; |
284 | | /* clang-format off */ |
285 | | /* [18/32] endif; */ |
286 | | /* clang-format on */ |
287 | 139 | } |
288 | | /* clang-format off */ |
289 | | /* [19/32] else */ |
290 | | /* clang-format on */ |
291 | 175 | } else { |
292 | | /* clang-format off */ |
293 | | /* [20/32] if (R.path starts-with "/") then */ |
294 | | /* clang-format on */ |
295 | 175 | if (relSource->absolutePath) { |
296 | 10 | int res; |
297 | | /* clang-format off */ |
298 | | /* [21/32] T.path = remove_dot_segments(R.path); */ |
299 | | /* clang-format on */ |
300 | 10 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { |
301 | 0 | return URI_ERROR_MALLOC; |
302 | 0 | } |
303 | 10 | res = URI_FUNC(ResolveAbsolutePathFlag)(absDest, memory); |
304 | 10 | if (res != URI_SUCCESS) { |
305 | 0 | return res; |
306 | 0 | } |
307 | 10 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)( |
308 | 10 | absDest, memory)) { |
309 | 0 | return URI_ERROR_MALLOC; |
310 | 0 | } |
311 | | /* clang-format off */ |
312 | | /* [22/32] else */ |
313 | | /* clang-format on */ |
314 | 165 | } else { |
315 | | /* clang-format off */ |
316 | | /* [23/32] T.path = merge(Base.path, R.path); */ |
317 | | /* clang-format on */ |
318 | 165 | if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) { |
319 | 0 | return URI_ERROR_MALLOC; |
320 | 0 | } |
321 | 165 | if (!URI_FUNC(MergePath)(absDest, relSource, memory)) { |
322 | 0 | return URI_ERROR_MALLOC; |
323 | 0 | } |
324 | | /* clang-format off */ |
325 | | /* [24/32] T.path = remove_dot_segments(T.path); */ |
326 | | /* clang-format on */ |
327 | 165 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)( |
328 | 165 | absDest, memory)) { |
329 | 0 | return URI_ERROR_MALLOC; |
330 | 0 | } |
331 | | |
332 | 165 | if (!URI_FUNC(FixAmbiguity)(absDest, memory)) { |
333 | 0 | return URI_ERROR_MALLOC; |
334 | 0 | } |
335 | | /* clang-format off */ |
336 | | /* [25/32] endif; */ |
337 | 165 | } |
338 | | /* clang-format off */ |
339 | | /* [26/32] T.query = R.query; */ |
340 | | /* clang-format on */ |
341 | 175 | absDest->query = relSource->query; |
342 | | /* clang-format off */ |
343 | | /* [27/32] endif; */ |
344 | | /* clang-format on */ |
345 | 175 | } |
346 | 316 | URI_FUNC(FixEmptyTrailSegment)(absDest, memory); |
347 | | /* clang-format off */ |
348 | | /* [29/32] endif; */ |
349 | | /* clang-format on */ |
350 | 316 | } |
351 | | /* clang-format off */ |
352 | | /* [30/32] T.scheme = Base.scheme; */ |
353 | | /* clang-format on */ |
354 | 328 | absDest->scheme = absBase->scheme; |
355 | | /* clang-format off */ |
356 | | /* [31/32] endif; */ |
357 | | /* clang-format on */ |
358 | 328 | } |
359 | | /* clang-format off */ |
360 | | /* [32/32] T.fragment = R.fragment; */ |
361 | | /* clang-format on */ |
362 | 706 | absDest->fragment = relSource->fragment; |
363 | 706 | } |
364 | 706 | } |
365 | 706 | } |
366 | 706 | return URI_SUCCESS; |
367 | 706 | } UriResolve.c:uriAddBaseUriImplA Line | Count | Source | 152 | 6.87k | UriResolutionOptions options, UriMemoryManager * memory) { | 153 | 6.87k | UriBool relSourceHasScheme; | 154 | | | 155 | 6.87k | if (absDest == NULL) { | 156 | 0 | return URI_ERROR_NULL; | 157 | 0 | } | 158 | 6.87k | URI_FUNC(ResetUri)(absDest); | 159 | | | 160 | 6.87k | if ((relSource == NULL) || (absBase == NULL)) { | 161 | 0 | return URI_ERROR_NULL; | 162 | 0 | } | 163 | | | 164 | | /* absBase absolute? */ | 165 | 6.87k | if (absBase->scheme.first == NULL) { | 166 | 6.52k | return URI_ERROR_ADDBASE_REL_BASE; | 167 | 6.52k | } | 168 | | | 169 | | /* NOTE: The curly brackets here force deeper indent (and that's all) */ | 170 | 342 | { | 171 | 342 | { | 172 | 342 | { | 173 | | /* clang-format off */ | 174 | | /* [00/32] -- A non-strict parser may ignore a scheme in the reference */ | 175 | | /* [00/32] -- if it is identical to the base URI's scheme. */ | 176 | | /* [00/32] if ((not strict) and (R.scheme == Base.scheme)) then */ | 177 | | /* clang-format on */ | 178 | 342 | relSourceHasScheme = | 179 | 342 | (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE; | 180 | 342 | if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT) | 181 | 0 | && (absBase->scheme.first != NULL) | 182 | 0 | && (relSource->scheme.first != NULL) | 183 | 0 | && (URI_FUNC(RangeEquals)( | 184 | 0 | &(absBase->scheme), &(relSource->scheme)))) { | 185 | | /* clang-format off */ | 186 | | /* [00/32] undefine(R.scheme); */ | 187 | | /* clang-format on */ | 188 | 0 | relSourceHasScheme = URI_FALSE; | 189 | | /* clang-format off */ | 190 | | /* [00/32] endif; */ | 191 | | /* clang-format on */ | 192 | 0 | } | 193 | | | 194 | | /* clang-format off */ | 195 | | /* [01/32] if defined(R.scheme) then */ | 196 | | /* clang-format on */ | 197 | 342 | if (relSourceHasScheme) { | 198 | | /* clang-format off */ | 199 | | /* [02/32] T.scheme = R.scheme; */ | 200 | | /* clang-format on */ | 201 | 185 | absDest->scheme = relSource->scheme; | 202 | | /* clang-format off */ | 203 | | /* [03/32] T.authority = R.authority; */ | 204 | | /* clang-format on */ | 205 | 185 | if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) { | 206 | 0 | return URI_ERROR_MALLOC; | 207 | 0 | } | 208 | | /* clang-format off */ | 209 | | /* [04/32] T.path = remove_dot_segments(R.path); */ | 210 | | /* clang-format on */ | 211 | 185 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { | 212 | 0 | return URI_ERROR_MALLOC; | 213 | 0 | } | 214 | 185 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) { | 215 | 0 | return URI_ERROR_MALLOC; | 216 | 0 | } | 217 | | /* clang-format off */ | 218 | | /* [05/32] T.query = R.query; */ | 219 | | /* clang-format on */ | 220 | 185 | absDest->query = relSource->query; | 221 | | /* clang-format off */ | 222 | | /* [06/32] else */ | 223 | | /* clang-format on */ | 224 | 185 | } else { | 225 | | /* clang-format off */ | 226 | | /* [07/32] if defined(R.authority) then */ | 227 | | /* clang-format on */ | 228 | 157 | if (URI_FUNC(HasHost)(relSource)) { | 229 | | /* clang-format off */ | 230 | | /* [08/32] T.authority = R.authority; */ | 231 | | /* clang-format on */ | 232 | 11 | if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) { | 233 | 0 | return URI_ERROR_MALLOC; | 234 | 0 | } | 235 | | /* clang-format off */ | 236 | | /* [09/32] T.path = remove_dot_segments(R.path); */ | 237 | | /* clang-format on */ | 238 | 11 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { | 239 | 0 | return URI_ERROR_MALLOC; | 240 | 0 | } | 241 | 11 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) { | 242 | 0 | return URI_ERROR_MALLOC; | 243 | 0 | } | 244 | | /* clang-format off */ | 245 | | /* [10/32] T.query = R.query; */ | 246 | | /* clang-format on */ | 247 | 11 | absDest->query = relSource->query; | 248 | | /* clang-format off */ | 249 | | /* [11/32] else */ | 250 | | /* clang-format on */ | 251 | 146 | } else { | 252 | | /* clang-format off */ | 253 | | /* [28/32] T.authority = Base.authority; */ | 254 | | /* clang-format on */ | 255 | 146 | if (!URI_FUNC(CopyAuthority)(absDest, absBase, memory)) { | 256 | 0 | return URI_ERROR_MALLOC; | 257 | 0 | } | 258 | | /* clang-format off */ | 259 | | /* [12/32] if (R.path == "") then */ | 260 | | /* clang-format on */ | 261 | 146 | if (relSource->pathHead == NULL && !relSource->absolutePath) { | 262 | | /* clang-format off */ | 263 | | /* [13/32] T.path = Base.path; */ | 264 | | /* clang-format on */ | 265 | 58 | if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) { | 266 | 0 | return URI_ERROR_MALLOC; | 267 | 0 | } | 268 | | /* clang-format off */ | 269 | | /* [14/32] if defined(R.query) then */ | 270 | | /* clang-format on */ | 271 | 58 | if (relSource->query.first != NULL) { | 272 | | /* clang-format off */ | 273 | | /* [15/32] T.query = R.query; */ | 274 | | /* clang-format on */ | 275 | 1 | absDest->query = relSource->query; | 276 | | /* clang-format off */ | 277 | | /* [16/32] else */ | 278 | | /* clang-format on */ | 279 | 57 | } else { | 280 | | /* clang-format off */ | 281 | | /* [17/32] T.query = Base.query; */ | 282 | | /* clang-format on */ | 283 | 57 | absDest->query = absBase->query; | 284 | | /* clang-format off */ | 285 | | /* [18/32] endif; */ | 286 | | /* clang-format on */ | 287 | 57 | } | 288 | | /* clang-format off */ | 289 | | /* [19/32] else */ | 290 | | /* clang-format on */ | 291 | 88 | } else { | 292 | | /* clang-format off */ | 293 | | /* [20/32] if (R.path starts-with "/") then */ | 294 | | /* clang-format on */ | 295 | 88 | if (relSource->absolutePath) { | 296 | 3 | int res; | 297 | | /* clang-format off */ | 298 | | /* [21/32] T.path = remove_dot_segments(R.path); */ | 299 | | /* clang-format on */ | 300 | 3 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { | 301 | 0 | return URI_ERROR_MALLOC; | 302 | 0 | } | 303 | 3 | res = URI_FUNC(ResolveAbsolutePathFlag)(absDest, memory); | 304 | 3 | if (res != URI_SUCCESS) { | 305 | 0 | return res; | 306 | 0 | } | 307 | 3 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)( | 308 | 3 | absDest, memory)) { | 309 | 0 | return URI_ERROR_MALLOC; | 310 | 0 | } | 311 | | /* clang-format off */ | 312 | | /* [22/32] else */ | 313 | | /* clang-format on */ | 314 | 85 | } else { | 315 | | /* clang-format off */ | 316 | | /* [23/32] T.path = merge(Base.path, R.path); */ | 317 | | /* clang-format on */ | 318 | 85 | if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) { | 319 | 0 | return URI_ERROR_MALLOC; | 320 | 0 | } | 321 | 85 | if (!URI_FUNC(MergePath)(absDest, relSource, memory)) { | 322 | 0 | return URI_ERROR_MALLOC; | 323 | 0 | } | 324 | | /* clang-format off */ | 325 | | /* [24/32] T.path = remove_dot_segments(T.path); */ | 326 | | /* clang-format on */ | 327 | 85 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)( | 328 | 85 | absDest, memory)) { | 329 | 0 | return URI_ERROR_MALLOC; | 330 | 0 | } | 331 | | | 332 | 85 | if (!URI_FUNC(FixAmbiguity)(absDest, memory)) { | 333 | 0 | return URI_ERROR_MALLOC; | 334 | 0 | } | 335 | | /* clang-format off */ | 336 | | /* [25/32] endif; */ | 337 | 85 | } | 338 | | /* clang-format off */ | 339 | | /* [26/32] T.query = R.query; */ | 340 | | /* clang-format on */ | 341 | 88 | absDest->query = relSource->query; | 342 | | /* clang-format off */ | 343 | | /* [27/32] endif; */ | 344 | | /* clang-format on */ | 345 | 88 | } | 346 | 146 | URI_FUNC(FixEmptyTrailSegment)(absDest, memory); | 347 | | /* clang-format off */ | 348 | | /* [29/32] endif; */ | 349 | | /* clang-format on */ | 350 | 146 | } | 351 | | /* clang-format off */ | 352 | | /* [30/32] T.scheme = Base.scheme; */ | 353 | | /* clang-format on */ | 354 | 157 | absDest->scheme = absBase->scheme; | 355 | | /* clang-format off */ | 356 | | /* [31/32] endif; */ | 357 | | /* clang-format on */ | 358 | 157 | } | 359 | | /* clang-format off */ | 360 | | /* [32/32] T.fragment = R.fragment; */ | 361 | | /* clang-format on */ | 362 | 342 | absDest->fragment = relSource->fragment; | 363 | 342 | } | 364 | 342 | } | 365 | 342 | } | 366 | 342 | return URI_SUCCESS; | 367 | 342 | } |
UriResolve.c:uriAddBaseUriImplW Line | Count | Source | 152 | 6.48k | UriResolutionOptions options, UriMemoryManager * memory) { | 153 | 6.48k | UriBool relSourceHasScheme; | 154 | | | 155 | 6.48k | if (absDest == NULL) { | 156 | 0 | return URI_ERROR_NULL; | 157 | 0 | } | 158 | 6.48k | URI_FUNC(ResetUri)(absDest); | 159 | | | 160 | 6.48k | if ((relSource == NULL) || (absBase == NULL)) { | 161 | 0 | return URI_ERROR_NULL; | 162 | 0 | } | 163 | | | 164 | | /* absBase absolute? */ | 165 | 6.48k | if (absBase->scheme.first == NULL) { | 166 | 6.12k | return URI_ERROR_ADDBASE_REL_BASE; | 167 | 6.12k | } | 168 | | | 169 | | /* NOTE: The curly brackets here force deeper indent (and that's all) */ | 170 | 364 | { | 171 | 364 | { | 172 | 364 | { | 173 | | /* clang-format off */ | 174 | | /* [00/32] -- A non-strict parser may ignore a scheme in the reference */ | 175 | | /* [00/32] -- if it is identical to the base URI's scheme. */ | 176 | | /* [00/32] if ((not strict) and (R.scheme == Base.scheme)) then */ | 177 | | /* clang-format on */ | 178 | 364 | relSourceHasScheme = | 179 | 364 | (relSource->scheme.first != NULL) ? URI_TRUE : URI_FALSE; | 180 | 364 | if ((options & URI_RESOLVE_IDENTICAL_SCHEME_COMPAT) | 181 | 0 | && (absBase->scheme.first != NULL) | 182 | 0 | && (relSource->scheme.first != NULL) | 183 | 0 | && (URI_FUNC(RangeEquals)( | 184 | 0 | &(absBase->scheme), &(relSource->scheme)))) { | 185 | | /* clang-format off */ | 186 | | /* [00/32] undefine(R.scheme); */ | 187 | | /* clang-format on */ | 188 | 0 | relSourceHasScheme = URI_FALSE; | 189 | | /* clang-format off */ | 190 | | /* [00/32] endif; */ | 191 | | /* clang-format on */ | 192 | 0 | } | 193 | | | 194 | | /* clang-format off */ | 195 | | /* [01/32] if defined(R.scheme) then */ | 196 | | /* clang-format on */ | 197 | 364 | if (relSourceHasScheme) { | 198 | | /* clang-format off */ | 199 | | /* [02/32] T.scheme = R.scheme; */ | 200 | | /* clang-format on */ | 201 | 193 | absDest->scheme = relSource->scheme; | 202 | | /* clang-format off */ | 203 | | /* [03/32] T.authority = R.authority; */ | 204 | | /* clang-format on */ | 205 | 193 | if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) { | 206 | 0 | return URI_ERROR_MALLOC; | 207 | 0 | } | 208 | | /* clang-format off */ | 209 | | /* [04/32] T.path = remove_dot_segments(R.path); */ | 210 | | /* clang-format on */ | 211 | 193 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { | 212 | 0 | return URI_ERROR_MALLOC; | 213 | 0 | } | 214 | 193 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) { | 215 | 0 | return URI_ERROR_MALLOC; | 216 | 0 | } | 217 | | /* clang-format off */ | 218 | | /* [05/32] T.query = R.query; */ | 219 | | /* clang-format on */ | 220 | 193 | absDest->query = relSource->query; | 221 | | /* clang-format off */ | 222 | | /* [06/32] else */ | 223 | | /* clang-format on */ | 224 | 193 | } else { | 225 | | /* clang-format off */ | 226 | | /* [07/32] if defined(R.authority) then */ | 227 | | /* clang-format on */ | 228 | 171 | if (URI_FUNC(HasHost)(relSource)) { | 229 | | /* clang-format off */ | 230 | | /* [08/32] T.authority = R.authority; */ | 231 | | /* clang-format on */ | 232 | 1 | if (!URI_FUNC(CopyAuthority)(absDest, relSource, memory)) { | 233 | 0 | return URI_ERROR_MALLOC; | 234 | 0 | } | 235 | | /* clang-format off */ | 236 | | /* [09/32] T.path = remove_dot_segments(R.path); */ | 237 | | /* clang-format on */ | 238 | 1 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { | 239 | 0 | return URI_ERROR_MALLOC; | 240 | 0 | } | 241 | 1 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)(absDest, memory)) { | 242 | 0 | return URI_ERROR_MALLOC; | 243 | 0 | } | 244 | | /* clang-format off */ | 245 | | /* [10/32] T.query = R.query; */ | 246 | | /* clang-format on */ | 247 | 1 | absDest->query = relSource->query; | 248 | | /* clang-format off */ | 249 | | /* [11/32] else */ | 250 | | /* clang-format on */ | 251 | 170 | } else { | 252 | | /* clang-format off */ | 253 | | /* [28/32] T.authority = Base.authority; */ | 254 | | /* clang-format on */ | 255 | 170 | if (!URI_FUNC(CopyAuthority)(absDest, absBase, memory)) { | 256 | 0 | return URI_ERROR_MALLOC; | 257 | 0 | } | 258 | | /* clang-format off */ | 259 | | /* [12/32] if (R.path == "") then */ | 260 | | /* clang-format on */ | 261 | 170 | if (relSource->pathHead == NULL && !relSource->absolutePath) { | 262 | | /* clang-format off */ | 263 | | /* [13/32] T.path = Base.path; */ | 264 | | /* clang-format on */ | 265 | 83 | if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) { | 266 | 0 | return URI_ERROR_MALLOC; | 267 | 0 | } | 268 | | /* clang-format off */ | 269 | | /* [14/32] if defined(R.query) then */ | 270 | | /* clang-format on */ | 271 | 83 | if (relSource->query.first != NULL) { | 272 | | /* clang-format off */ | 273 | | /* [15/32] T.query = R.query; */ | 274 | | /* clang-format on */ | 275 | 1 | absDest->query = relSource->query; | 276 | | /* clang-format off */ | 277 | | /* [16/32] else */ | 278 | | /* clang-format on */ | 279 | 82 | } else { | 280 | | /* clang-format off */ | 281 | | /* [17/32] T.query = Base.query; */ | 282 | | /* clang-format on */ | 283 | 82 | absDest->query = absBase->query; | 284 | | /* clang-format off */ | 285 | | /* [18/32] endif; */ | 286 | | /* clang-format on */ | 287 | 82 | } | 288 | | /* clang-format off */ | 289 | | /* [19/32] else */ | 290 | | /* clang-format on */ | 291 | 87 | } else { | 292 | | /* clang-format off */ | 293 | | /* [20/32] if (R.path starts-with "/") then */ | 294 | | /* clang-format on */ | 295 | 87 | if (relSource->absolutePath) { | 296 | 7 | int res; | 297 | | /* clang-format off */ | 298 | | /* [21/32] T.path = remove_dot_segments(R.path); */ | 299 | | /* clang-format on */ | 300 | 7 | if (!URI_FUNC(CopyPath)(absDest, relSource, memory)) { | 301 | 0 | return URI_ERROR_MALLOC; | 302 | 0 | } | 303 | 7 | res = URI_FUNC(ResolveAbsolutePathFlag)(absDest, memory); | 304 | 7 | if (res != URI_SUCCESS) { | 305 | 0 | return res; | 306 | 0 | } | 307 | 7 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)( | 308 | 7 | absDest, memory)) { | 309 | 0 | return URI_ERROR_MALLOC; | 310 | 0 | } | 311 | | /* clang-format off */ | 312 | | /* [22/32] else */ | 313 | | /* clang-format on */ | 314 | 80 | } else { | 315 | | /* clang-format off */ | 316 | | /* [23/32] T.path = merge(Base.path, R.path); */ | 317 | | /* clang-format on */ | 318 | 80 | if (!URI_FUNC(CopyPath)(absDest, absBase, memory)) { | 319 | 0 | return URI_ERROR_MALLOC; | 320 | 0 | } | 321 | 80 | if (!URI_FUNC(MergePath)(absDest, relSource, memory)) { | 322 | 0 | return URI_ERROR_MALLOC; | 323 | 0 | } | 324 | | /* clang-format off */ | 325 | | /* [24/32] T.path = remove_dot_segments(T.path); */ | 326 | | /* clang-format on */ | 327 | 80 | if (!URI_FUNC(RemoveDotSegmentsAbsolute)( | 328 | 80 | absDest, memory)) { | 329 | 0 | return URI_ERROR_MALLOC; | 330 | 0 | } | 331 | | | 332 | 80 | if (!URI_FUNC(FixAmbiguity)(absDest, memory)) { | 333 | 0 | return URI_ERROR_MALLOC; | 334 | 0 | } | 335 | | /* clang-format off */ | 336 | | /* [25/32] endif; */ | 337 | 80 | } | 338 | | /* clang-format off */ | 339 | | /* [26/32] T.query = R.query; */ | 340 | | /* clang-format on */ | 341 | 87 | absDest->query = relSource->query; | 342 | | /* clang-format off */ | 343 | | /* [27/32] endif; */ | 344 | | /* clang-format on */ | 345 | 87 | } | 346 | 170 | URI_FUNC(FixEmptyTrailSegment)(absDest, memory); | 347 | | /* clang-format off */ | 348 | | /* [29/32] endif; */ | 349 | | /* clang-format on */ | 350 | 170 | } | 351 | | /* clang-format off */ | 352 | | /* [30/32] T.scheme = Base.scheme; */ | 353 | | /* clang-format on */ | 354 | 171 | absDest->scheme = absBase->scheme; | 355 | | /* clang-format off */ | 356 | | /* [31/32] endif; */ | 357 | | /* clang-format on */ | 358 | 171 | } | 359 | | /* clang-format off */ | 360 | | /* [32/32] T.fragment = R.fragment; */ | 361 | | /* clang-format on */ | 362 | 364 | absDest->fragment = relSource->fragment; | 363 | 364 | } | 364 | 364 | } | 365 | 364 | } | 366 | 364 | return URI_SUCCESS; | 367 | 364 | } |
|
368 | | |
369 | | int URI_FUNC(AddBaseUri)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource, |
370 | 13.3k | const URI_TYPE(Uri) * absBase) { |
371 | 13.3k | const UriResolutionOptions options = URI_RESOLVE_STRICTLY; |
372 | 13.3k | return URI_FUNC(AddBaseUriEx)(absDest, relSource, absBase, options); |
373 | 13.3k | } Line | Count | Source | 370 | 6.87k | const URI_TYPE(Uri) * absBase) { | 371 | 6.87k | const UriResolutionOptions options = URI_RESOLVE_STRICTLY; | 372 | 6.87k | return URI_FUNC(AddBaseUriEx)(absDest, relSource, absBase, options); | 373 | 6.87k | } |
Line | Count | Source | 370 | 6.48k | const URI_TYPE(Uri) * absBase) { | 371 | 6.48k | const UriResolutionOptions options = URI_RESOLVE_STRICTLY; | 372 | 6.48k | return URI_FUNC(AddBaseUriEx)(absDest, relSource, absBase, options); | 373 | 6.48k | } |
|
374 | | |
375 | | int URI_FUNC(AddBaseUriEx)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource, |
376 | 13.3k | const URI_TYPE(Uri) * absBase, UriResolutionOptions options) { |
377 | 13.3k | return URI_FUNC(AddBaseUriExMm)(absDest, relSource, absBase, options, NULL); |
378 | 13.3k | } Line | Count | Source | 376 | 6.87k | const URI_TYPE(Uri) * absBase, UriResolutionOptions options) { | 377 | 6.87k | return URI_FUNC(AddBaseUriExMm)(absDest, relSource, absBase, options, NULL); | 378 | 6.87k | } |
Line | Count | Source | 376 | 6.48k | const URI_TYPE(Uri) * absBase, UriResolutionOptions options) { | 377 | 6.48k | return URI_FUNC(AddBaseUriExMm)(absDest, relSource, absBase, options, NULL); | 378 | 6.48k | } |
|
379 | | |
380 | | int URI_FUNC(AddBaseUriExMm)(URI_TYPE(Uri) * absDest, const URI_TYPE(Uri) * relSource, |
381 | | const URI_TYPE(Uri) * absBase, UriResolutionOptions options, |
382 | 13.3k | UriMemoryManager * memory) { |
383 | 13.3k | int res; |
384 | | |
385 | 13.3k | URI_CHECK_MEMORY_MANAGER(memory); /* may return */ |
386 | | |
387 | 13.3k | res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options, memory); |
388 | 13.3k | if ((res != URI_SUCCESS) && (absDest != NULL)) { |
389 | 12.6k | URI_FUNC(FreeUriMembersMm)(absDest, memory); |
390 | 12.6k | } |
391 | 13.3k | return res; |
392 | 13.3k | } Line | Count | Source | 382 | 6.87k | UriMemoryManager * memory) { | 383 | 6.87k | int res; | 384 | | | 385 | 6.87k | URI_CHECK_MEMORY_MANAGER(memory); /* may return */ | 386 | | | 387 | 6.87k | res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options, memory); | 388 | 6.87k | if ((res != URI_SUCCESS) && (absDest != NULL)) { | 389 | 6.52k | URI_FUNC(FreeUriMembersMm)(absDest, memory); | 390 | 6.52k | } | 391 | 6.87k | return res; | 392 | 6.87k | } |
Line | Count | Source | 382 | 6.48k | UriMemoryManager * memory) { | 383 | 6.48k | int res; | 384 | | | 385 | 6.48k | URI_CHECK_MEMORY_MANAGER(memory); /* may return */ | 386 | | | 387 | 6.48k | res = URI_FUNC(AddBaseUriImpl)(absDest, relSource, absBase, options, memory); | 388 | 6.48k | if ((res != URI_SUCCESS) && (absDest != NULL)) { | 389 | 6.12k | URI_FUNC(FreeUriMembersMm)(absDest, memory); | 390 | 6.12k | } | 391 | 6.48k | return res; | 392 | 6.48k | } |
|
393 | | |
394 | | #endif |