mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-23 20:51:14 +00:00
COMMON: Use ScopedPtr<> to simplify resource management.
This commit is contained in:
parent
17044f0784
commit
b3997f0562
@ -24,6 +24,7 @@
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
|
||||
#include "common/zlib.h"
|
||||
#include "common/ptr.h"
|
||||
#include "common/util.h"
|
||||
#include "common/stream.h"
|
||||
|
||||
@ -61,7 +62,7 @@ protected:
|
||||
|
||||
byte _buf[BUFSIZE];
|
||||
|
||||
Common::SeekableReadStream *_wrapped;
|
||||
ScopedPtr<SeekableReadStream> _wrapped;
|
||||
z_stream _stream;
|
||||
int _zlibErr;
|
||||
uint32 _pos;
|
||||
@ -107,7 +108,6 @@ public:
|
||||
|
||||
~GZipReadStream() {
|
||||
inflateEnd(&_stream);
|
||||
delete _wrapped;
|
||||
}
|
||||
|
||||
bool err() const { return (_zlibErr != Z_OK) && (_zlibErr != Z_STREAM_END); }
|
||||
@ -204,7 +204,7 @@ protected:
|
||||
};
|
||||
|
||||
byte _buf[BUFSIZE];
|
||||
Common::WriteStream *_wrapped;
|
||||
ScopedPtr<WriteStream> _wrapped;
|
||||
z_stream _stream;
|
||||
int _zlibErr;
|
||||
|
||||
@ -248,7 +248,6 @@ public:
|
||||
~GZipWriteStream() {
|
||||
finalize();
|
||||
deflateEnd(&_stream);
|
||||
delete _wrapped;
|
||||
}
|
||||
|
||||
bool err() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user