From 8031cd1b4044823fb243b7ba2b2785de2a877fad Mon Sep 17 00:00:00 2001 From: Jonathan Vander Mey Date: Sat, 12 Jun 2021 19:04:13 -0400 Subject: [PATCH] Inititialize members in class declaration Also added initializers for previously unintialized members. --- src/components/ble/MusicService.cpp | 10 ---------- src/components/ble/MusicService.h | 24 ++++++++++++------------ 2 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/components/ble/MusicService.cpp b/src/components/ble/MusicService.cpp index 4d7e950f..74fe9522 100644 --- a/src/components/ble/MusicService.cpp +++ b/src/components/ble/MusicService.cpp @@ -111,16 +111,6 @@ Pinetime::Controllers::MusicService::MusicService(Pinetime::System::SystemTask& serviceDefinition[0] = { .type = BLE_GATT_SVC_TYPE_PRIMARY, .uuid = &msUuid.u, .characteristics = characteristicDefinition}; serviceDefinition[1] = {0}; - - artistName = "Waiting for"; - albumName = ""; - trackName = "track information.."; - playing = false; - repeat = false; - shuffle = false; - playbackSpeed = 1.0f; - trackProgress = 0; - trackLength = 0; } void Pinetime::Controllers::MusicService::Init() { diff --git a/src/components/ble/MusicService.h b/src/components/ble/MusicService.h index a611c51d..1ad9a420 100644 --- a/src/components/ble/MusicService.h +++ b/src/components/ble/MusicService.h @@ -69,23 +69,23 @@ namespace Pinetime { struct ble_gatt_chr_def characteristicDefinition[14]; struct ble_gatt_svc_def serviceDefinition[2]; - uint16_t eventHandle; + uint16_t eventHandle {}; - std::string artistName; - std::string albumName; - std::string trackName; + std::string artistName {"Waiting for"}; + std::string albumName {}; + std::string trackName {"track information.."}; - bool playing; + bool playing {false}; - int trackProgress; - int trackLength; - int trackNumber; - int tracksTotal; + int trackProgress {0}; + int trackLength {0}; + int trackNumber {}; + int tracksTotal {}; - float playbackSpeed; + float playbackSpeed {1.0f}; - bool repeat; - bool shuffle; + bool repeat {false}; + bool shuffle {false}; Pinetime::System::SystemTask& m_system; };