]> git.pld-linux.org Git - packages/crossmingw32-libxml2.git/blob - libxml2-open.gz.patch
- updated to 2.12.6
[packages/crossmingw32-libxml2.git] / libxml2-open.gz.patch
1 diff -ur libxml2-2.4.20/xmlIO.c libxml2-2.4.20-/xmlIO.c
2 --- libxml2-2.4.20/xmlIO.c      Wed Mar 27 04:35:12 2002
3 +++ libxml2-2.4.20-/xmlIO.c     Thu May 23 20:35:12 2002
4 @@ -465,8 +465,35 @@
5  
6      if (path == NULL)
7         return(NULL);
8 -    if (!xmlCheckFilename(path))
9 -        return(NULL);
10 +       
11 +    if (!xmlCheckFilename(path)) {
12 +        /* If we cannot open `foo.xml', we try `foo.xml.gz'. However we i
13 +        * append .gz only if filename doesn't alreay end with .gz. */
14 +        if (strlen(path) < 3 || strcmp(path + strlen(path) - 3, ".gz") != 0) {
15 +            char *gz_filename = xmlMalloc(strlen(path) + 4);
16 +
17 +           if (gz_filename == NULL) {
18 +               xmlGenericError(xmlGenericErrorContext,
19 +                               "xmlGzfileOpen:  %s\n",
20 +                               "Failure allocating buffer for filename.");
21 +               return NULL;
22 +            }
23 +       
24 +             strcpy(gz_filename, path);
25 +            strcat(gz_filename, ".gz");
26 +
27 +            fd = NULL;
28 +            
29 +            if (xmlCheckFilename(gz_filename))
30 +               fd = gzopen(gz_filename, "rb");
31 +                
32 +            xmlFree(gz_filename);
33 +            
34 +             return((void *) fd);
35 +       } else {
36 +           return NULL;
37 +       }
38 +    }
39  
40      fd = gzopen(path, "rb");
41      return((void *) fd);
This page took 0.030344 seconds and 3 git commands to generate.