From f52a58d9ac946236d28511c59a48f0e2eeaf165e Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 8 Nov 2019 17:41:19 +0100 Subject: [PATCH] - fixed compilation. --- source/common/utility/files.h | 45 ++++++++++++---------- source/common/utility/files_decompress.cpp | 4 +- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/source/common/utility/files.h b/source/common/utility/files.h index d9eb00b1c..a332ea2dd 100644 --- a/source/common/utility/files.h +++ b/source/common/utility/files.h @@ -59,6 +59,8 @@ enum METHOD_TRANSFEROWNER = 0x8000, }; +class FileReader; + class FileReaderInterface { public: @@ -72,27 +74,6 @@ public: long GetLength () const { return Length; } }; -class DecompressorBase : public FileReaderInterface -{ - std::function ErrorCallback = nullptr; -public: - // These do not work but need to be defined to satisfy the FileReaderInterface. - // They will just error out when called. - long Tell() const override; - long Seek(long offset, int origin) override; - char *Gets(char *strbuf, int len) override; - void DecompressionError(const char* error, ...) const; - void SetErrorCallback(const std::function& cb) - { - ErrorCallback = cb; - } - void SetOwnsReader(); - -protected: - FileReader *File = nullptr; - FileReader OwnedFile; -}; - class MemoryReader : public FileReaderInterface { protected: @@ -307,6 +288,28 @@ public: friend class FWadCollection; }; +class DecompressorBase : public FileReaderInterface +{ + std::function ErrorCallback = nullptr; +public: + // These do not work but need to be defined to satisfy the FileReaderInterface. + // They will just error out when called. + long Tell() const override; + long Seek(long offset, int origin) override; + char* Gets(char* strbuf, int len) override; + void DecompressionError(const char* error, ...) const; + void SetErrorCallback(const std::function& cb) + { + ErrorCallback = cb; + } + void SetOwnsReader(); + +protected: + FileReader* File = nullptr; + FileReader OwnedFile; +}; + + diff --git a/source/common/utility/files_decompress.cpp b/source/common/utility/files_decompress.cpp index 7136620e6..3f89c8a4f 100644 --- a/source/common/utility/files_decompress.cpp +++ b/source/common/utility/files_decompress.cpp @@ -568,7 +568,7 @@ class DecompressorLZSS : public DecompressorBase } public: - DecompressorLZSS(FileReader *file, const std::function& cb) : File(file), SawEOF(false) + DecompressorLZSS(FileReader *file, const std::function& cb) : SawEOF(false) { File = file; SetErrorCallback(cb); @@ -782,7 +782,7 @@ void CompressedFileWriter::Close() break; } auto err = deflate (zipstream, Z_FINISH); - done = stream.avail_out != 0 || err == Z_STREAM_END; + done = zipstream->avail_out != 0 || err == Z_STREAM_END; if (err != Z_STREAM_END && err != Z_OK) { break;