#5 strCaseCmp() gives incorrect results

closed
Steve LoBasso
None
5
2001-02-09
2001-01-25
Steve LoBasso
No

strCaseCmp() will give incorrect results if one string is a chopped version of the other string.
Empty strings will match anything.
Replace strCaseCmp() in menu.c and text.c with the supplied code.

Discussion

  • Steve LoBasso
    Steve LoBasso
    2001-01-25

    None

     
    Attachments
  • Alexander Mai
    Alexander Mai
    2001-01-26

    Simple question:
    why is there a cast like
    toupper((unsigned char)*c1) ?
    toupper() is supposed to take an int, doesn't it?

     
  • Steve LoBasso
    Steve LoBasso
    2001-01-26

    toupper((unsigned char)*c1) is used so char values larger than 127 don't sign extend to negative numbers. On most C compilers char is signed.
    This is important with toupper() since many implementations use a char[256] array for the mapping. A negative index would map outside the array.

     
  • Scott Tringali
    Scott Tringali
    2001-01-30

    • assigned_to: nobody --> slobasso
     
  • Steve LoBasso
    Steve LoBasso
    2001-02-09

    It's in the main codeline now.

     
  • Scott Tringali
    Scott Tringali
    2001-02-09

    • status: open --> closed