On Mon, 08 Oct 2007 23:07:19 +0200
Tobias Giesen <[EMAIL PROTECTED]> wrote:

> Hello,
> 
> I would like to submit the attached patch. This reinstates my original
> fix, with some additional comments and applying the fix in another
> location in the same source file.
> 
> I have still been having heavy problems with files not being found by
> CodeTools. THIS FIXES THE PROBLEMS. This is not a shot in the dark.
> This is a well thought through and tested patch.
> 
> The reason for the failures of the old version is that the binary
> searches in this unit were using a different comparison function from
> the one that the list of files was originally sorted with.
> 
> Sorting a list with one comparison function, then doing a binary
> search with a different one, can cause the binary search to fail.
> 
> On some systems, there may be fewer problems than on mine because the
> two different comparison functions may happen to use the same order of
> characters.
> 
> On Mac OS X, the binary search failed when filenames with underscores
> were used. Some comparison functions sort the underscore _ before the
> letters, while other comparison functions sort the underscore after
> the letters.

Your patch might work for you, but it introduces a new bug.
For example:

function TCTDirectoryCache.FindFile(const ShortFilename: string;
  const FileCase: TCTSearchFileCase): string;

If FileCase=ctsfcAllCase then it should search case insensitive.
If ShortFilename='bogus' and the list contains a 'BOGUS' then
ComparePCharFirstCaseInsThenCase will not return 0, so the file is not
found with your patch.

I think, the real bug is using the strlicomp function. We must use a
function, that is compatible to the case
insensitive check of ComparePCharFirstCaseInsThenCase.
I replaced them.

Can you give me a directory listing (not content, just a 'ls -1'), so I
can test with your case?


Mattias

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to