Re: [xml] xmlReadMemory limitation



sorry about this mess....strlen/sizeof....I was blind



-----Original Message-----
From: Daniel Veillard <veillard redhat com>
To: Espen Ekeroth <espene halden net>
Date: Fri, 11 Mar 2005 05:22:07 -0500
Subject: Re: [xml] xmlReadMemory limitation

On Fri, Mar 11, 2005 at 11:12:30AM +0100, Espen Ekeroth wrote:
64          doc = xmlReadMemory(a_node->content, sizeof(a_node-
content), "noname.xml", NULL, 0);

[...]
The reason for this error is that xmlReadMemory only sees 4 bytes as
the 
size due to the return value from sizeof(a_node->content)

   what about reading my mail ;-) ? 

:   doc = xmlReadMemory(a_node->content, strlen(a_node->content),
:                       "noname.xml", NULL, 0);

obviously sizeof of a pointer is 4 on an i386 architecture. I asked to
use strlen(), which walks the memory pointed until it find the 0 byte
indicating the end and returns the length. It really is basic C
knowledge.

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]