Re: [xml] strchr in xmlschemas.c
- From: Philip Ludlam <nospam philipnet com>
- To: veillard redhat com
- Cc: xml gnome org
- Subject: Re: [xml] strchr in xmlschemas.c
- Date: Mon, 5 Apr 2004 11:40:34 +0100
From: Daniel Veillard
Date: Mon, 5 Apr 2004 05:58:50 -0400
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.
I'm not suggesting that, just pointing out that someone may want to do that some point in the future.
What I'm suggesting is calling xmlStrchr instead of strchr which I fell is more appropriate.
If it's not more appropriate then why is xmlStrchr defined and used through out the source code if strchr (
(char *) ... will do instead?
Yours,
Phil L.
--
http://www.philipnet.com | http://director.sourceforge.net
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]