Commit 8aae9766 authored by Max Kellermann's avatar Max Kellermann

fs/io/*: make constructors "explicit"

parent 288b98cc
......@@ -36,7 +36,7 @@ class AutoGunzipReader final : public Reader {
GunzipReader *gunzip = nullptr;
public:
AutoGunzipReader(Reader &_next)
explicit AutoGunzipReader(Reader &_next)
:peek(_next) {}
~AutoGunzipReader();
......
......@@ -44,7 +44,7 @@ class BufferedOutputStream {
DynamicFifoBuffer<char> buffer;
public:
BufferedOutputStream(OutputStream &_os)
explicit BufferedOutputStream(OutputStream &_os)
:os(_os), buffer(32768) {}
void Write(const void *data, size_t size);
......
......@@ -40,7 +40,7 @@ class BufferedReader {
unsigned line_number = 0;
public:
BufferedReader(Reader &_reader)
explicit BufferedReader(Reader &_reader)
:reader(_reader), buffer(4096) {}
/**
......
......@@ -88,7 +88,7 @@ private:
Mode mode;
public:
FileOutputStream(Path _path, Mode _mode=Mode::CREATE);
explicit FileOutputStream(Path _path, Mode _mode=Mode::CREATE);
~FileOutputStream() {
if (IsDefined())
......
......@@ -46,7 +46,7 @@ class FileReader final : public Reader {
#endif
public:
FileReader(Path _path);
explicit FileReader(Path _path);
#ifdef WIN32
FileReader(FileReader &&other)
......
......@@ -43,7 +43,7 @@ public:
/**
* Construct the filter.
*/
GunzipReader(Reader &_next);
explicit GunzipReader(Reader &_next);
~GunzipReader() {
inflateEnd(&z);
......
......@@ -41,7 +41,7 @@ public:
/**
* Construct the filter.
*/
GzipOutputStream(OutputStream &_next);
explicit GzipOutputStream(OutputStream &_next);
~GzipOutputStream();
/**
......
......@@ -39,7 +39,7 @@ class PeekReader final : public Reader {
uint8_t buffer[64];
public:
PeekReader(Reader &_next)
explicit PeekReader(Reader &_next)
:next(_next) {}
const void *Peek(size_t size);
......
......@@ -30,7 +30,7 @@ class StdioOutputStream final : public OutputStream {
FILE *const file;
public:
StdioOutputStream(FILE *_file):file(_file) {}
explicit StdioOutputStream(FILE *_file):file(_file) {}
/* virtual methods from class OutputStream */
void Write(const void *data, size_t size) override {
......
......@@ -38,7 +38,7 @@ class TextFile {
BufferedReader *const buffered_reader;
public:
TextFile(Path path_fs);
explicit TextFile(Path path_fs);
TextFile(const TextFile &other) = delete;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment