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)
:BufferedSocket(_fd.Release(), _loop),
httpd(_httpd),
state(REQUEST),
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)
metadata_supported(_metadata_supported)
{
}

View File

@ -55,7 +55,7 @@ class HttpdClient final
/** sending the HTTP response */
RESPONSE,
} state;
} state = REQUEST;
/**
* 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.
*/
size_t queue_size;
size_t queue_size = 0;
/**
* The #page which is currently being sent to the client.
@ -81,12 +81,12 @@ class HttpdClient final
/**
* Is this a HEAD request?
*/
bool head_method;
bool head_method = false;
/**
* If DLNA streaming was an option.
*/
bool dlna_streaming_requested;
bool dlna_streaming_requested = false;
/* ICY */
@ -99,17 +99,17 @@ class HttpdClient final
/**
* If we should sent icy metadata.
*/
bool metadata_requested;
bool metadata_requested = false;
/**
* 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
*/
unsigned metaint;
unsigned metaint = 8192; /*TODO: just a std value */
/**
* 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.
*/
size_t metadata_current_position;
size_t metadata_current_position = 0;
/**
* The amount of streaming data sent to the client
* since the last icy information was sent.
*/
unsigned metadata_fill;
unsigned metadata_fill = 0;
public:
/**

View File

@ -61,7 +61,7 @@ class HttpdOutput final : AudioOutput, ServerSocket, DeferredMonitor {
* The configured encoder plugin.
*/
PreparedEncoder *prepared_encoder = nullptr;
Encoder *encoder;
Encoder *encoder = nullptr;
/**
* 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
* buffer underruns in the client.
*/
size_t unflushed_input;
size_t unflushed_input = 0;
public:
/**

View File

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