CompareVersionStrings gives wrong result when comparing two identical versions.
Original Reporter info from Mantis: DonAlfredo @DonAlfredo
-
Reporter name: Alfred
Original Reporter info from Mantis: DonAlfredo @DonAlfredo
- Reporter name: Alfred
Description:
CompareVersionStrings from cutils.pas seems to give a wrong result when comparing two identical version strings.
v1:='3.3.1';
v2:='3.3.1';
CompareVersionStrings (v1,v2) should be zero, but produces a 1.
Probable cause:
{ if one of the two is at the end while the other isn't, add a '.0' }
if (i1>length(s1)) and
(i2<=length(s2)) then
s1:=s1+'.0'
else if i2>length(s2) then
s2:=s2+'.0';
Should be:
{ if one of the two is at the end while the other isn't, add a '.0' }
if (i1>length(s1)) and
(i2<=length(s2)) then
s1:=s1+'.0';
if (i2>length(s2)) and
(i1<=length(s1)) then
s2:=s2+'.0';
So, test for extension of s1 and/or s2 is now identical.
Mantis conversion info:
- Mantis ID: 38514
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 48757 (#f333fb08)