diff options
author | Christoph Mallon | 2011-08-06 09:00:47 +0200 |
---|---|---|
committer | Christoph Mallon | 2011-08-07 15:19:07 +0200 |
commit | b3997f0562e31f41716ecaff24cc3431925f0029 (patch) | |
tree | 6904c4636a005f8dfe0d6b0acd7d72f2a46bedf8 | |
parent | 17044f0784724e0e6cf79dd947569e307dc70366 (diff) | |
download | scummvm-rg350-b3997f0562e31f41716ecaff24cc3431925f0029.tar.gz scummvm-rg350-b3997f0562e31f41716ecaff24cc3431925f0029.tar.bz2 scummvm-rg350-b3997f0562e31f41716ecaff24cc3431925f0029.zip |
COMMON: Use ScopedPtr<> to simplify resource management.
-rw-r--r-- | common/zlib.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/common/zlib.cpp b/common/zlib.cpp index 2b3750634a..10484300b7 100644 --- a/common/zlib.cpp +++ b/common/zlib.cpp @@ -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 { |