1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-30 22:43:14 +03:00

messing around with support for Windows path, cleanups, trying to identify

* include/libxml/xmlIO.h xmlIO.c parser.c HTMLparser.c DOCBparser.c:
  messing around with support for Windows path, cleanups,
  trying to identify and fix the various code path to the
  filename access. Added xmlNormalizeWindowsPath()
Daniel
This commit is contained in:
Daniel Veillard
2002-09-10 11:13:43 +00:00
parent cb7543bead
commit f4862f0f36
5 changed files with 120 additions and 23 deletions

View File

@ -666,7 +666,7 @@ xmlParseStringCharRef(xmlParserCtxtPtr ctxt, const xmlChar **str) {
static void deallocblankswrapper (xmlChar *str) {xmlFree(str);}
xmlParserInputPtr
static xmlParserInputPtr
xmlNewBlanksWrapperInputStream(xmlParserCtxtPtr ctxt, xmlEntityPtr entity) {
xmlParserInputPtr input;
xmlChar *buffer;
@ -1808,12 +1808,11 @@ xmlParseName(xmlParserCtxtPtr ctxt) {
* and the name for mismatch
*/
xmlChar *
static xmlChar *
xmlParseNameAndCompare(xmlParserCtxtPtr ctxt, xmlChar const *other) {
const xmlChar *cmp = other;
const xmlChar *in;
xmlChar *ret;
int count = 0;
GROW;
@ -2275,8 +2274,7 @@ xmlParseAttValueComplex(xmlParserCtxtPtr ctxt);
xmlChar *
xmlParseAttValue(xmlParserCtxtPtr ctxt) {
xmlChar limit = 0;
xmlChar *buf = NULL;
xmlChar *in = NULL;
const xmlChar *in = NULL;
xmlChar *ret = NULL;
SHRINK;
GROW;
@ -9002,7 +9000,8 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
if (filename == NULL)
inputStream->filename = NULL;
else
inputStream->filename = xmlMemStrdup(filename);
inputStream->filename = (char *)
xmlNormalizeWindowsPath((const xmlChar *) filename);
inputStream->buf = buf;
inputStream->base = inputStream->buf->buffer->content;
inputStream->cur = inputStream->buf->buffer->content;
@ -10021,6 +10020,7 @@ xmlCreateFileParserCtxt(const char *filename)
xmlParserCtxtPtr ctxt;
xmlParserInputPtr inputStream;
char *directory = NULL;
xmlChar *normalized;
ctxt = xmlNewParserCtxt();
if (ctxt == NULL) {
@ -10030,18 +10030,26 @@ xmlCreateFileParserCtxt(const char *filename)
return(NULL);
}
inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
normalized = xmlNormalizeWindowsPath((const xmlChar *) filename);
if (normalized == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
}
inputStream = xmlLoadExternalEntity((char *) normalized, NULL, ctxt);
if (inputStream == NULL) {
xmlFreeParserCtxt(ctxt);
xmlFree(normalized);
return(NULL);
}
inputPush(ctxt, inputStream);
if ((ctxt->directory == NULL) && (directory == NULL))
directory = xmlParserGetDirectory(filename);
directory = xmlParserGetDirectory((char *) normalized);
if ((ctxt->directory == NULL) && (directory != NULL))
ctxt->directory = directory;
xmlFree(normalized);
return(ctxt);
}