Browse Source

* Record and reuse start position after checkcontents (Ondrey Pokorny, bug ID #29985)

git-svn-id: trunk@33464 -
michael 9 years ago
parent
commit
12f11284bf
1 changed files with 4 additions and 1 deletions
  1. 4 1
      packages/fcl-image/src/fpimage.inc

+ 4 - 1
packages/fcl-image/src/fpimage.inc

@@ -123,7 +123,9 @@ var r : integer;
     reader : TFPCustomImageReader;
     msg : string;
     d : TIHData;
+    startPos: Int64;
 begin
+  startPos := str.Position;
   with ImageHandlers do
     try
       r := count-1;
@@ -139,6 +141,7 @@ begin
             try
               if CheckContents (str) then
                 try
+                  str.Position := startPos;
                   FStream := str;
                   FImage := self;
                   InternalRead (str, self);
@@ -149,7 +152,7 @@ begin
                 end;
             finally
               Free;
-              str.seek (soFromBeginning, 0);
+              str.Position := startPos;
             end;
           end;
         dec (r);