From 47f152690205ca633ac958c2254d144df594f97c Mon Sep 17 00:00:00 2001 From: mattias Date: Fri, 28 Sep 2007 23:11:44 +0000 Subject: [PATCH] codetools: fixed searching in directory cache git-svn-id: trunk@12226 - --- components/codetools/directorycacher.pas | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/codetools/directorycacher.pas b/components/codetools/directorycacher.pas index b6016bfb0e..e92af3133e 100644 --- a/components/codetools/directorycacher.pas +++ b/components/codetools/directorycacher.pas @@ -674,7 +674,7 @@ begin while r>=l do begin m:=(l+r) shr 1; CurFilename:=@FListing.Names[FListing.NameStarts[m]]; - cmp:=ComparePCharFirstCaseInsThenCase(PChar(Pointer(UnitName)),CurFilename); + cmp:=stricomp(PChar(Pointer(UnitName)),CurFilename); if cmp>0 then l:=m+1 else if cmp<0 then @@ -683,9 +683,17 @@ begin break; end; // now all files above m are higher than the Unitname - // -> check that m is equal or above + // -> check that m is equal or above = find lowest if (Cmp>0) then - inc(m); + inc(m) + else if (Cmp=0) then begin + while (m>0) do begin + CurFilename:=@FListing.Names[FListing.NameStarts[m-1]]; + cmp:=stricomp(PChar(Pointer(UnitName)),CurFilename); + if cmp<>0 then break; + end; + end; + // now all files below m are lower than the Unitname // -> now find a filename with correct case and extension while m