[fpc-devel]TFPReaderXPM

Colin Western mftq75 at dsl.pipex.com
Sun Jan 18 11:57:17 CET 2004


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;






More information about the fpc-devel mailing list