[fpc-devel]TFPReaderXPM

Michael Van Canneyt michael.vancanneyt at wisa.be
Tue Jan 20 09:51:17 CET 2004


On Sun, 18 Jan 2004, Colin Western wrote:

> I have spotted a problem with TFPReaderXPM, in that it uses a case
> insensitive compare on the colour symbols. I think it needs the following:
>
> diff -uNr fpc/fcl/image/fpreadxpm.pp fpc.w/fcl/image/fpreadxpm.pp
> --- fpc/fcl/image/fpreadxpm.pp  2003-08-17 19:33:04.000000000 +0100
> +++ fpc.w/fcl/image/fpreadxpm.pp        2004-01-17 11:54:32.000000000 +0000
> @@ -268,8 +268,12 @@
>         begin
>         code := copy(s, p, cpp);
>         inc(p,cpp);
> -      color := Palette.indexof (code);
> -      img.pixels[r-1,imgindex] := color;
> +      for color := 0 to Palette.Count-1 do
> +        { Can't use indexof, as compare must be case sensitive }
> +        if code = Palette[color] then begin
> +          img.pixels[r-1,imgindex] := color;
> +          Break;
> +        end;
>         end;
>     end;

The XPM reader is scheduled for a rewrite - it's quite slow at the
moment, but I will apply the patch for the time being.

Thanks for reporting this !

Michael.




More information about the fpc-devel mailing list