Re: about xmlReadMemory()

Nick Wellnhofer via xml <[email protected]> Tue, 2 Mar 2021 18:02:06 +0100
Newsgroups gmane.comp.gnome.lib.xml.general
Message-ID <[email protected]>
On 02/03/2021 16:28, nicolas bats via xml wrote:
> Hi,
> is there's a reason why xmlReadMemory 
> <http://xmlsoft.org/html/libxml-parser.html#xmlReadMemory>() accepts int as 
> the size of the array to transform to xmlDocPtr.
> no doubt there's one...

That's simply a design mistake. The API was created 20 years ago when 64-bit 
systems were rare.

> and in that case how could I retrieve a xmlDocPtr from 
> memory where size is type of size_t?

If you want to process memory buffers larger than INT_MAX, you can use 
xmlReadIO with a custom read callback that uses a size_t to store the offset.

Nick