mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-22 13:29:21 +02:00
* patch from Giulio Bernardi to fix the generic AnsiStrIComp,
AnsiStrLComp and AnsiStrLIComp (mantis #11235): * fixed wrong equality result in case one of the strings was shorter than the other but matched the start * AnsiStrLComp and AnsiStrLIComp should ignore embedded #0 characters git-svn-id: trunk@10846 -
This commit is contained in:
parent
545e44ff11
commit
2067da9a62
@ -339,7 +339,12 @@ begin
|
||||
Result:=Ord(LowerCaseTable[Ord(S1[0])])-Ord(LowerCaseTable[Ord(S2[0])]); //!! Must be replaced by ansi characters !!
|
||||
Inc(S1);
|
||||
Inc(S2);
|
||||
Until (Result<>0) or ((S1[0]=#0) or (S2[0]=#0))
|
||||
Until (Result<>0) or ((S1[0]=#0) or (S2[0]=#0));
|
||||
if (Result=0) and (s1[0]<>s2[0]) then //length(s1)<>length(s2)
|
||||
if s1[0]=#0 then
|
||||
Result:=-1 //s1 shorter than s2
|
||||
else
|
||||
Result:=1; //s1 longer than s2
|
||||
end;
|
||||
|
||||
|
||||
@ -367,7 +372,7 @@ begin
|
||||
Inc(S1);
|
||||
Inc(S2);
|
||||
Inc(I);
|
||||
Until (Result<>0) or ((S1[0]=#0) or (S2[0]=#0)) or (I=MaxLen)
|
||||
Until (Result<>0) or (I=MaxLen)
|
||||
end;
|
||||
|
||||
|
||||
@ -395,7 +400,7 @@ begin
|
||||
Inc(S1);
|
||||
Inc(S2);
|
||||
Inc(I);
|
||||
Until (Result<>0) or ((S1[0]=#0) or (S2[0]=#0)) or (I=MaxLen)
|
||||
Until (Result<>0) or (I=MaxLen)
|
||||
end;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user