summaryrefslogtreecommitdiff
path: root/uri.c
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2004-09-10 05:26:00 +0000
committerMike Hommey <mh@glandium.org>2004-09-10 05:26:00 +0000
commit09deb06614c3408ec0816a3c88920138bae2083c (patch)
treea1b841a7dc28eecb98ca361c9371ecd1449a1908 /uri.c
parentc14c53a3645d81281058d4bb4cff24fa8d6faf33 (diff)
downloadlibxml2-09deb06614c3408ec0816a3c88920138bae2083c.tar.gz
Load /tmp/tmp.BmUFjT/libxml2-2.6.13 intoupstream/2.6.13
packages/libxml2/branches/upstream/current.
Diffstat (limited to 'uri.c')
-rw-r--r--uri.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/uri.c b/uri.c
index f36eb9c..10e7db6 100644
--- a/uri.c
+++ b/uri.c
@@ -46,10 +46,12 @@
*/
#define IS_UPALPHA(x) (((x) >= 'A') && ((x) <= 'Z'))
+#ifdef IS_DIGIT
+#undef IS_DIGIT
+#endif
/*
* digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
*/
-
#define IS_DIGIT(x) (((x) >= '0') && ((x) <= '9'))
/*
@@ -1407,8 +1409,8 @@ xmlParseURIPathSegments(xmlURIPtr uri, const char **str, int slash)
}
path = (char *) xmlMallocAtomic(len + 1);
if (path == NULL) {
- xmlGenericError(xmlGenericErrorContext,
- "xmlParseURIPathSegments: out of memory\n");
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlParseURIPathSegments: out of memory\n");
*str = cur;
return (-1);
}
@@ -2122,6 +2124,8 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base)
ix = xmlStrlen (uptr) + 1;
val = (xmlChar *) xmlMalloc (ix + 3 * nbslash);
if (val == NULL) {
+ xmlGenericError(xmlGenericErrorContext,
+ "xmlBuildRelativeURI: out of memory\n");
goto done;
}
vptr = val;
@@ -2193,12 +2197,12 @@ xmlCanonicPath(const xmlChar *path)
len = xmlStrlen(path);
if ((len > 2) && IS_WINDOWS_PATH(path)) {
uri->scheme = xmlStrdup(BAD_CAST "file");
- uri->path = xmlMallocAtomic(len + 2);
+ uri->path = xmlMallocAtomic(len + 2); /* FIXME - check alloc! */
uri->path[0] = '/';
p = uri->path + 1;
strncpy(p, path, len + 1);
} else {
- uri->path = xmlStrdup(path);
+ uri->path = xmlStrdup(path); /* FIXME - check alloc! */
p = uri->path;
}
while (*p != '\0') {
@@ -2209,7 +2213,10 @@ xmlCanonicPath(const xmlChar *path)
#else
uri->path = (char *) xmlStrdup((const xmlChar *) path);
#endif
-
+ if (uri->path == NULL) {
+ xmlFreeURI(uri);
+ return(NULL);
+ }
ret = xmlSaveUri(uri);
xmlFreeURI(uri);
return(ret);