Browse Source

* Implement InternalCheck (By Ondrey Pokorny, Bug ID #29985)

git-svn-id: trunk@33465 -
michael 9 years ago
parent
commit
1ef0ce2d92
1 changed files with 4 additions and 4 deletions
  1. 4 4
      packages/fcl-image/src/fpreadjpeg.pas

+ 4 - 4
packages/fcl-image/src/fpreadjpeg.pas

@@ -451,11 +451,11 @@ begin
 end;
 
 function TFPReaderJPEG.InternalCheck(Str: TStream): boolean;
+var
+  Buf: array[0..1] of Byte = (0, 0);
 begin
-  // ToDo: read header and check
-  Result:=false;
-  if Str=nil then exit;
-  Result:=true;
+  if Str=nil then exit(false);
+  Result := (Str.Read(Buf, 2)=2) and (Buf[0]=$FF) and (Buf[1]=$D8); // byte sequence FFD8 = start of image
 end;
 
 constructor TFPReaderJPEG.Create;