Skip to content

Commit

Permalink
i#5538 memtrace seek, part 2: Remove redundant "virtual" keywords
Browse files Browse the repository at this point in the history
Cleans up the drmemtrace i/o classes by removing redundant "virtual"
keywords and adding missing "explicit" constructor qualifiers.

Issue: #5538
  • Loading branch information
derekbruening committed Sep 6, 2022
1 parent 6e69f2a commit f28d07b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion clients/drcachesim/common/archive_ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

class archive_ostream_t : public std::ostream {
public:
archive_ostream_t(std::basic_streambuf<char, std::char_traits<char>> *buf)
explicit archive_ostream_t(std::basic_streambuf<char, std::char_traits<char>> *buf)
: std::ostream(buf)
{
}
Expand Down
12 changes: 6 additions & 6 deletions clients/drcachesim/common/gzip_ostream.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* **********************************************************
* Copyright (c) 2018-2020 Google, Inc. All rights reserved.
* Copyright (c) 2018-2022 Google, Inc. All rights reserved.
* **********************************************************/

/*
Expand Down Expand Up @@ -51,7 +51,7 @@
*/
class gzip_streambuf_t : public std::basic_streambuf<char, std::char_traits<char>> {
public:
gzip_streambuf_t(const std::string &path)
explicit gzip_streambuf_t(const std::string &path)
{
file_ = gzopen(path.c_str(), "wb");
if (file_ != nullptr) {
Expand All @@ -60,14 +60,14 @@ class gzip_streambuf_t : public std::basic_streambuf<char, std::char_traits<char
setp(buf_, buf_ + buffer_size_ - 1);
}
}
virtual ~gzip_streambuf_t() override
~gzip_streambuf_t() override
{
sync();
delete[] buf_;
if (file_ != nullptr)
gzclose(file_);
}
virtual int
int
overflow(int extra_char) override
{
if (file_ == nullptr)
Expand All @@ -86,7 +86,7 @@ class gzip_streambuf_t : public std::basic_streambuf<char, std::char_traits<char
setp(buf_, buf_ + buffer_size_ - 1);
return res;
}
virtual int
int
sync() override
{
return overflow(traits_type::eof());
Expand All @@ -106,7 +106,7 @@ class gzip_ostream_t : public std::ostream {
if (!rdbuf())
setstate(std::ios::badbit);
}
virtual ~gzip_ostream_t() override
~gzip_ostream_t() override
{
delete rdbuf();
}
Expand Down
10 changes: 5 additions & 5 deletions clients/drcachesim/common/zipfile_ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
// pptr().
class zipfile_streambuf_t : public std::basic_streambuf<char, std::char_traits<char>> {
public:
zipfile_streambuf_t(const std::string &path)
explicit zipfile_streambuf_t(const std::string &path)
{
zip_ = zipOpen2_64(path.c_str(), APPEND_STATUS_CREATE, nullptr, nullptr);
if (zip_ == nullptr)
Expand All @@ -60,7 +60,7 @@ class zipfile_streambuf_t : public std::basic_streambuf<char, std::char_traits<c
setp(buf_, buf_ + buffer_size_ - 1);
// Caller should invoke open_new_component() for first component.
}
virtual ~zipfile_streambuf_t() override
~zipfile_streambuf_t() override
{
sync();
delete[] buf_;
Expand All @@ -75,7 +75,7 @@ class zipfile_streambuf_t : public std::basic_streambuf<char, std::char_traits<c
#endif
}
}
virtual int
int
overflow(int extra_char) override
{
if (zip_ == nullptr)
Expand All @@ -93,7 +93,7 @@ class zipfile_streambuf_t : public std::basic_streambuf<char, std::char_traits<c
setp(buf_, buf_ + buffer_size_ - 1);
return res;
}
virtual int
int
sync() override
{
return overflow(traits_type::eof());
Expand Down Expand Up @@ -133,7 +133,7 @@ class zipfile_ostream_t : public archive_ostream_t {
if (!rdbuf())
setstate(std::ios::badbit);
}
virtual ~zipfile_ostream_t() override
~zipfile_ostream_t() override
{
delete rdbuf();
}
Expand Down

0 comments on commit f28d07b

Please sign in to comment.