From b31fc25f19270aaeade3a78ed099de24846fe614 Mon Sep 17 00:00:00 2001 From: Jojo-1000 <33495614+Jojo-1000@users.noreply.github.com> Date: Tue, 2 Nov 2021 18:50:10 +0100 Subject: [PATCH] Fix unused variable warnings. --- src/EntertainmentMode.cpp | 13 ++++++++++++- src/Scene.cpp | 2 +- src/SimpleColorHueStrategy.cpp | 2 +- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/EntertainmentMode.cpp b/src/EntertainmentMode.cpp index 0aa89d0..9a1a612 100644 --- a/src/EntertainmentMode.cpp +++ b/src/EntertainmentMode.cpp @@ -29,6 +29,8 @@ #include "mbedtls/ssl.h" #include "mbedtls/timing.h" +#include "hueplusplus/HueExceptionMacro.h" + namespace hueplusplus { constexpr uint8_t HUE_ENTERTAINMENT_HEADER_SIZE = 16; @@ -120,7 +122,16 @@ EntertainmentMode::EntertainmentMode(Bridge& b, Group& g) /*-------------------------------------------------*\ | Seed the Deterministic Random Bit Generator (RNG) | \*-------------------------------------------------*/ - int ret = mbedtls_ctr_drbg_seed(&tls_context->ctr_drbg, mbedtls_entropy_func, &tls_context->entropy, NULL, 0); + if (mbedtls_ctr_drbg_seed(&tls_context->ctr_drbg, mbedtls_entropy_func, &tls_context->entropy, NULL, 0) != 0) + { + mbedtls_entropy_free(&tls_context->entropy); + mbedtls_ctr_drbg_free(&tls_context->ctr_drbg); + mbedtls_x509_crt_free(&tls_context->cacert); + mbedtls_ssl_config_free(&tls_context->conf); + mbedtls_ssl_free(&tls_context->ssl); + mbedtls_net_free(&tls_context->server_fd); + throw HueException(CURRENT_FILE_INFO, "Failed to seed mbedtls RNG"); + } } EntertainmentMode::~EntertainmentMode() diff --git a/src/Scene.cpp b/src/Scene.cpp index a993a40..cef82e3 100644 --- a/src/Scene.cpp +++ b/src/Scene.cpp @@ -369,7 +369,7 @@ CreateScene& CreateScene::setLightIds(const std::vector& ids) CreateScene& CreateScene::setRecycle(bool recycle) { - request["recycle"] = true; + request["recycle"] = recycle; return *this; } diff --git a/src/SimpleColorHueStrategy.cpp b/src/SimpleColorHueStrategy.cpp index 25294f9..8de41ae 100644 --- a/src/SimpleColorHueStrategy.cpp +++ b/src/SimpleColorHueStrategy.cpp @@ -55,7 +55,7 @@ bool SimpleColorHueStrategy::setColorXY(const XYBrightness& xy, uint8_t transiti bool SimpleColorHueStrategy::setColorLoop(bool on, Light& light) const { - return light.transaction().setColorLoop(true).commit(); + return light.transaction().setColorLoop(on).commit(); } bool SimpleColorHueStrategy::alertHueSaturation(const HueSaturation& hueSat, Light& light) const -- libgit2 0.21.4