Opened 17 years ago

Last modified 17 years ago

#348 closed defect

Various bugs in string comparison functions — at Version 1

Reported by: bennylp Owned by: bennylp
Priority: normal Milestone: release-0.8.0
Component: pjlib Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported:

Description (last modified by bennylp)

Bug in pj_strcmp2() will cause pj_strcmp2("1", "12") to return equal.

Checking other string functions reveals that some string comparison functions are not exactly compliant with ANSI. For example, given:

  char *s1 = "2";
  char *s2 = "11";

With ANSI, strcmp(s1, s2) will return 1, while with pj_strcmp(s1, s2) will return -1.

The reason why the result was different was because string comparison in PJLIB was too optimized for speed, so it only cares about the fact that the string was different.

Change History (1)

comment:1 Changed 17 years ago by bennylp

  • Description modified (diff)
Note: See TracTickets for help on using tickets.