diff options
author | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-06-14 20:01:45 +0000 |
---|---|---|
committer | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2011-06-14 20:01:45 +0000 |
commit | a0326cedf437c7385ca1ad7cd836be92ec521665 (patch) | |
tree | 5b37e17e6eaa036c8937b34771ed49af44c017c5 /packages/fcl-res | |
parent | bba0af89770ffd340e5b5671f8a711309630c6da (diff) | |
download | fpc-a0326cedf437c7385ca1ad7cd836be92ec521665.tar.gz |
* Fixed ReadResourceHeader so it no longer uses an exception to report end of resources
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17756 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-res')
-rw-r--r-- | packages/fcl-res/src/resreader.pp | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/packages/fcl-res/src/resreader.pp b/packages/fcl-res/src/resreader.pp index 4e67a0a74d..5d628fc3f7 100644 --- a/packages/fcl-res/src/resreader.pp +++ b/packages/fcl-res/src/resreader.pp @@ -79,12 +79,9 @@ var DataSize : longword; DataOffset : longword; RawData : TResourceDataStream; begin - try - aStream.ReadBuffer(DataSize,4); - except - on e : EReadError do - raise EResourceReaderEOSReachedException.Create(''); - end; + Result:=Nil; + if aStream.Read(DataSize,4)<>4 then + exit; try aStream.ReadBuffer(HeaderSize,4); {$IFDEF ENDIAN_BIG} @@ -194,10 +191,9 @@ var aRes : TAbstractResource; begin if not CheckMagic(aStream) then raise EResourceReaderWrongFormatException.Create(''); - try - while true do - begin - aRes:=ReadResourceHeader(aStream); + Repeat + aRes:=ReadResourceHeader(aStream); + if (aRes<>Nil) then try aResources.Add(aRes); except @@ -207,10 +203,7 @@ begin raise; end; end; - end; - except - on e : EResourceReaderEOSReachedException do ; - end; + Until (aRes=Nil); end; function TResResourceReader.CheckMagic(aStream: TStream): boolean; |