Re: [xslt] Recent changes to external entity handling?
- From: Igor Zlatkovic <igor zlatkovic com>
- To: xslt gnome org
- Subject: Re: [xslt] Recent changes to external entity handling?
- Date: Sat, 22 Feb 2003 18:26:44 +0100
I fixed my coffee :-) The patch is below, will commit later today.
Ciao,
Igor
Index: parser.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/parser.c,v
retrieving revision 1.246
diff -c -r1.246 parser.c
*** parser.c 21 Feb 2003 23:23:27 -0000 1.246
--- parser.c 22 Feb 2003 17:10:45 -0000
***************
*** 10342,10347 ****
--- 10342,10348 ----
{
xmlParserCtxtPtr ctxt;
xmlParserInputPtr inputStream;
+ char *canonicFilename;
char *directory = NULL;
ctxt = xmlNewParserCtxt();
***************
*** 10352,10358 ****
return(NULL);
}
! inputStream = xmlLoadExternalEntity(filename, NULL, ctxt);
if (inputStream == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
--- 10353,10368 ----
return(NULL);
}
! canonicFilename = xmlCanonicPath(filename);
! if (canonicFilename == NULL) {
! if (xmlDefaultSAXHandler.error != NULL) {
! xmlDefaultSAXHandler.error(NULL, "out of memory\n");
! }
! return(NULL);
! }
!
! inputStream = xmlLoadExternalEntity(canonicFilename, NULL, ctxt);
! xmlFree(canonicFilename);
if (inputStream == NULL) {
xmlFreeParserCtxt(ctxt);
return(NULL);
Index: uri.c
===================================================================
RCS file: /cvs/gnome/gnome-xml/uri.c,v
retrieving revision 1.53
diff -c -r1.53 uri.c
*** uri.c 19 Feb 2003 14:50:25 -0000 1.53
--- uri.c 22 Feb 2003 17:10:47 -0000
***************
*** 1985,1992 ****
xmlChar*
xmlCanonicPath(const xmlChar *path)
{
! int len, i = 0;
xmlChar *ret;
xmlURIPtr uri;
if (path == NULL)
--- 1985,1994 ----
xmlChar*
xmlCanonicPath(const xmlChar *path)
{
! int len = 0;
! int i = 0;
xmlChar *ret;
+ xmlChar *p = NULL;
xmlURIPtr uri;
if (path == NULL)
***************
*** 1998,2020 ****
uri = xmlCreateURI();
! #if defined(_WIN32) && !defined(__CYGWIN__)
len = xmlStrlen(path);
if ((len > 2) && IS_WINDOWS_PATH(path)) {
uri->scheme = xmlStrdup(BAD_CAST "file");
! uri->path = xmlMalloc(len + 1);
uri->path[0] = '/';
! while (i < len) {
! if (path[i] == '\\')
! uri->path[i+1] = '/';
! else
! uri->path[i+1] = path[i];
! i++;
! }
! uri->path[len] = '\0';
! } else
! #endif
uri->path = xmlStrdup(path);
ret = xmlSaveUri(uri);
xmlFreeURI(uri);
--- 2000,2025 ----
uri = xmlCreateURI();
! #if defined(_WIN32) && !defined(__CYGWIN__)
len = xmlStrlen(path);
if ((len > 2) && IS_WINDOWS_PATH(path)) {
uri->scheme = xmlStrdup(BAD_CAST "file");
! uri->path = xmlMalloc(len + 2);
uri->path[0] = '/';
! p = uri->path + 1;
! strncpy(p, path, len + 1);
! } else {
uri->path = xmlStrdup(path);
+ p = uri->path;
+ }
+ while (*p != '\0') {
+ if (*p == '\\')
+ *p = '/';
+ p++;
+ }
+ #else
+ uri->path = xmlStrdup(path);
+ #endif
ret = xmlSaveUri(uri);
xmlFreeURI(uri);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]