[xml] Patch for libxml2's xmlIO.c

Date view Thread view Subject view Author view

From: Alejandro Forero Cuervo (bachue@bachue.com)
Date: Thu Jan 25 2001 - 00:45:49 EST


I am attaching a patch that does the following changes to libxml2
2.2.11:

  * xmlIO.c (xmlFileOpen, xmlFileOpenW): Removed unnecesary checks.

  * xmlIO.c (xmlIsDir): Function added to know whether a given
    filename points to a directory or to something else.
  * xmlIO.c (xmlFileOpen, xmlFileOpenW, xmlGzfileOpen,
    xmlGzfileOpenW): Added calls to xmlIsDir.

  * xmlIO.c (xmlGzfileOpen, xmlGzfileOpenW, xmlFdOpen, xmlFdOpenW):
    Pass `path' (rather than `filename') as the parameter to gzopen
    and open.

The patch includes the 4 bug fixes that the patch I sent earlier had.

I tried to make the code as portable as I could (lots of #ifdef's so
if anything at all is not found, all the checks' code will be
#ifdef'ed out) but I'd still like someone on Windows to try it and let
me know it works.

Again, I am assuming the configure scripts gets run there somehow (or
else, how can I get HAVE__STAT defined on Windows?)

I ommited changes to config.h.in, configure and related files to keep
the patch small and simple. Please rerun autoconf/autoheader and all
the appropiate tools.

I am not quite sure I like setting errno explicitly (when the file is
a directory, I am setting it to EISDIR), but the semantics for these
functions are that, should they fail, they must return NULL and leave
a description of the problem in errno. On the other hand, it looks
nice to get `grecvis: /tmp: Is a directory' with:

  if ((tmp = xmlParseFile(file)) == NULL && errno)
    fprintf(stderr, "%s: %s: %s\n", program, file, strerror(errno));

Finally, I'm not sure how to comment my function. It seems you are
using some tool to parse the source file and extract documentation
from there. I tried to mimic the comments for other functions but I
might have missed things.

Please let me know what you think.

Thanks.

Alejo.
http://bachue.com/alejo

--
The mere formulation of a problem is far more essential than its solution.
      -- Albert Einstein.

$0='!/sfldbi!yjoV0msfQ!sfiupob!utvK'x44;print map{("\e[7m \e[0m",chr ord (chop$0)-1)[$_].("\n")[++$i%77]}split//,unpack'B*',pack'H*',($F='F'x19). "F0F3E0607879CC1E0F0F339F3FF399C666733333CCF87F99E6133999999E67CFFCCF3". "219CC1CCC033E7E660198CCE4E66798303873CCE60F3387$F"#Don't you love Perl? ---- Message from the list xml@rpmfind.net Archived at : http://xmlsoft.org/messages/ to unsubscribe: echo "unsubscribe xml" | mail majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Thu Jan 25 2001 - 04:43:47 EST