Re: [xml] strchr in xmlschemas.c



On Mon, Apr 05, 2004 at 10:36:14AM +0100, Philip Ludlam wrote:
On Mon, 5 Apr 2004 at 03:09 -0400 Daniel Veillard wrote:

On Sun, Apr 04, 2004 at 05:40:45PM +0100, Philip Ludlam wrote:
Dear All,

My C implementation defines strchr to have 2 arguments, the 1st being
a char* .

As xmlChar is an unsigned char and not a char, my C compiler faults the
use of strchr at line 1495 in xmlschemas.c in libxml2-2.6.8

The attached patch calls xmlStrchr in it's place.

 This was fixed by using
   if (!strchr((char *) val, ':'))
in CVS already,

Ah, I checked that yesterday - but I guess the change hadn't filtered through to the anoncvs server.

But I don't think that fix is wholly suitable - what if you or someone else changes the definition of 
xmlChar? Then casting an xmlChar * to a char * will inevitably cause problems further down the line.

  xmlChar is an unsigned char *, whose semantic is a pointer of UTF-8
encoded and 0 terminated characters. Changing this would require reimplementing
most of libxml2.

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]