mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-05 01:39:33 +01:00
codetools: directory cacher: fix compare unit and file
git-svn-id: trunk@32152 -
This commit is contained in:
parent
bb8ada822a
commit
92cd19f574
@ -366,6 +366,7 @@ function ComparePCharUnitNameWithFilename(UnitNameP, FilenameP: Pointer): intege
|
|||||||
var
|
var
|
||||||
AUnitName: PChar absolute UnitNameP;
|
AUnitName: PChar absolute UnitNameP;
|
||||||
Filename: PChar absolute FilenameP;
|
Filename: PChar absolute FilenameP;
|
||||||
|
ExtStart: PChar;
|
||||||
begin
|
begin
|
||||||
while (FPUpChars[AUnitName^]=FPUpChars[Filename^]) and (AUnitName^<>#0) do begin
|
while (FPUpChars[AUnitName^]=FPUpChars[Filename^]) and (AUnitName^<>#0) do begin
|
||||||
inc(AUnitName);
|
inc(AUnitName);
|
||||||
@ -376,19 +377,17 @@ begin
|
|||||||
if (Filename^='.') then begin
|
if (Filename^='.') then begin
|
||||||
// check extension
|
// check extension
|
||||||
inc(Filename);
|
inc(Filename);
|
||||||
|
ExtStart:=Filename;
|
||||||
while not (Filename^ in ['.',#0]) do inc(Filename);
|
while not (Filename^ in ['.',#0]) do inc(Filename);
|
||||||
if Filename^='.' then begin
|
if Filename^='.' then begin
|
||||||
// multi dots in filename
|
// multi dots in filename
|
||||||
Result:=ord(#0)-ord('.');
|
Result:=ord(#0)-ord(FPUpChars[ExtStart^]);
|
||||||
end else begin
|
end else begin
|
||||||
// rest is the extension => fits
|
// rest is the extension => fits
|
||||||
Result:=0;
|
Result:=0;
|
||||||
end;
|
end;
|
||||||
end else if Filename^=#0 then begin
|
|
||||||
// file name has no extension => return not 0
|
|
||||||
Result:=ord('.');
|
|
||||||
end else
|
end else
|
||||||
Result:=ord(#0)-ord(FPUpChars[Filename^]);
|
Result:=ord('.')-ord(FPUpChars[Filename^]);
|
||||||
end else
|
end else
|
||||||
Result:=ord(FPUpChars[AUnitName^])-ord(FPUpChars[Filename^]);
|
Result:=ord(FPUpChars[AUnitName^])-ord(FPUpChars[Filename^]);
|
||||||
end;
|
end;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user