From 8aae9766e55df7a8ead7e20e473b7d8f6f610810 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2017 10:37:55 +0100 Subject: [PATCH] fs/io/*: make constructors "explicit" --- src/fs/io/AutoGunzipReader.hxx | 2 +- src/fs/io/BufferedOutputStream.hxx | 2 +- src/fs/io/BufferedReader.hxx | 2 +- src/fs/io/FileOutputStream.hxx | 2 +- src/fs/io/FileReader.hxx | 2 +- src/fs/io/GunzipReader.hxx | 2 +- src/fs/io/GzipOutputStream.hxx | 2 +- src/fs/io/PeekReader.hxx | 2 +- src/fs/io/StdioOutputStream.hxx | 2 +- src/fs/io/TextFile.hxx | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fs/io/AutoGunzipReader.hxx b/src/fs/io/AutoGunzipReader.hxx index 472bdfba9..1e9705731 100644 --- a/src/fs/io/AutoGunzipReader.hxx +++ b/src/fs/io/AutoGunzipReader.hxx @@ -36,7 +36,7 @@ class AutoGunzipReader final : public Reader { GunzipReader *gunzip = nullptr; public: - AutoGunzipReader(Reader &_next) + explicit AutoGunzipReader(Reader &_next) :peek(_next) {} ~AutoGunzipReader(); diff --git a/src/fs/io/BufferedOutputStream.hxx b/src/fs/io/BufferedOutputStream.hxx index b129b41b3..7bdc15b20 100644 --- a/src/fs/io/BufferedOutputStream.hxx +++ b/src/fs/io/BufferedOutputStream.hxx @@ -44,7 +44,7 @@ class BufferedOutputStream { DynamicFifoBuffer buffer; public: - BufferedOutputStream(OutputStream &_os) + explicit BufferedOutputStream(OutputStream &_os) :os(_os), buffer(32768) {} void Write(const void *data, size_t size); diff --git a/src/fs/io/BufferedReader.hxx b/src/fs/io/BufferedReader.hxx index c36e1a4d2..6495b71ef 100644 --- a/src/fs/io/BufferedReader.hxx +++ b/src/fs/io/BufferedReader.hxx @@ -40,7 +40,7 @@ class BufferedReader { unsigned line_number = 0; public: - BufferedReader(Reader &_reader) + explicit BufferedReader(Reader &_reader) :reader(_reader), buffer(4096) {} /** diff --git a/src/fs/io/FileOutputStream.hxx b/src/fs/io/FileOutputStream.hxx index 1e0fc217e..8b1b30bd7 100644 --- a/src/fs/io/FileOutputStream.hxx +++ b/src/fs/io/FileOutputStream.hxx @@ -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()) diff --git a/src/fs/io/FileReader.hxx b/src/fs/io/FileReader.hxx index 061d9dadd..27a5e451b 100644 --- a/src/fs/io/FileReader.hxx +++ b/src/fs/io/FileReader.hxx @@ -46,7 +46,7 @@ class FileReader final : public Reader { #endif public: - FileReader(Path _path); + explicit FileReader(Path _path); #ifdef WIN32 FileReader(FileReader &&other) diff --git a/src/fs/io/GunzipReader.hxx b/src/fs/io/GunzipReader.hxx index 32258a20e..100d2bc1c 100644 --- a/src/fs/io/GunzipReader.hxx +++ b/src/fs/io/GunzipReader.hxx @@ -43,7 +43,7 @@ public: /** * Construct the filter. */ - GunzipReader(Reader &_next); + explicit GunzipReader(Reader &_next); ~GunzipReader() { inflateEnd(&z); diff --git a/src/fs/io/GzipOutputStream.hxx b/src/fs/io/GzipOutputStream.hxx index aa11a40e1..acfad1544 100644 --- a/src/fs/io/GzipOutputStream.hxx +++ b/src/fs/io/GzipOutputStream.hxx @@ -41,7 +41,7 @@ public: /** * Construct the filter. */ - GzipOutputStream(OutputStream &_next); + explicit GzipOutputStream(OutputStream &_next); ~GzipOutputStream(); /** diff --git a/src/fs/io/PeekReader.hxx b/src/fs/io/PeekReader.hxx index 987186084..367d62f8b 100644 --- a/src/fs/io/PeekReader.hxx +++ b/src/fs/io/PeekReader.hxx @@ -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); diff --git a/src/fs/io/StdioOutputStream.hxx b/src/fs/io/StdioOutputStream.hxx index 71f65ae18..e4fa3d934 100644 --- a/src/fs/io/StdioOutputStream.hxx +++ b/src/fs/io/StdioOutputStream.hxx @@ -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 { diff --git a/src/fs/io/TextFile.hxx b/src/fs/io/TextFile.hxx index b53367e5b..10cc8aabd 100644 --- a/src/fs/io/TextFile.hxx +++ b/src/fs/io/TextFile.hxx @@ -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;