summaryrefslogtreecommitdiff
path: root/uri.c
diff options
context:
space:
mode:
authorMike Hommey <glandium@debian.org>2009-10-10 23:44:38 +0200
committerMike Hommey <glandium@debian.org>2009-10-10 23:44:38 +0200
commit8a10e02b2f4971d3fdacab7dc7baecced34056fb (patch)
tree2aaafcfd557152fe4f908d548ec97e97172154f0 /uri.c
parent67a17fecb5b5fe2058af6405bc9601875f3e75a1 (diff)
downloadlibxml2-8a10e02b2f4971d3fdacab7dc7baecced34056fb.tar.gz
Import upstream version 2.7.6upstream/2.7.6.dfsg
Diffstat (limited to 'uri.c')
-rw-r--r--uri.c48
1 files changed, 32 insertions, 16 deletions
diff --git a/uri.c b/uri.c
index 1e5e03f..950e177 100644
--- a/uri.c
+++ b/uri.c
@@ -558,10 +558,14 @@ xmlParse3986PathAbEmpty(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (*str != cur) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);
@@ -600,10 +604,14 @@ xmlParse3986PathAbsolute(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (cur != *str) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);
@@ -638,10 +646,14 @@ xmlParse3986PathRootless(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (cur != *str) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);
@@ -676,10 +688,14 @@ xmlParse3986PathNoScheme(xmlURIPtr uri, const char **str)
}
if (uri != NULL) {
if (uri->path != NULL) xmlFree(uri->path);
- if (uri->cleanup & 2)
- uri->path = STRNDUP(*str, cur - *str);
- else
- uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ if (cur != *str) {
+ if (uri->cleanup & 2)
+ uri->path = STRNDUP(*str, cur - *str);
+ else
+ uri->path = xmlURIUnescapeString(*str, cur - *str, NULL);
+ } else {
+ uri->path = NULL;
+ }
}
*str = cur;
return (0);