From 288b98ccbf2046df9ffca43e3d1f6cb21179f350 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 4 Jan 2017 10:37:34 +0100 Subject: [PATCH] fs/io/GunzipReader: use C++11 initializer --- src/fs/io/AutoGunzipReader.hxx | 6 +++--- src/fs/io/BufferedReader.hxx | 7 +++---- src/fs/io/GunzipReader.cxx | 2 +- src/fs/io/GunzipReader.hxx | 2 +- src/fs/io/PeekReader.hxx | 4 ++-- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/fs/io/AutoGunzipReader.hxx b/src/fs/io/AutoGunzipReader.hxx index b0f24509a..472bdfba9 100644 --- a/src/fs/io/AutoGunzipReader.hxx +++ b/src/fs/io/AutoGunzipReader.hxx @@ -31,13 +31,13 @@ class GunzipReader; * #GunzipReader. */ class AutoGunzipReader final : public Reader { - Reader *next; + Reader *next = nullptr; PeekReader peek; - GunzipReader *gunzip; + GunzipReader *gunzip = nullptr; public: AutoGunzipReader(Reader &_next) - :next(nullptr), peek(_next), gunzip(nullptr) {} + :peek(_next) {} ~AutoGunzipReader(); /* virtual methods from class Reader */ diff --git a/src/fs/io/BufferedReader.hxx b/src/fs/io/BufferedReader.hxx index 405f80b91..c36e1a4d2 100644 --- a/src/fs/io/BufferedReader.hxx +++ b/src/fs/io/BufferedReader.hxx @@ -35,14 +35,13 @@ class BufferedReader { DynamicFifoBuffer buffer; - bool eof; + bool eof = false; - unsigned line_number; + unsigned line_number = 0; public: BufferedReader(Reader &_reader) - :reader(_reader), buffer(4096), eof(false), - line_number(0) {} + :reader(_reader), buffer(4096) {} /** * Reset the internal state. Should be called after rewinding diff --git a/src/fs/io/GunzipReader.cxx b/src/fs/io/GunzipReader.cxx index 489a11353..ffad13fd1 100644 --- a/src/fs/io/GunzipReader.cxx +++ b/src/fs/io/GunzipReader.cxx @@ -22,7 +22,7 @@ #include "lib/zlib/Error.hxx" GunzipReader::GunzipReader(Reader &_next) - :next(_next), eof(false) + :next(_next) { z.next_in = nullptr; z.avail_in = 0; diff --git a/src/fs/io/GunzipReader.hxx b/src/fs/io/GunzipReader.hxx index e81220035..32258a20e 100644 --- a/src/fs/io/GunzipReader.hxx +++ b/src/fs/io/GunzipReader.hxx @@ -33,7 +33,7 @@ class GunzipReader final : public Reader { Reader &next; - bool eof; + bool eof = false; z_stream z; diff --git a/src/fs/io/PeekReader.hxx b/src/fs/io/PeekReader.hxx index 90f39ac86..987186084 100644 --- a/src/fs/io/PeekReader.hxx +++ b/src/fs/io/PeekReader.hxx @@ -34,13 +34,13 @@ class PeekReader final : public Reader { Reader &next; - size_t buffer_size, buffer_position; + size_t buffer_size = 0, buffer_position = 0; uint8_t buffer[64]; public: PeekReader(Reader &_next) - :next(_next), buffer_size(0), buffer_position(0) {} + :next(_next) {} const void *Peek(size_t size);