MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlCanonicPath

Function xmlCanonicPath

ThirdParty/libxml2/vtklibxml2/uri.c:2781–2804  ·  view source on GitHub ↗

* xmlCanonicPath: * @path: the resource locator in a filesystem notation * * Prepares a path. * * If the path contains the substring "://", it is considered a * Legacy Extended IRI. Characters which aren't allowed in URIs are * escaped. * * Otherwise, the path is considered a filesystem path which is * copied without modification. * * The caller is responsible for freeing the memory o

Source from the content-addressed store, hash-verified

2779 * Returns the escaped path.
2780 */
2781xmlChar *
2782xmlCanonicPath(const xmlChar *path)
2783{
2784 xmlChar *ret;
2785
2786 if (path == NULL)
2787 return(NULL);
2788
2789 /* Check if this is an "absolute uri" */
2790 if (xmlStrstr(path, BAD_CAST "://") != NULL) {
2791 /*
2792 * Escape all characters except reserved, unreserved and the
2793 * percent sign.
2794 *
2795 * xmlURIEscapeStr already keeps unreserved characters, so we
2796 * pass gen-delims, sub-delims and "%" to ignore.
2797 */
2798 ret = xmlURIEscapeStr(path, BAD_CAST ":/?#[]@!$&()*+,;='%");
2799 } else {
2800 ret = xmlStrdup((const xmlChar *) path);
2801 }
2802
2803 return(ret);
2804}
2805
2806/**
2807 * xmlPathToURI:

Callers 9

xmlParseCatalogFileFunction · 0.85
xmlSAX2ExternalSubsetFunction · 0.85
xmlTextReaderSetupFunction · 0.85
xmlNewInputFromFileFunction · 0.85
xmlLoadExternalEntityFunction · 0.85
xmlSAXParseDTDFunction · 0.85
xmlShellLoadFunction · 0.85
xmlPathToURIFunction · 0.85

Calls 3

xmlStrstrFunction · 0.85
xmlURIEscapeStrFunction · 0.85
xmlStrdupFunction · 0.85

Tested by

no test coverage detected