diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:01 +0300 |
commit | 2d37894b1b037cf24231090eda8589bbb44fb6fc (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/libxml/uri.c | |
parent | 718c552901d703c502ccbefdfc3c9028d608b947 (diff) | |
download | ydb-2d37894b1b037cf24231090eda8589bbb44fb6fc.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/libxml/uri.c')
-rw-r--r-- | contrib/libs/libxml/uri.c | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/contrib/libs/libxml/uri.c b/contrib/libs/libxml/uri.c index ed8c6084cd..05d81e5763 100644 --- a/contrib/libs/libxml/uri.c +++ b/contrib/libs/libxml/uri.c @@ -22,7 +22,7 @@ * MAX_URI_LENGTH: * * The definition of the URI regexp in the above RFC has no size limit - * In practice they are usually relatively short except for the + * In practice they are usually relatively short except for the * data URI scheme as defined in RFC 2397. Even for data URI the usual * maximum size before hitting random practical limits is around 64 KB * and 4KB is usually a maximum admitted limit for proper operations. @@ -314,7 +314,7 @@ xmlParse3986Query(xmlURIPtr uri, const char **str) * @uri: pointer to an URI structure * @str: the string to analyze * - * Parse a port part and fills in the appropriate fields + * Parse a port part and fills in the appropriate fields * of the @uri structure * * port = *DIGIT @@ -325,18 +325,18 @@ static int xmlParse3986Port(xmlURIPtr uri, const char **str) { const char *cur = *str; - int port = 0; + int port = 0; if (ISA_DIGIT(cur)) { while (ISA_DIGIT(cur)) { - port = port * 10 + (*cur - '0'); - if (port > 99999999) - port = 99999999; - + port = port * 10 + (*cur - '0'); + if (port > 99999999) + port = 99999999; + cur++; } - if (uri != NULL) - uri->port = port; + if (uri != NULL) + uri->port = port; *str = cur; return(0); } @@ -438,7 +438,7 @@ xmlParse3986Host(xmlURIPtr uri, const char **str) host = cur; /* - * IPv6 and future addressing scheme are enclosed between brackets + * IPv6 and future addressing scheme are enclosed between brackets */ if (*cur == '[') { cur++; @@ -1458,7 +1458,7 @@ xmlNormalizeURIPath(char *path) { goto done_cd; (out++)[0] = (cur++)[0]; } - /* normalize // */ + /* normalize // */ while ((cur[0] == '/') && (cur[1] == '/')) cur++; @@ -1963,9 +1963,9 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { res->scheme = xmlMemStrdup(bas->scheme); if (bas->authority != NULL) res->authority = xmlMemStrdup(bas->authority); - else if ((bas->server != NULL) || (bas->port == -1)) { - if (bas->server != NULL) - res->server = xmlMemStrdup(bas->server); + else if ((bas->server != NULL) || (bas->port == -1)) { + if (bas->server != NULL) + res->server = xmlMemStrdup(bas->server); if (bas->user != NULL) res->user = xmlMemStrdup(bas->user); res->port = bas->port; @@ -2027,9 +2027,9 @@ xmlBuildURI(const xmlChar *URI, const xmlChar *base) { } if (bas->authority != NULL) res->authority = xmlMemStrdup(bas->authority); - else if ((bas->server != NULL) || (bas->port == -1)) { - if (bas->server != NULL) - res->server = xmlMemStrdup(bas->server); + else if ((bas->server != NULL) || (bas->port == -1)) { + if (bas->server != NULL) + res->server = xmlMemStrdup(bas->server); if (bas->user != NULL) res->user = xmlMemStrdup(bas->user); res->port = bas->port; @@ -2152,7 +2152,7 @@ done: * http://site1.com/docs/pic1.gif http://site1.com/docs/pic1.gif * * - * Note: if the URI reference is really weird or complicated, it may be + * Note: if the URI reference is really weird or complicated, it may be * worthwhile to first convert it into a "nice" one by calling * xmlBuildURI (using 'base') before calling this routine, * since this routine (for reasonable efficiency) assumes URI has @@ -2239,23 +2239,23 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) * two path components may be missing (bug 316224) */ bptr = (xmlChar *)bas->path; - { - xmlChar *rptr = (xmlChar *) ref->path; - int pos = 0; - - /* - * Next we compare the two strings and find where they first differ - */ - if ((*rptr == '.') && (rptr[1] == '/')) - rptr += 2; + { + xmlChar *rptr = (xmlChar *) ref->path; + int pos = 0; + + /* + * Next we compare the two strings and find where they first differ + */ + if ((*rptr == '.') && (rptr[1] == '/')) + rptr += 2; if ((*bptr == '.') && (bptr[1] == '/')) bptr += 2; - else if ((*bptr == '/') && (*rptr != '/')) + else if ((*bptr == '/') && (*rptr != '/')) bptr++; - while ((bptr[pos] == rptr[pos]) && (bptr[pos] != 0)) + while ((bptr[pos] == rptr[pos]) && (bptr[pos] != 0)) pos++; - if (bptr[pos] == rptr[pos]) { + if (bptr[pos] == rptr[pos]) { val = xmlStrdup(BAD_CAST ""); goto done; /* (I can't imagine why anyone would do this) */ } @@ -2266,27 +2266,27 @@ xmlBuildRelativeURI (const xmlChar * URI, const xmlChar * base) */ ix = pos; for (; ix > 0; ix--) { - if (rptr[ix - 1] == '/') + if (rptr[ix - 1] == '/') break; } - uptr = (xmlChar *)&rptr[ix]; + uptr = (xmlChar *)&rptr[ix]; /* * In base, count the number of '/' from the differing point */ - for (; bptr[ix] != 0; ix++) { - if (bptr[ix] == '/') - nbslash++; + for (; bptr[ix] != 0; ix++) { + if (bptr[ix] == '/') + nbslash++; + } + + /* + * e.g: URI="foo/" base="foo/bar" -> "./" + */ + if (nbslash == 0 && !uptr[0]) { + val = xmlStrdup(BAD_CAST "./"); + goto done; } - - /* - * e.g: URI="foo/" base="foo/bar" -> "./" - */ - if (nbslash == 0 && !uptr[0]) { - val = xmlStrdup(BAD_CAST "./"); - goto done; - } - + len = xmlStrlen (uptr) + 1; } @@ -2377,7 +2377,7 @@ xmlCanonicPath(const xmlChar *path) */ #if defined(_WIN32) && !defined(__CYGWIN__) int len = 0; - char *p = NULL; + char *p = NULL; #endif xmlURIPtr uri; xmlChar *ret; @@ -2441,7 +2441,7 @@ xmlCanonicPath(const xmlChar *path) xmlFreeURI(uri); return escURI; } - xmlFree(escURI); + xmlFree(escURI); } } @@ -2459,26 +2459,26 @@ path_processing: len = xmlStrlen(path); if ((len > 2) && IS_WINDOWS_PATH(path)) { /* make the scheme 'file' */ - uri->scheme = (char *) xmlStrdup(BAD_CAST "file"); + uri->scheme = (char *) xmlStrdup(BAD_CAST "file"); /* allocate space for leading '/' + path + string terminator */ uri->path = xmlMallocAtomic(len + 2); if (uri->path == NULL) { - xmlFreeURI(uri); /* Guard against 'out of memory' */ + xmlFreeURI(uri); /* Guard against 'out of memory' */ return(NULL); } /* Put in leading '/' plus path */ uri->path[0] = '/'; p = uri->path + 1; - strncpy(p, (char *) path, len + 1); + strncpy(p, (char *) path, len + 1); } else { - uri->path = (char *) xmlStrdup(path); + uri->path = (char *) xmlStrdup(path); if (uri->path == NULL) { xmlFreeURI(uri); return(NULL); } p = uri->path; } - /* Now change all occurrences of '\' to '/' */ + /* Now change all occurrences of '\' to '/' */ while (*p != '\0') { if (*p == '\\') *p = '/'; @@ -2528,7 +2528,7 @@ xmlPathToURI(const xmlChar *path) return(NULL); #if defined(_WIN32) && !defined(__CYGWIN__) /* xmlCanonicPath can return an URI on Windows (is that the intended behaviour?) - If 'cal' is a valid URI already then we are done here, as continuing would make + If 'cal' is a valid URI already then we are done here, as continuing would make it invalid. */ if ((uri = xmlParseURI((const char *) cal)) != NULL) { xmlFreeURI(uri); |