Skip to content
4 changes: 4 additions & 0 deletions src/attributes/ctrlm_attr.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class ctrlm_attr_t {
* ControlMgr Attribute Default Constructor
*/
ctrlm_attr_t(const std::string &name = "Unknown Attribute");
ctrlm_attr_t(const ctrlm_attr_t &) = default;
ctrlm_attr_t(ctrlm_attr_t &&) noexcept = default;
ctrlm_attr_t &operator=(const ctrlm_attr_t &) = default;
ctrlm_attr_t &operator=(ctrlm_attr_t &&) noexcept = default;
/**
* ControlMgr Attribute Destructor
*/
Expand Down
8 changes: 8 additions & 0 deletions src/attributes/ctrlm_attr_general.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ class ctrlm_uint64_attr_t : public ctrlm_attr_t {
* @param value The value stored as a uint64_t for this attribute
*/
ctrlm_uint64_attr_t(uint64_t _value = 0, std::string _name = "");
ctrlm_uint64_attr_t(const ctrlm_uint64_attr_t &) = default;
ctrlm_uint64_attr_t(ctrlm_uint64_attr_t &&) noexcept = default;
ctrlm_uint64_attr_t &operator=(const ctrlm_uint64_attr_t &) = default;
ctrlm_uint64_attr_t &operator=(ctrlm_uint64_attr_t &&) noexcept = default;
/**
* Destructor
*/
Expand Down Expand Up @@ -223,6 +227,10 @@ class ctrlm_ieee_addr_t : public ctrlm_uint64_attr_t {
* @param ieee A uint64_t containing an IEEE address
*/
ctrlm_ieee_addr_t(uint64_t ieee = 0);
ctrlm_ieee_addr_t(const ctrlm_ieee_addr_t &) = default;
ctrlm_ieee_addr_t(ctrlm_ieee_addr_t &&) noexcept = default;
ctrlm_ieee_addr_t &operator=(const ctrlm_ieee_addr_t &) = default;
ctrlm_ieee_addr_t &operator=(ctrlm_ieee_addr_t &&) noexcept = default;
/**
* Destructor
*/
Expand Down
9 changes: 6 additions & 3 deletions src/ctrlm_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,11 @@ void ctrlm_obj_controller_t::ota_failure_cnt_session_clear() {
}

bool ctrlm_obj_controller_t::retry_ota() const {
bool retry = ota_failure_cnt_session_ < OTA_MAX_RETRIES;
XLOGD_WARN("ota_failure_cnt_session_ = <%d>, retry OTA = <%s>",ota_failure_cnt_session_,retry ? "TRUE":"FALSE");
bool retry = false;
#if OTA_MAX_RETRIES > 0
retry = ota_failure_cnt_session_ < OTA_MAX_RETRIES;
#endif
XLOGD_WARN("ota_failure_cnt_session_ = <%d>, retry OTA = <%s>", ota_failure_cnt_session_, retry ? "TRUE" : "FALSE");
return retry;
}

Expand Down Expand Up @@ -337,7 +340,7 @@ void ctrlm_obj_controller_t::set_upgrade_progress(uint8_t progress) {
ctrlm_rcu_upgrade_state_t previous_state = get_upgrade_state();
ctrlm_rcu_upgrade_state_t new_state = CTRLM_RCU_UPGRADE_STATE_INVALID;

if (upgrade_progress_ >= 0 && upgrade_progress_ < 100) { // pending
if (upgrade_progress_ < 100) { // pending
new_state = CTRLM_RCU_UPGRADE_STATE_PENDING;
set_upgrade_error(""); // clear error messaging if pending

Expand Down
3 changes: 2 additions & 1 deletion src/ctrlm_ir_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include "ctrlm_network.h"

#include <fcntl.h>
#include <utility>

#include <libevdev-1.0/libevdev/libevdev.h>

Expand Down Expand Up @@ -144,7 +145,7 @@ bool ctrlm_ir_controller_t::read_config() {
getline( ss, substr, ',' );
if (!substr.empty()) {
XLOGD_DEBUG("Adding IR input device name: <%s>", substr.c_str());
input_device_names_.push_back(substr);
input_device_names_.push_back(std::move(substr));
}
}

Expand Down
20 changes: 12 additions & 8 deletions src/ctrlm_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2318,18 +2318,19 @@ void ctrlm_main_update_export_controller_list() {
}
}
// CUSTOM FORMATTING CODE
if(json_array_size(controller_list) == 0) {
size_t controller_count = json_array_size(controller_list);
if(controller_count == 0) {
XLOGD_INFO("No controller information for XCONF, writing empty file");
}
std::string output = "";

// Work with string now
output += "[\n";
for(unsigned int i = 0; i < json_array_size(controller_list); i++) {
for(size_t i = 0; i < controller_count; i++) {
char *buf = json_dumps(json_array_get(controller_list, i), JSON_PRESERVE_ORDER | JSON_INDENT(0) | JSON_COMPACT);
if(buf) {
output += buf;
if(i != json_array_size(controller_list)-1) {
if(i + 1 < controller_count) {
output += ",";
}
output += "\n";
Expand Down Expand Up @@ -2760,9 +2761,12 @@ gpointer ctrlm_main_thread(gpointer param) {
bool result = false;
ctrlm_main_queue_msg_controller_type_get_t *dqm = (ctrlm_main_queue_msg_controller_type_get_t *) msg;
XLOGD_DEBUG("message type CTRLM_MAIN_QUEUE_MSG_TYPE_CONTROLLER_TYPE_GET");
if(dqm->controller_type) {
*dqm->controller_type = obj_net->ctrlm_controller_type_get(dqm->controller_id);
result = (*dqm->controller_type != CTRLM_RCU_CONTROLLER_TYPE_INVALID ? true : false);
if(dqm->controller_type != NULL) {
*dqm->controller_type = CTRLM_RCU_CONTROLLER_TYPE_INVALID;
if(obj_net != NULL) {
*dqm->controller_type = obj_net->ctrlm_controller_type_get(dqm->controller_id);
result = (*dqm->controller_type != CTRLM_RCU_CONTROLLER_TYPE_INVALID);
}
}
if(dqm->semaphore != NULL && dqm->cmd_result != NULL) {
// Signal the semaphore to indicate that the result is present
Expand Down Expand Up @@ -4527,19 +4531,19 @@ void ctrlm_crash_recovery_check() {
if(!ctrlm_file_delete(g_ctrlm.db_path.c_str(), true)) {
XLOGD_WARN("Failed to remove ctrlm DB.. It is possible it no longer exists");
}
#ifdef CTRLM_NETWORK_HAS_HAL_NVM
// Set recovery mode in rf4ce object
if(invalid_hal_nvm) {
for(auto const &itr : g_ctrlm.networks) {
if(itr.second->type_get() == CTRLM_NETWORK_TYPE_RF4CE) {
itr.second->recovery_set(CTRLM_RECOVERY_TYPE_RESET);
}
}
#ifdef CTRLM_NETWORK_HAS_HAL_NVM
//Clear invalid NVM flag
invalid_hal_nvm = 0;
ctrlm_recovery_property_set(CTRLM_RECOVERY_INVALID_HAL_NVM, &invalid_hal_nvm);
#endif
}
#endif
// Set crash back to 0
crash_count = 0;
ctrlm_recovery_property_set(CTRLM_RECOVERY_CRASH_COUNT, &crash_count);
Expand Down
5 changes: 4 additions & 1 deletion src/ctrlm_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ ctrlm_obj_network_t::~ctrlm_obj_network_t() {
} else {
// Wait for thread to exit
XLOGD_INFO("Waiting for thread to exit");
g_thread_join(thread_id);
// Coverity is likely not modeling the ownership transfer of thread_id. Use an explicitly balanced extra reference so both GLib and Coverity see correct ownership.
GThread *join_thread_id = g_thread_ref(thread_id);
g_thread_join(join_thread_id);
g_thread_unref(thread_id);
XLOGD_INFO("thread exited.");
}
ctrlm_network_term_hal_unref(term_data);
Expand Down
5 changes: 4 additions & 1 deletion src/ctrlm_validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -627,5 +627,8 @@ gboolean ctrlm_validation_ignore_abort(void) {
std::vector<ctrlm_key_code_t> ctrlm_validation_golden_code_get(void) {
std::vector<ctrlm_key_code_t> golden_code;
golden_code.insert(golden_code.end(), &g_ctrlm_validation.golden_code[0], &g_ctrlm_validation.golden_code[CTRLM_RCU_VALIDATION_KEY_QTY]);
return (std::all_of(golden_code.begin(), golden_code.end(), [](int i) { return i == 0; })) ? std::vector<ctrlm_key_code_t>() : golden_code;
if(std::all_of(golden_code.begin(), golden_code.end(), [](int i) { return i == 0; })) {
return {};
}
return golden_code;
}
4 changes: 2 additions & 2 deletions src/ipc/ctrlm_rcp_ipc_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ctrlm_rcp_ipc_controller_status_t : public ctrlm_virtual_json_t
uint8_t battery_level_ = 0;
std::string tv_irdb_code_;
std::string avr_irdb_code_;
uint8_t wakeup_key_code_ = 0;
int wakeup_key_code_ = 0;
ctrlm_rcu_wakeup_config_t wakeup_config_ = CTRLM_RCU_WAKEUP_CONFIG_INVALID;
std::vector<uint16_t> wakeup_custom_list_;
std::string upgrade_session_id_ = "";
Expand Down Expand Up @@ -185,7 +185,7 @@ class ctrlm_rcp_ipc_validation_status_t : public ctrlm_virtual_json_t

class ctrlm_network_all_ipc_result_wrapper_t {
private:
ctrlm_network_id_t network_id_;
ctrlm_network_id_t network_id_ = CTRLM_MAIN_NETWORK_ID_ALL;
std::map<ctrlm_network_id_t, ctrlm_iarm_call_result_t> result_map_;

public:
Expand Down
2 changes: 1 addition & 1 deletion src/irdb/ctrlm_irdb_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class ctrlm_irdb_interface_t {

void *m_irdbPluginHandle;

ctrlm_irdb_mode_t mode;
ctrlm_irdb_mode_t mode = CTRLM_IRDB_MODE_OFFLINE;
bool m_platform_tv;
std::mutex m_mutex;
};
Expand Down
5 changes: 3 additions & 2 deletions src/voice/ctrlm_voice_obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <sstream>
#include <iostream>
#include <iomanip>
#include <utility>
#include <unistd.h>
#include <string.h>
#include <semaphore.h>
Expand Down Expand Up @@ -4093,7 +4094,7 @@ void ctrlm_voice_t::url_hostname_pattern_add(const char *pattern) {
}
} while(1);

this->prefs.server_hosts.push_back(regex);
this->prefs.server_hosts.push_back(std::move(regex));
}

void ctrlm_voice_t::url_hostname_patterns(const std::vector<std::string> &obj_server_hosts) {
Expand All @@ -4105,7 +4106,7 @@ void ctrlm_voice_t::url_hostname_patterns(const std::vector<std::string> &obj_se
}
}

void ctrlm_voice_t::pre_session_terminate(std::function<void(ctrlm_voice_start_audio_params_t *)> cb_start_audio, ctrlm_voice_start_audio_params_t *cb_audio_start_params, ctrlm_voice_session_rsp_confirm_t *cb_confirm, void **cb_confirm_param) {
void ctrlm_voice_t::pre_session_terminate(const std::function<void(ctrlm_voice_start_audio_params_t *)> &cb_start_audio, ctrlm_voice_start_audio_params_t *cb_audio_start_params, ctrlm_voice_session_rsp_confirm_t *cb_confirm, void **cb_confirm_param) {
if (cb_start_audio != nullptr && cb_audio_start_params != nullptr) {
if(cb_confirm != NULL && cb_confirm_param != NULL) {
cb_audio_start_params->m_cb_confirm_voice_obj = ctrlm_voice_session_response_confirm;
Expand Down
2 changes: 1 addition & 1 deletion src/voice/ctrlm_voice_obj.h
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ class ctrlm_voice_t {
void set_audio_mode(ctrlm_voice_audio_settings_t *settings);
void audio_state_set(bool session);
bool vsdk_is_privacy_enabled(void);
void pre_session_terminate(std::function<void(ctrlm_voice_start_audio_params_t *)> cb_start_audio,
void pre_session_terminate(const std::function<void(ctrlm_voice_start_audio_params_t *)> &cb_start_audio,
ctrlm_voice_start_audio_params_t *cb_audio_start_params,
ctrlm_voice_session_rsp_confirm_t *cb_confirm,
void **cb_confirm_param);
Expand Down
Loading