Re: [xml] Why the strncasecmp() avoidance?

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Fri Sep 22 2000 - 06:12:44 EDT


On Fri, Sep 22, 2000 at 02:14:32AM -0700, Wayne Davison wrote:
> On Fri, 22 Sep 2000, Daniel Veillard wrote:
> > I see no problem if you provide xmlStrncasecmp(), yes go ahead !
>
> Excellent! I had started working on this earlier today (before running
> off to play some music with my friends), and now I've taken the time to
> finish it up.

   cool, thanks for the patch,

> One of the reasons I decided to dive in was that I noticed that the
> xmlStrcmp() functions had a minor problems: if presented with two zero-
> length strings, the comparison would run past the end of the strings. I
> also noticed that the xmlStrncmp() function didn't do quite the same
> preliminary pointer-equality test as xmlStrcmp().
  
  huh ... right good catch !

> My patch also changes several places in the code to use the new case-
> ignoring string functions. You'll have to check what I've done to see if
> it goes too far (i.e., if XML expects a case-significant string comparison
> in instances where HTML does not) or not far enough. For instance, I did
> change xmlHasProp() and xmlGetProp() to use xmlStrcasecmp(), but I'm not
> sure if that was the right thing to do (or if the code really needs html
> versions of these functions).

  No you should not do this. XML is case sensitive and has to remain so.
I fixed it.
The HTML parser automatically convert names to lower case when reading them.
The use in xmlNodeGetBase() is okay but should not be needed for this
reason.

> Also, I added an include of tree.h to nanohttp.c just to get the BAD_CAST
> define. That seems like overkill to me, but I think that is what's
> currently required.

  I had to change that. I included parser.h instead, otherwise
xmlStrcasecmp() is just not defined in nanohttp.c

  I will commit this to the CVS bases soon,

    thanks again,

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | Today's Bookmarks :
Tel : +33 476 615 257  | 655, avenue de l'Europe | Linux XML libxml WWW
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Gnome rpm2html rpmfind
 http://www.w3.org/People/all#veillard%40w3.org  | RPM badminton Kaffe
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Fri Sep 22 2000 - 09:43:42 EDT