Re: [xml] I got libxml2 to link on Windows and repaired a "bug"



On Mon, Mar 08, 2004 at 07:46:49PM -0700, Eric S. Eberhard wrote:
Note:  I am using 2.5.11 as that is what I use on my unix versions

1) I finally got the projects in order and manually modified the 
xmlversion.h file and fixed a link for that file (as it is include in one 
place and used in the build script in another).  I could provide 
documentation on what I did but the consensus seemed to be not to use the 
projects anyway, so I probably did it the dumb way, but I'm happy being 
dumb :-)

2) I got it linked statically into my application and almost everything 
worked as well as unix with one exception --> if dumping a document to 
stdout I would loose all or part of it.  After much hunting and agony I had 
to patch xmlIO.c as such just before the "return(0)" for stdout and stdin:

    if (fil == stdout || fil == stderr)
        fflush(fil);

  Which routine exactly ? I can probably find it myself, but I
would rather make sure I do exactly the same change...

It was too late to do it in my program which does a xmlSaveFormatFile(...) 
-> e.g.:

xmlSaveFormatFile()
fflush(stdout);

does not work.

I did not get to the where/how/why of it, only that my patch works.  I 
suspect it is partially application dependent in that my stdin and stdout 
and stderr are pipes to another process ... BUT ... since a close
normally (logically) does a flush and then a close, it is probably a good 
idea and good practice to go ahead and flush the buffers as I did (because 
you correctly do NOT close stderr and stdout, but ... the flush should 
occur).

  yeah, if stdout the flush is missing, I agree. Usually stderr flushes
automatically (or at least at each end of line), but it's fine doing so.

I can always make the change again in future versions so I have not 
heartache if this change is not made,
but I would ask that the powers that be consider it :-)

  :-) Of course !

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]