]> git.pld-linux.org Git - packages/crossmingw32-libxml2.git/commitdiff
- try open foo.xml.gz if foo.xml cannot be found libxml2-2_4_21-3 libxml2-2_4_21-4 libxml2-2_4_21-6 libxml2-2_4_22-1 libxml2-2_4_22-2 libxml2-2_4_23-1
authorMichal Moskal <michal@moskal.me>
Fri, 24 May 2002 11:51:39 +0000 (11:51 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    libxml2-open.gz.patch -> 1.1

libxml2-open.gz.patch [new file with mode: 0644]

diff --git a/libxml2-open.gz.patch b/libxml2-open.gz.patch
new file mode 100644 (file)
index 0000000..342e8b8
--- /dev/null
@@ -0,0 +1,41 @@
+diff -ur libxml2-2.4.20/xmlIO.c libxml2-2.4.20-/xmlIO.c
+--- libxml2-2.4.20/xmlIO.c     Wed Mar 27 04:35:12 2002
++++ libxml2-2.4.20-/xmlIO.c    Thu May 23 20:35:12 2002
+@@ -465,8 +465,35 @@
+     if (path == NULL)
+       return(NULL);
+-    if (!xmlCheckFilename(path))
+-        return(NULL);
++      
++    if (!xmlCheckFilename(path)) {
++        /* If we cannot open `foo.xml', we try `foo.xml.gz'. However we i
++       * append .gz only if filename doesn't alreay end with .gz. */
++        if (strlen(path) < 3 || strcmp(path + strlen(path) - 3, ".gz") != 0) {
++            char *gz_filename = xmlMalloc(strlen(path) + 4);
++
++          if (gz_filename == NULL) {
++              xmlGenericError(xmlGenericErrorContext,
++                              "xmlGzfileOpen:  %s\n",
++                              "Failure allocating buffer for filename.");
++              return NULL;
++           }
++      
++             strcpy(gz_filename, path);
++           strcat(gz_filename, ".gz");
++
++           fd = NULL;
++           
++           if (xmlCheckFilename(gz_filename))
++              fd = gzopen(gz_filename, "rb");
++               
++           xmlFree(gz_filename);
++           
++             return((void *) fd);
++      } else {
++          return NULL;
++      }
++    }
+     fd = gzopen(path, "rb");
+     return((void *) fd);
This page took 0.251599 seconds and 4 git commands to generate.