From: Tom <rtp...@us...> - 2010-04-27 04:35:27
|
gemrb: Infinity Engine emulator The branch master has been updated via a4ea4949b205c4afe7cc759bae15f8b28897080f (commit) Summary of changes: gemrb/core/ImageMgr.h | 1 - gemrb/core/PalettedImageMgr.h | 1 - gemrb/core/Resource.cpp | 10 ---------- gemrb/core/Resource.h | 2 +- gemrb/core/SoundMgr.h | 1 - gemrb/plugins/ACMReader/ACMReader.cpp | 3 +-- gemrb/plugins/BIKPlayer/BIKPlayer.cpp | 3 +-- gemrb/plugins/BMPImporter/BMPImporter.cpp | 3 +-- gemrb/plugins/MOSImporter/MOSImporter.cpp | 2 -- gemrb/plugins/MVEPlayer/MVEPlayer.cpp | 3 +-- gemrb/plugins/OGGReader/OGGReader.cpp | 3 +-- gemrb/plugins/PLTImporter/PLTImporter.cpp | 3 +-- gemrb/plugins/PNGImporter/PNGImporter.cpp | 3 +-- gemrb/plugins/WAVReader/WAVReader.cpp | 3 +-- 14 files changed, 9 insertions(+), 32 deletions(-) from 75a79c03bab61881da0c17c4d8c3ca39661bc1f1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=a4ea4949b205c4afe7cc759bae15f8b28897080f commit a4ea4949b205c4afe7cc759bae15f8b28897080f Author: Tom Prince <tom...@ua...> Date: Tue Apr 27 00:31:36 2010 -0400 Resource: Resource objects are not reusable, so simplify the code. Signed-off-by: Tom Prince <tom...@ua...> diff --git a/gemrb/core/ImageMgr.h b/gemrb/core/ImageMgr.h index e7830ce..109f97c 100644 --- a/gemrb/core/ImageMgr.h +++ b/gemrb/core/ImageMgr.h @@ -39,7 +39,6 @@ public: public: ImageMgr(void); virtual ~ImageMgr(void); - virtual bool Open(DataStream* stream) = 0; /** Returns a \ref Sprite2D containing the image. */ virtual Sprite2D* GetSprite2D() = 0; virtual Image* GetImage(); diff --git a/gemrb/core/PalettedImageMgr.h b/gemrb/core/PalettedImageMgr.h index 70a788c..e0dc17a 100644 --- a/gemrb/core/PalettedImageMgr.h +++ b/gemrb/core/PalettedImageMgr.h @@ -37,7 +37,6 @@ public: public: PalettedImageMgr(void); virtual ~PalettedImageMgr(void); - virtual bool Open(DataStream* stream) = 0; /** * Returns a @ref{Sprite2D} that has been colored with the given palette. * diff --git a/gemrb/core/Resource.cpp b/gemrb/core/Resource.cpp index 89eba99..e912849 100644 --- a/gemrb/core/Resource.cpp +++ b/gemrb/core/Resource.cpp @@ -33,13 +33,3 @@ Resource::~Resource(void) delete( str ); } } - -bool Resource::Open(DataStream * stream) -{ - if (stream == NULL) - return false; - if (str && str != stream) - delete( str ); - str = stream; - return true; -} diff --git a/gemrb/core/Resource.h b/gemrb/core/Resource.h index 15fff8e..df0499d 100644 --- a/gemrb/core/Resource.h +++ b/gemrb/core/Resource.h @@ -46,7 +46,7 @@ public: * Reads the resource from the given stream. * * This should only be called once for a given resource object. - * @param[in] stream Stream containg the resource + * @param[in] stream Non-NULL Stream containg the resource * @retval true stream contains the given resource. * @retval false stream does not contain valid resource. */ diff --git a/gemrb/core/SoundMgr.h b/gemrb/core/SoundMgr.h index 5dc8dda..68125e2 100644 --- a/gemrb/core/SoundMgr.h +++ b/gemrb/core/SoundMgr.h @@ -34,7 +34,6 @@ public: public: SoundMgr(void); virtual ~SoundMgr(void); - virtual bool Open(DataStream* stream) = 0 ; /** * Read up to cnt samples into memory * diff --git a/gemrb/plugins/ACMReader/ACMReader.cpp b/gemrb/plugins/ACMReader/ACMReader.cpp index 91b5dcc..78e416b 100644 --- a/gemrb/plugins/ACMReader/ACMReader.cpp +++ b/gemrb/plugins/ACMReader/ACMReader.cpp @@ -21,8 +21,7 @@ bool ACMReader::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; + str = stream; Close(); ACM_Header hdr; diff --git a/gemrb/plugins/BIKPlayer/BIKPlayer.cpp b/gemrb/plugins/BIKPlayer/BIKPlayer.cpp index 570aa07..3c7d253 100644 --- a/gemrb/plugins/BIKPlayer/BIKPlayer.cpp +++ b/gemrb/plugins/BIKPlayer/BIKPlayer.cpp @@ -192,8 +192,7 @@ int BIKPlayer::ReadHeader() bool BIKPlayer::Open(DataStream* stream) { validVideo = false; - if (!Resource::Open(stream)) - return false; + str = stream; str->Read( &header.signature, BIK_SIGNATURE_LEN ); if (memcmp( header.signature, BIK_SIGNATURE_DATA, 4 ) == 0) { diff --git a/gemrb/plugins/BMPImporter/BMPImporter.cpp b/gemrb/plugins/BMPImporter/BMPImporter.cpp index b1fba6c..bdba276 100644 --- a/gemrb/plugins/BMPImporter/BMPImporter.cpp +++ b/gemrb/plugins/BMPImporter/BMPImporter.cpp @@ -49,8 +49,7 @@ BMPImporter::~BMPImporter(void) bool BMPImporter::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; + str = stream; //we release the previous pixel data free( pixels ); pixels = NULL; diff --git a/gemrb/plugins/MOSImporter/MOSImporter.cpp b/gemrb/plugins/MOSImporter/MOSImporter.cpp index 3448d01..3191ea7 100644 --- a/gemrb/plugins/MOSImporter/MOSImporter.cpp +++ b/gemrb/plugins/MOSImporter/MOSImporter.cpp @@ -46,8 +46,6 @@ MOSImporter::~MOSImporter(void) bool MOSImporter::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; str = stream; char Signature[8]; str->Read( Signature, 8 ); diff --git a/gemrb/plugins/MVEPlayer/MVEPlayer.cpp b/gemrb/plugins/MVEPlayer/MVEPlayer.cpp index 66a7ab6..95a25b3 100644 --- a/gemrb/plugins/MVEPlayer/MVEPlayer.cpp +++ b/gemrb/plugins/MVEPlayer/MVEPlayer.cpp @@ -53,8 +53,7 @@ MVEPlay::~MVEPlay(void) bool MVEPlay::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; + str = stream; validVideo = false; char Signature[MVE_SIGNATURE_LEN]; diff --git a/gemrb/plugins/OGGReader/OGGReader.cpp b/gemrb/plugins/OGGReader/OGGReader.cpp index 7b9fedb..762ccfe 100644 --- a/gemrb/plugins/OGGReader/OGGReader.cpp +++ b/gemrb/plugins/OGGReader/OGGReader.cpp @@ -67,8 +67,7 @@ static long ovfd_tell(void *datasource) { bool OGGReader::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; + str = stream; Close(); char Signature[4]; diff --git a/gemrb/plugins/PLTImporter/PLTImporter.cpp b/gemrb/plugins/PLTImporter/PLTImporter.cpp index 4297334..93d445e 100644 --- a/gemrb/plugins/PLTImporter/PLTImporter.cpp +++ b/gemrb/plugins/PLTImporter/PLTImporter.cpp @@ -49,8 +49,7 @@ PLTImporter::~PLTImporter(void) bool PLTImporter::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; + str = stream; char Signature[8]; unsigned short unknown[4]; diff --git a/gemrb/plugins/PNGImporter/PNGImporter.cpp b/gemrb/plugins/PNGImporter/PNGImporter.cpp index 98a63ac..d7dc835 100644 --- a/gemrb/plugins/PNGImporter/PNGImporter.cpp +++ b/gemrb/plugins/PNGImporter/PNGImporter.cpp @@ -77,8 +77,7 @@ void PNGImporter::Close() bool PNGImporter::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; + str = stream; Close(); png_byte header[8]; diff --git a/gemrb/plugins/WAVReader/WAVReader.cpp b/gemrb/plugins/WAVReader/WAVReader.cpp index 238d641..9d1f876 100644 --- a/gemrb/plugins/WAVReader/WAVReader.cpp +++ b/gemrb/plugins/WAVReader/WAVReader.cpp @@ -54,8 +54,7 @@ const unsigned char data_4cc[] = { bool RawPCMReader::Open(DataStream* stream) { - if (!Resource::Open(stream)) - return false; + str = stream; samples = str->Size(); str->Seek( 0, GEM_STREAM_START ); ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |