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

Function xmlConvertUriToPath

ThirdParty/libxml2/vtklibxml2/xmlIO.c:471–500  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

469}
470
471static int
472xmlConvertUriToPath(const char *uri, char **out) {
473 const char *escaped;
474 char *unescaped;
475
476 *out = NULL;
477
478 if (!xmlStrncasecmp(BAD_CAST uri, BAD_CAST "file://localhost/", 17)) {
479 escaped = &uri[16];
480 } else if (!xmlStrncasecmp(BAD_CAST uri, BAD_CAST "file:///", 8)) {
481 escaped = &uri[7];
482 } else if (!xmlStrncasecmp(BAD_CAST uri, BAD_CAST "file:/", 6)) {
483 /* lots of generators seems to lazy to read RFC 1738 */
484 escaped = &uri[5];
485 } else {
486 return(1);
487 }
488
489#ifdef _WIN32
490 /* Ignore slash like in file:///C:/file.txt */
491 escaped += 1;
492#endif
493
494 unescaped = xmlURIUnescapeString(escaped, 0, NULL);
495 if (unescaped == NULL)
496 return(-1);
497
498 *out = unescaped;
499 return(0);
500}
501
502/**
503 * xmlFdOpen:

Callers 3

xmlFdOpenFunction · 0.85
xmlFileOpenSafeFunction · 0.85
xmlNoNetExistsFunction · 0.85

Calls 2

xmlStrncasecmpFunction · 0.85
xmlURIUnescapeStringFunction · 0.85

Tested by

no test coverage detected