summaryrefslogtreecommitdiff
path: root/src/UriNormalize.c
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhsoting.net>2020-06-01 18:51:16 +0200
committerJörg Frings-Fürst <debian@jff-webhsoting.net>2020-06-01 18:51:16 +0200
commit9a2dfe455d3ccf649e2a0f78a50927580bcbbe19 (patch)
tree34bde47bb4e1c2a05a6d6cda3cb475754d2eb515 /src/UriNormalize.c
parentb08941cd7113d882790c7d62edb59f31649daadd (diff)
New upstream version 0.9.4upstream/0.9.4
Diffstat (limited to 'src/UriNormalize.c')
-rw-r--r--src/UriNormalize.c77
1 files changed, 54 insertions, 23 deletions
diff --git a/src/UriNormalize.c b/src/UriNormalize.c
index 0e798c0..04a8e5f 100644
--- a/src/UriNormalize.c
+++ b/src/UriNormalize.c
@@ -5,32 +5,32 @@
* Copyright (C) 2007, Sebastian Pipping <sebastian@pipping.org>
* All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
* are met:
*
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the following
- * disclaimer.
+ * 1. Redistributions of source code must retain the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer.
*
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials
- * provided with the distribution.
+ * 2. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials
+ * provided with the distribution.
*
- * * Neither the name of the <ORGANIZATION> nor the names of its
- * contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
+ * 3. Neither the name of the copyright holder nor the names of
+ * its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written
+ * permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
@@ -86,7 +86,7 @@ static int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri, unsigned int inM
static UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
unsigned int maskTest, URI_TYPE(TextRange) * range,
UriMemoryManager * memory);
-static UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
+static UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
unsigned int * doneMask, UriMemoryManager * memory);
static void URI_FUNC(FixPercentEncodingInplace)(const URI_CHAR * first,
@@ -391,7 +391,7 @@ static URI_INLINE UriBool URI_FUNC(MakeRangeOwner)(unsigned int * doneMask,
-static URI_INLINE UriBool URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri,
+static URI_INLINE UriBool URI_FUNC(MakeOwnerEngine)(URI_TYPE(Uri) * uri,
unsigned int * doneMask, UriMemoryManager * memory) {
URI_TYPE(PathSegment) * walker = uri->pathHead;
if (!URI_FUNC(MakeRangeOwner)(doneMask, URI_NORMALIZE_SCHEME,
@@ -756,7 +756,7 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
/* Dup all not duped yet */
if ((outMask == NULL) && !uri->owner) {
- if (!URI_FUNC(MakeOwner)(uri, &doneMask, memory)) {
+ if (!URI_FUNC(MakeOwnerEngine)(uri, &doneMask, memory)) {
URI_FUNC(PreventLeakage)(uri, doneMask, memory);
return URI_ERROR_MALLOC;
}
@@ -768,4 +768,35 @@ static URI_INLINE int URI_FUNC(NormalizeSyntaxEngine)(URI_TYPE(Uri) * uri,
+int URI_FUNC(MakeOwnerMm)(URI_TYPE(Uri) * uri, UriMemoryManager * memory) {
+ unsigned int doneMask = URI_NORMALIZED;
+
+ URI_CHECK_MEMORY_MANAGER(memory); /* may return */
+
+ if (uri == NULL) {
+ return URI_ERROR_NULL;
+ }
+
+ if (uri->owner == URI_TRUE) {
+ return URI_SUCCESS;
+ }
+
+ if (! URI_FUNC(MakeOwnerEngine)(uri, &doneMask, memory)) {
+ URI_FUNC(PreventLeakage)(uri, doneMask, memory);
+ return URI_ERROR_MALLOC;
+ }
+
+ uri->owner = URI_TRUE;
+
+ return URI_SUCCESS;
+}
+
+
+
+int URI_FUNC(MakeOwner)(URI_TYPE(Uri) * uri) {
+ return URI_FUNC(MakeOwnerMm)(uri, NULL);
+}
+
+
+
#endif