Re: [xml] Setting default buffer size for input callbacks



On Wed, Jul 14, 2004 at 10:10:12AM -0700, Andrew wrote:
I've already implemented my callbacks using the I/O handler interface. 
For instance, I have a function:

  static int BigFileRead(void* context, char* buffer, int len) {
    if (context == NULL) return -1;
    File* file = (File*)context;
    return file->Read(buffer, len);
  }

My issue is that the "len" parameter seems to be automagically set to
4000 bytes.  I would like it to be something more like 1<<20 bytes.  

The only places I can find the 4000 byte len defined are in tree.h and
xmlIO.c, but these are both #define's and I can't seem to override them.

Is there any way for me to up this "len" parameter so my BigFileRead
function gets called with a larger value?

  This is not tunable, and I don't believe it will provide
any gain. It would just force libxml2 internals to allocate larger
buffers, but the data can be buffered on your side if you want
to make larger read. The amount of data to be copied will be the
same anyway.
  I don't think I will support changing this radically, first
because I don't se the potential gain, second because that buffer
layer is a sensible part of the architecture and I don't want
to mess with it unless there is a very clear benefit.
  You can try to hack around libxml2 code searching for 4000
and replace it, but the chances of getting to a non-functional
library triggering bizarre bugs are likely, and I don't feel ready
to support this.

Daniel

-- 
Daniel Veillard      | Red Hat Desktop team http://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]