www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000030

When Created: 10/19/1995 12:12:18
Against DJGPP version: 2.00.beta3
By whom: eliz@is.elta.co.il
Abstract: stricmp() and strnicmp() always return positive results
The source code for those two functions casts the pointer to
`const unsigned char' before subtracting.  This causes the subtraction to be
done as unsigned, which always returns a positive result.  Thus, if a negative
result should have been returned, like in stricmp("A", "b"), a large positive
result is returned instead.

Solution added: 10/19/1995 12:13:44
By whom: eliz@is.elta.co.il
Cast the derefrenced pointers to an int before the subtraction.

Fixed in version 2.00.beta4 on 11/12/1995 18:46:31
By whom: dj@delorie.com

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010