From 09deb06614c3408ec0816a3c88920138bae2083c Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Fri, 10 Sep 2004 05:26:00 +0000 Subject: Load /tmp/tmp.BmUFjT/libxml2-2.6.13 into packages/libxml2/branches/upstream/current. --- uri.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'uri.c') 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); -- cgit v1.2.3