Opened 17 years ago

Closed 17 years ago

#348 closed defect (fixed)

Various bugs in string comparison functions

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 (2)

comment:1 Changed 17 years ago by bennylp

  • Description modified (diff)

comment:2 Changed 17 years ago by bennylp

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in r1397:

  • string comparisons now compliant with the ANSI behavior

Thanks Cool_Zer0 for pointing out the bug.

Note: See TracTickets for help on using tickets.