Ticket #348 (closed defect: fixed)
Various bugs in string comparison functions
|Reported by:||bennylp||Owned by:||bennylp|
|Backport to 1.x milestone:||Backported:|
Description (last modified by bennylp) (diff)
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.