fixed CompareTextIgnoringSpace for space ahead in Txt1

git-svn-id: trunk@8550 -
This commit is contained in:
mattias 2006-01-18 09:43:37 +00:00
parent 56054cce54
commit a0733fde8c
2 changed files with 19 additions and 2 deletions

View File

@ -2109,7 +2109,7 @@ begin
end;
function CompareTextIgnoringSpace(Txt1: PChar; Len1: integer;
Txt2: PChar; Len2: integer; CaseSensitive: boolean): integer;
Txt2: PChar; Len2: integer; CaseSensitive: boolean): integer;
{ Txt1 Txt2 Result
A A 0
A B 1
@ -2123,6 +2123,7 @@ begin
P2:=0;
InIdentifier:=false;
while (P1<Len1) and (P2<Len2) do begin
//DebugLn('CompareTextIgnoringSpace P1=',dbgs(P1),' P2=',dbgs(P2));
if (CaseSensitive and (Txt1[P1]=Txt2[P2]))
or ((not CaseSensitive) and (UpChars[Txt1[P1]]=UpChars[Txt2[P2]])) then
begin
@ -2144,6 +2145,12 @@ begin
repeat
inc(P1);
until (P1>=Len1) or (ord(Txt1[P1])>ord(' '));
if (ord(Txt2[P2])<=ord(' ')) then begin
// ignore/skip spaces in Txt2
repeat
inc(P2);
until (P2>=Len2) or (ord(Txt2[P2])>ord(' '));
end;
end else if (ord(Txt2[P2])<=ord(' ')) then begin
// ignore/skip spaces in Txt2
repeat
@ -3316,7 +3323,7 @@ begin
copy(SearchPath,PathStartPos,PathEndPos-PathStartPos)));
if not FilenameIsAbsolute(CurDir) then
CurDir:=AppendPathDelim(BaseDir)+CurDir;
if not SearchDirectory(AppendPathDelim(CurDir)) then exit;
if not SearchDirectory(CurDir) then exit;
end;
PathStartPos:=PathEndPos;
while (PathStartPos<=length(SearchPath))

View File

@ -115,6 +115,7 @@ procedure DbgOut(const s1,s2,s3,s4: string);
procedure DbgOut(const s1,s2,s3,s4,s5: string);
procedure DbgOut(const s1,s2,s3,s4,s5,s6: string);
function DbgS(const c: char): string;
function DbgS(const c: cardinal): string;
function DbgS(const i: integer): string;
function DbgS(const r: TRect): string;
@ -1158,6 +1159,15 @@ begin
DbgOut(s1+s2+s3+s4+s5+s6);
end;
function DbgS(const c: char): string;
begin
case c of
' '..#126: Result:=c;
else
Result:='#'+IntToStr(ord(c));
end;
end;
function DbgS(const c: cardinal): string;
begin
Result:=IntToStr(c);