output/httpd: use C++11 initializers

This commit is contained in:
Max Kellermann 2017-11-10 21:15:57 +01:00
parent ec20784046
commit b83fbad6a1
4 changed files with 13 additions and 23 deletions

View File

@ -191,15 +191,7 @@ HttpdClient::HttpdClient(HttpdOutput &_httpd, UniqueSocketDescriptor _fd,
bool _metadata_supported) bool _metadata_supported)
:BufferedSocket(_fd.Release(), _loop), :BufferedSocket(_fd.Release(), _loop),
httpd(_httpd), httpd(_httpd),
state(REQUEST), metadata_supported(_metadata_supported)
queue_size(0),
head_method(false),
dlna_streaming_requested(false),
metadata_supported(_metadata_supported),
metadata_requested(false), metadata_sent(true),
metaint(8192), /*TODO: just a std value */
metadata(nullptr),
metadata_current_position(0), metadata_fill(0)
{ {
} }

View File

@ -55,7 +55,7 @@ class HttpdClient final
/** sending the HTTP response */ /** sending the HTTP response */
RESPONSE, RESPONSE,
} state; } state = REQUEST;
/** /**
* A queue of #Page objects to be sent to the client. * A queue of #Page objects to be sent to the client.
@ -65,7 +65,7 @@ class HttpdClient final
/** /**
* The sum of all page sizes in #pages. * The sum of all page sizes in #pages.
*/ */
size_t queue_size; size_t queue_size = 0;
/** /**
* The #page which is currently being sent to the client. * The #page which is currently being sent to the client.
@ -81,12 +81,12 @@ class HttpdClient final
/** /**
* Is this a HEAD request? * Is this a HEAD request?
*/ */
bool head_method; bool head_method = false;
/** /**
* If DLNA streaming was an option. * If DLNA streaming was an option.
*/ */
bool dlna_streaming_requested; bool dlna_streaming_requested = false;
/* ICY */ /* ICY */
@ -99,17 +99,17 @@ class HttpdClient final
/** /**
* If we should sent icy metadata. * If we should sent icy metadata.
*/ */
bool metadata_requested; bool metadata_requested = false;
/** /**
* If the current metadata was already sent to the client. * If the current metadata was already sent to the client.
*/ */
bool metadata_sent; bool metadata_sent = false;
/** /**
* The amount of streaming data between each metadata block * The amount of streaming data between each metadata block
*/ */
unsigned metaint; unsigned metaint = 8192; /*TODO: just a std value */
/** /**
* The metadata as #Page which is currently being sent to the client. * The metadata as #Page which is currently being sent to the client.
@ -119,13 +119,13 @@ class HttpdClient final
/* /*
* The amount of bytes which were already sent from the metadata. * The amount of bytes which were already sent from the metadata.
*/ */
size_t metadata_current_position; size_t metadata_current_position = 0;
/** /**
* The amount of streaming data sent to the client * The amount of streaming data sent to the client
* since the last icy information was sent. * since the last icy information was sent.
*/ */
unsigned metadata_fill; unsigned metadata_fill = 0;
public: public:
/** /**

View File

@ -61,7 +61,7 @@ class HttpdOutput final : AudioOutput, ServerSocket, DeferredMonitor {
* The configured encoder plugin. * The configured encoder plugin.
*/ */
PreparedEncoder *prepared_encoder = nullptr; PreparedEncoder *prepared_encoder = nullptr;
Encoder *encoder; Encoder *encoder = nullptr;
/** /**
* Number of bytes which were fed into the encoder, without * Number of bytes which were fed into the encoder, without
@ -69,7 +69,7 @@ class HttpdOutput final : AudioOutput, ServerSocket, DeferredMonitor {
* whether MPD should manually flush the encoder, to avoid * whether MPD should manually flush the encoder, to avoid
* buffer underruns in the client. * buffer underruns in the client.
*/ */
size_t unflushed_input; size_t unflushed_input = 0;
public: public:
/** /**

View File

@ -51,9 +51,7 @@ const Domain httpd_output_domain("httpd_output");
inline inline
HttpdOutput::HttpdOutput(EventLoop &_loop, const ConfigBlock &block) HttpdOutput::HttpdOutput(EventLoop &_loop, const ConfigBlock &block)
:AudioOutput(FLAG_ENABLE_DISABLE|FLAG_PAUSE), :AudioOutput(FLAG_ENABLE_DISABLE|FLAG_PAUSE),
ServerSocket(_loop), DeferredMonitor(_loop), ServerSocket(_loop), DeferredMonitor(_loop)
encoder(nullptr), unflushed_input(0),
metadata(nullptr)
{ {
/* read configuration */ /* read configuration */
name = block.GetBlockValue("name", "Set name in config"); name = block.GetBlockValue("name", "Set name in config");