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 { ...@@ -36,7 +36,7 @@ class AutoGunzipReader final : public Reader {
GunzipReader *gunzip = nullptr; GunzipReader *gunzip = nullptr;
public: public:
AutoGunzipReader(Reader &_next) explicit AutoGunzipReader(Reader &_next)
:peek(_next) {} :peek(_next) {}
~AutoGunzipReader(); ~AutoGunzipReader();
......
...@@ -44,7 +44,7 @@ class BufferedOutputStream { ...@@ -44,7 +44,7 @@ class BufferedOutputStream {
DynamicFifoBuffer<char> buffer; DynamicFifoBuffer<char> buffer;
public: public:
BufferedOutputStream(OutputStream &_os) explicit BufferedOutputStream(OutputStream &_os)
:os(_os), buffer(32768) {} :os(_os), buffer(32768) {}
void Write(const void *data, size_t size); void Write(const void *data, size_t size);
......
...@@ -40,7 +40,7 @@ class BufferedReader { ...@@ -40,7 +40,7 @@ class BufferedReader {
unsigned line_number = 0; unsigned line_number = 0;
public: public:
BufferedReader(Reader &_reader) explicit BufferedReader(Reader &_reader)
:reader(_reader), buffer(4096) {} :reader(_reader), buffer(4096) {}
/** /**
......
...@@ -88,7 +88,7 @@ private: ...@@ -88,7 +88,7 @@ private:
Mode mode; Mode mode;
public: public:
FileOutputStream(Path _path, Mode _mode=Mode::CREATE); explicit FileOutputStream(Path _path, Mode _mode=Mode::CREATE);
~FileOutputStream() { ~FileOutputStream() {
if (IsDefined()) if (IsDefined())
......
...@@ -46,7 +46,7 @@ class FileReader final : public Reader { ...@@ -46,7 +46,7 @@ class FileReader final : public Reader {
#endif #endif
public: public:
FileReader(Path _path); explicit FileReader(Path _path);
#ifdef WIN32 #ifdef WIN32
FileReader(FileReader &&other) FileReader(FileReader &&other)
......
...@@ -43,7 +43,7 @@ public: ...@@ -43,7 +43,7 @@ public:
/** /**
* Construct the filter. * Construct the filter.
*/ */
GunzipReader(Reader &_next); explicit GunzipReader(Reader &_next);
~GunzipReader() { ~GunzipReader() {
inflateEnd(&z); inflateEnd(&z);
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
/** /**
* Construct the filter. * Construct the filter.
*/ */
GzipOutputStream(OutputStream &_next); explicit GzipOutputStream(OutputStream &_next);
~GzipOutputStream(); ~GzipOutputStream();
/** /**
......
...@@ -39,7 +39,7 @@ class PeekReader final : public Reader { ...@@ -39,7 +39,7 @@ class PeekReader final : public Reader {
uint8_t buffer[64]; uint8_t buffer[64];
public: public:
PeekReader(Reader &_next) explicit PeekReader(Reader &_next)
:next(_next) {} :next(_next) {}
const void *Peek(size_t size); const void *Peek(size_t size);
......
...@@ -30,7 +30,7 @@ class StdioOutputStream final : public OutputStream { ...@@ -30,7 +30,7 @@ class StdioOutputStream final : public OutputStream {
FILE *const file; FILE *const file;
public: public:
StdioOutputStream(FILE *_file):file(_file) {} explicit StdioOutputStream(FILE *_file):file(_file) {}
/* virtual methods from class OutputStream */ /* virtual methods from class OutputStream */
void Write(const void *data, size_t size) override { void Write(const void *data, size_t size) override {
......
...@@ -38,7 +38,7 @@ class TextFile { ...@@ -38,7 +38,7 @@ class TextFile {
BufferedReader *const buffered_reader; BufferedReader *const buffered_reader;
public: public:
TextFile(Path path_fs); explicit TextFile(Path path_fs);
TextFile(const TextFile &other) = delete; 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