Skip to content

Commit

Permalink
Correctly add override on all methods of *Reader.
Browse files Browse the repository at this point in the history
Adding few `override` only on `readImpl` now trigger warnings
`inconsistent-missing-override`.

Better to correctly add `override` when needed.
  • Loading branch information
mgautierfr committed Jun 17, 2024
1 parent eeb84c4 commit 8f6d1ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/buffer_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ class LIBZIM_PRIVATE_API BufferReader : public Reader {
: source(source) {}
virtual ~BufferReader() {};

zsize_t size() const;
offset_t offset() const;
zsize_t size() const override;
offset_t offset() const override;

const Buffer get_buffer(offset_t offset, zsize_t size) const;
std::unique_ptr<const Reader> sub_reader(offset_t offset, zsize_t size) const;
const Buffer get_buffer(offset_t offset, zsize_t size) const override;
std::unique_ptr<const Reader> sub_reader(offset_t offset, zsize_t size) const override;

private: // functions
void readImpl(char* dest, offset_t offset, zsize_t size) const override;
Expand Down
14 changes: 7 additions & 7 deletions src/file_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ class LIBZIM_PRIVATE_API BaseFileReader : public Reader {
BaseFileReader(offset_t offset, zsize_t size)
: _offset(offset), _size(size) {}
~BaseFileReader() = default;
zsize_t size() const { return _size; };
offset_t offset() const { return _offset; };
zsize_t size() const override { return _size; };
offset_t offset() const override { return _offset; };

virtual const Buffer get_mmap_buffer(offset_t offset,
zsize_t size) const = 0;
const Buffer get_buffer(offset_t offset, zsize_t size) const;
const Buffer get_buffer(offset_t offset, zsize_t size) const override;

protected: // data
offset_t _offset;
Expand All @@ -53,8 +53,8 @@ class LIBZIM_PRIVATE_API FileReader : public BaseFileReader {
FileReader(FileHandle fh, offset_t offset, zsize_t size);
~FileReader() = default;

const Buffer get_mmap_buffer(offset_t offset, zsize_t size) const;
std::unique_ptr<const Reader> sub_reader(offset_t offset, zsize_t size) const;
const Buffer get_mmap_buffer(offset_t offset, zsize_t size) const override;
std::unique_ptr<const Reader> sub_reader(offset_t offset, zsize_t size) const override;

private: // functions
char readImpl(offset_t offset) const override;
Expand All @@ -72,8 +72,8 @@ class LIBZIM_PRIVATE_API MultiPartFileReader : public BaseFileReader {
explicit MultiPartFileReader(std::shared_ptr<const FileCompound> source);
~MultiPartFileReader() {};

const Buffer get_mmap_buffer(offset_t offset, zsize_t size) const;
std::unique_ptr<const Reader> sub_reader(offset_t offset, zsize_t size) const;
const Buffer get_mmap_buffer(offset_t offset, zsize_t size) const override;
std::unique_ptr<const Reader> sub_reader(offset_t offset, zsize_t size) const override;

private: // functions
char readImpl(offset_t offset) const override;
Expand Down

0 comments on commit 8f6d1ca

Please sign in to comment.