Am 14.09.10 03:57, schrieb Alasdair:
> I have recently been delving into FG's innards, with a view to fixing
> some problems with the speech handling capabilities. This has led
> indirecly to my having to understand how XML files are parsed.
>
> Now in SG's XML folder is a program called easyxml.cxx which reads the
> XML files before passing contents to expat's xmlparse.c. The problem I
> have discovered is that an entire XML file is read in _one_ chunk into a
> 16k buffer declared at line 222. A dozen or so lines later a read
> operation is performed which reads the _entire_ XML file into that
> buffer. Now since preferences.xml is more than 3 times the size of this
> only one third of it gets parsed, with means that the final partial line
> that makes it into the buffer is in an indeterminate state. That happens
> arount line 410 of preferences.xml. Furthermore garbage is passed to the
> parser when when the end of the buffer is reached on readback.
>
> I am so astonished with this discovery that I can barely believe the
> evidence of my eyes and my tests.
>
> Can someone confirm that I have not gone loopy? Because if I am right
> this could explain a lot of strange goings on. Where am I going wrong?
>    
You refer to this read operation?
236:     input.read(buf,16384);
It reads only the next (up to) 16384 characters from the input stream, 
not the entire file
http://www.cplusplus.com/reference/iostream/istream/read/

Regards, Torsten


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to