diff options
author | Henry Wilson <m3henry@googlemail.com> | 2019-03-03 22:25:13 +0000 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2019-03-24 16:10:04 +0100 |
commit | af7d9020a15c1b1a14b3981ac73c70d2e58cc877 (patch) | |
tree | 1dcff3e01382ea3a0a4733a4637659dbbfd4bad5 /src/saveload | |
parent | 31260e66252fb4d0dda6f992520faeeb96929cfe (diff) | |
download | openttd-af7d9020a15c1b1a14b3981ac73c70d2e58cc877.tar.xz |
Codechange: Use override specifer for overriding member declarations
This is a C++11 feature that allows the compiler to check that a virtual
member declaration overrides a base-class member with the same signature.
Also src/blitter/32bpp_anim_sse4.hpp +38 is no longer erroneously marked
as virtual despite being a template.
Diffstat (limited to 'src/saveload')
-rw-r--r-- | src/saveload/saveload.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp index cd30ed859..f066d014d 100644 --- a/src/saveload/saveload.cpp +++ b/src/saveload/saveload.cpp @@ -1844,7 +1844,7 @@ struct FileReader : LoadFilter { _sl.sf = NULL; } - /* virtual */ size_t Read(byte *buf, size_t size) + size_t Read(byte *buf, size_t size) override { /* We're in the process of shutting down, i.e. in "failure" mode. */ if (this->file == NULL) return 0; @@ -1852,7 +1852,7 @@ struct FileReader : LoadFilter { return fread(buf, 1, size, this->file); } - /* virtual */ void Reset() + void Reset() override { clearerr(this->file); if (fseek(this->file, this->begin, SEEK_SET)) { @@ -1882,7 +1882,7 @@ struct FileWriter : SaveFilter { _sl.sf = NULL; } - /* virtual */ void Write(byte *buf, size_t size) + void Write(byte *buf, size_t size) override { /* We're in the process of shutting down, i.e. in "failure" mode. */ if (this->file == NULL) return; @@ -1890,7 +1890,7 @@ struct FileWriter : SaveFilter { if (fwrite(buf, 1, size, this->file) != size) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE); } - /* virtual */ void Finish() + void Finish() override { if (this->file != NULL) fclose(this->file); this->file = NULL; @@ -1918,7 +1918,7 @@ struct LZOLoadFilter : LoadFilter { if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize decompressor"); } - /* virtual */ size_t Read(byte *buf, size_t ssize) + size_t Read(byte *buf, size_t ssize) override { assert(ssize >= LZO_BUFFER_SIZE); @@ -1966,7 +1966,7 @@ struct LZOSaveFilter : SaveFilter { if (lzo_init() != LZO_E_OK) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_INTERNAL_ERROR, "cannot initialize compressor"); } - /* virtual */ void Write(byte *buf, size_t size) + void Write(byte *buf, size_t size) override { const lzo_bytep in = buf; /* Buffer size is from the LZO docs plus the chunk header size. */ @@ -2005,7 +2005,7 @@ struct NoCompLoadFilter : LoadFilter { { } - /* virtual */ size_t Read(byte *buf, size_t size) + size_t Read(byte *buf, size_t size) override { return this->chain->Read(buf, size); } @@ -2022,7 +2022,7 @@ struct NoCompSaveFilter : SaveFilter { { } - /* virtual */ void Write(byte *buf, size_t size) + void Write(byte *buf, size_t size) override { this->chain->Write(buf, size); } @@ -2056,7 +2056,7 @@ struct ZlibLoadFilter : LoadFilter { inflateEnd(&this->z); } - /* virtual */ size_t Read(byte *buf, size_t size) + size_t Read(byte *buf, size_t size) override { this->z.next_out = buf; this->z.avail_out = (uint)size; @@ -2135,12 +2135,12 @@ struct ZlibSaveFilter : SaveFilter { } while (this->z.avail_in || !this->z.avail_out); } - /* virtual */ void Write(byte *buf, size_t size) + void Write(byte *buf, size_t size) override { this->WriteLoop(buf, size, 0); } - /* virtual */ void Finish() + void Finish() override { this->WriteLoop(NULL, 0, Z_FINISH); this->chain->Finish(); @@ -2185,7 +2185,7 @@ struct LZMALoadFilter : LoadFilter { lzma_end(&this->lzma); } - /* virtual */ size_t Read(byte *buf, size_t size) + size_t Read(byte *buf, size_t size) override { this->lzma.next_out = buf; this->lzma.avail_out = size; @@ -2254,12 +2254,12 @@ struct LZMASaveFilter : SaveFilter { } while (this->lzma.avail_in || !this->lzma.avail_out); } - /* virtual */ void Write(byte *buf, size_t size) + void Write(byte *buf, size_t size) override { this->WriteLoop(buf, size, LZMA_RUN); } - /* virtual */ void Finish() + void Finish() override { this->WriteLoop(NULL, 0, LZMA_FINISH); this->chain->Finish(); |