From aa2c557045e2f4addbe173844b5d0452f04c2257 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 28 Apr 2024 14:33:09 -0500 Subject: [PATCH] Fix some warnings --- .../ATC800Controller.cpp | 2 +- .../ATC800Controller.h | 4 +- .../RGBController_AorusATC800.cpp | 2 +- .../GigabyteAorusPCCaseController.cpp | 2 +- .../GigabyteAorusPCCaseController.h | 6 +- .../RGBController_GigabyteAorusPCCase.cpp | 2 +- qt/DetectorTableModel.cpp | 30 ++++---- qt/DeviceView.cpp | 76 +++++++++---------- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp index e07f20b3..3429cb42 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp +++ b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.cpp @@ -73,7 +73,7 @@ void ATC800Controller::SendOk() hid_send_feature_report(dev, usb_buf, sizeof(usb_buf)); } -void ATC800Controller::SendCoolerMode(uint8_t zone, uint8_t mode, mode_config zone_config) +void ATC800Controller::SendCoolerMode(uint8_t zone, uint8_t mode, aorus_atc800_mode_config zone_config) { switch (mode) { diff --git a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h index b18efd11..6caf9475 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h +++ b/Controllers/GigabyteAorusCPUCoolerController/ATC800Controller.h @@ -14,7 +14,7 @@ #pragma once -struct mode_config +struct aorus_atc800_mode_config { RGBColor colors[8]; uint8_t numberOfColors; @@ -71,7 +71,7 @@ public: void SendOneColor(uint8_t color_flag, uint8_t red, uint8_t green, uint8_t blue); void SendMultiColor(uint8_t flag, uint8_t mode, uint8_t red1, uint8_t green1, uint8_t blue1, uint8_t red2, uint8_t green2, uint8_t blue2); void SendOk(); - void SendCoolerMode(uint8_t zone, uint8_t mode, mode_config zone_config); + void SendCoolerMode(uint8_t zone, uint8_t mode, aorus_atc800_mode_config zone_config); private: hid_device* dev; diff --git a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp index 78cdac62..a02251b0 100644 --- a/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp +++ b/Controllers/GigabyteAorusCPUCoolerController/RGBController_AorusATC800.cpp @@ -241,7 +241,7 @@ void RGBController_AorusATC800::DeviceUpdateLEDs() void RGBController_AorusATC800::UpdateZoneLEDs(int zone) { - mode_config zone_config; + aorus_atc800_mode_config zone_config; zone_config.colors[0] = colors[zone]; zone_config.numberOfColors = (uint8_t)modes[active_mode].colors.size(); diff --git a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp index ee9fd886..ef233f9e 100644 --- a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp +++ b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.cpp @@ -61,7 +61,7 @@ void GigabyteAorusPCCaseController::SendOk() hid_send_feature_report(dev, usb_buf, sizeof(usb_buf)); } -void GigabyteAorusPCCaseController::SetMode(uint8_t mode, mode_config zone_config) +void GigabyteAorusPCCaseController::SetMode(uint8_t mode, aorus_pc_case_mode_config zone_config) { switch (mode) { diff --git a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h index bea6f408..22532407 100644 --- a/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h +++ b/Controllers/GigabyteAorusPCCaseController/GigabyteAorusPCCaseController.h @@ -14,7 +14,7 @@ #pragma once -struct mode_config +struct aorus_pc_case_mode_config { RGBColor color; uint8_t speed; @@ -57,9 +57,9 @@ public: void SendMode(uint8_t mode, uint8_t speed, uint8_t brightness); void SendOk(); - void SetMode(uint8_t mode, mode_config zone_config); + void SetMode(uint8_t mode, aorus_pc_case_mode_config zone_config); private: hid_device* dev; std::string location; -}; \ No newline at end of file +}; diff --git a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp index a0875482..578f0e29 100644 --- a/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp +++ b/Controllers/GigabyteAorusPCCaseController/RGBController_GigabyteAorusPCCase.cpp @@ -164,7 +164,7 @@ void RGBController_GigabyteAorusPCCase::UpdateSingleLED(int /*led*/) void RGBController_GigabyteAorusPCCase::DeviceUpdateMode() { - mode_config zone_config; + aorus_pc_case_mode_config zone_config; zone_config.color = 0x000000; zone_config.speed = modes[active_mode].speed; zone_config.brightness = modes[active_mode].brightness; diff --git a/qt/DetectorTableModel.cpp b/qt/DetectorTableModel.cpp index efe4e943..40b16f99 100644 --- a/qt/DetectorTableModel.cpp +++ b/qt/DetectorTableModel.cpp @@ -27,7 +27,7 @@ DetectorTableModel::DetectorTableModel(QObject* parent) : QAbstractTableModel(pa /*-----------------------------------------------------*\ | If settings contains the detectors list, fill in rows | \*-----------------------------------------------------*/ - beginInsertRows(QModelIndex(), 0, detectors.size()); + beginInsertRows(QModelIndex(), 0, (int)detectors.size()); endInsertRows(); } @@ -36,7 +36,7 @@ int DetectorTableModel::columnCount(const QModelIndex&) const /*-----------------------------------------------------*\ | The table has two columns - detector name and enable | \*-----------------------------------------------------*/ - return 2; + return(2); } int DetectorTableModel::rowCount(const QModelIndex&) const @@ -44,7 +44,7 @@ int DetectorTableModel::rowCount(const QModelIndex&) const /*-----------------------------------------------------*\ | The number of rows is equal to the number of detectors| \*-----------------------------------------------------*/ - return detectors.size(); + return((int)detectors.size()); } QVariant DetectorTableModel::data(const QModelIndex& index, int role) const @@ -58,21 +58,21 @@ QVariant DetectorTableModel::data(const QModelIndex& index, int role) const switch(index.column()) { case 0: - return detectors[index.row()].key.c_str(); + return(detectors[index.row()].key.c_str()); case 1: - return detectors[index.row()].value; + return(detectors[index.row()].value); } - return QVariant(); + return(QVariant()); case Qt::CheckStateRole: switch(index.column()) { case 1: - return 2 * detectors[index.row()].value; + return(2 * detectors[index.row()].value); } - return QVariant(); + return(QVariant()); } - return QVariant(); + return(QVariant()); } bool DetectorTableModel::setData(const QModelIndex& index, const QVariant& value, int role) @@ -85,7 +85,7 @@ bool DetectorTableModel::setData(const QModelIndex& index, const QVariant& value detectors[index.row()].value = value.toBool(); emit dataChanged(index, index); } - return false; + return(false); } QVariant DetectorTableModel::headerData(int index, Qt::Orientation orientation, int role) const @@ -95,19 +95,19 @@ QVariant DetectorTableModel::headerData(int index, Qt::Orientation orientation, switch(orientation) { case Qt::Vertical: - return index + 1; + return(index + 1); case Qt::Horizontal: switch(index) { case 0: - return tr("Name"); + return(tr("Name")); case 1: - return tr("Enabled"); + return(tr("Enabled")); } } } - return QVariant(); + return(QVariant()); } Qt::ItemFlags DetectorTableModel::flags(const QModelIndex& index) const @@ -119,7 +119,7 @@ Qt::ItemFlags DetectorTableModel::flags(const QModelIndex& index) const fl |= Qt::ItemIsUserCheckable; } - return fl; + return(fl); } void DetectorTableModel::applySettings() diff --git a/qt/DeviceView.cpp b/qt/DeviceView.cpp index bb9ea106..be078fb0 100644 --- a/qt/DeviceView.cpp +++ b/qt/DeviceView.cpp @@ -19,11 +19,11 @@ #include #define MAX_COLS 20 -#define PAD_LED 0.1 -#define PAD_TEXT 0.1 -#define PAD_ZONE 1.0 -#define PAD_SEGMENT 0.9 -#define SIZE_TEXT 0.5 +#define PAD_LED 0.1f +#define PAD_TEXT 0.1f +#define PAD_ZONE 1.0f +#define PAD_SEGMENT 0.9f +#define SIZE_TEXT 0.5f DeviceView::DeviceView(QWidget *parent) : QWidget(parent), @@ -237,7 +237,7 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Set the size of the selection flags vector | \*-----------------------------------------------------*/ - selectionFlags.resize(controller->leds.size()); + selectionFlags.resize((int)controller->leds.size()); /*-----------------------------------------------------*\ | Set the size of the zone and LED position vectors | @@ -251,7 +251,7 @@ void DeviceView::InitDeviceView() \*-----------------------------------------------------*/ unsigned int maxWidth = 0; unsigned int segment_count = 0; - float totalHeight = 0; + float totalHeight = 0.0f; /*-----------------------------------------------------*\ | Get device view settings | @@ -330,7 +330,7 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Calculate zone label position and size | \*-----------------------------------------------------*/ - zone_pos[zone_idx].matrix_x = (maxWidth - zone_pos[zone_idx].matrix_w) / 2.0; + zone_pos[zone_idx].matrix_x = (maxWidth - zone_pos[zone_idx].matrix_w) / 2.0f; zone_pos[zone_idx].matrix_y = current_y + SIZE_TEXT; zone_pos[zone_idx].matrix_h = SIZE_TEXT - PAD_TEXT; current_y += PAD_ZONE; @@ -357,8 +357,8 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | LED is a 1x1 square, minus padding on all sides | \*-----------------------------------------------------*/ - led_pos[color_idx].matrix_w = (1 - (2 * PAD_LED)); - led_pos[color_idx].matrix_h = (1 - (2 * PAD_LED)); + led_pos[color_idx].matrix_w = (1.0f - (2.0f * PAD_LED)); + led_pos[color_idx].matrix_h = (1.0f - (2.0f * PAD_LED)); if(!disable_expansion) { @@ -389,7 +389,7 @@ void DeviceView::InitDeviceView() || ( controller->leds[color_idx].name == KEY_EN_BACKSPACE ) || ( controller->leds[color_idx].name == KEY_EN_NUMPAD_0 ) ) { - led_pos[color_idx].matrix_w += 1; + led_pos[color_idx].matrix_w += 1.0f; } } if( ( controller->leds[color_idx].name == KEY_EN_NUMPAD_ENTER ) @@ -397,25 +397,25 @@ void DeviceView::InitDeviceView() { if(led_y < map->height - 1 && map->map[map_idx + map->width] == 0xFFFFFFFF) { - led_pos[color_idx].matrix_h += 1; + led_pos[color_idx].matrix_h += 1.0f; } /* TODO: check if there isn't another widened key above */ else if(led_y > 0 && map->map[map_idx - map->width] == 0xFFFFFFFF) { - led_pos[color_idx].matrix_y -= 1; - led_pos[color_idx].matrix_h += 1; + led_pos[color_idx].matrix_y -= 1.0f; + led_pos[color_idx].matrix_h += 1.0f; } } else if(controller->leds[color_idx].name == KEY_EN_SPACE) { - for(unsigned int map_idx2 = map_idx - 1; map_idx2 > led_y * map->width && map->map[map_idx2] == 0xFFFFFFFF; --map_idx2) + for(unsigned int map_idx2 = map_idx - 1; map_idx2 > led_y * map->width && map->map[map_idx2] == 0xFFFFFFFF; map_idx2--) { - led_pos[color_idx].matrix_x -= 1; - led_pos[color_idx].matrix_w += 1; + led_pos[color_idx].matrix_x -= 1.0f; + led_pos[color_idx].matrix_w += 1.0f; } - for(unsigned int map_idx2 = map_idx + 1; map_idx2 < (led_y + 1) * map->width && map->map[map_idx2] == 0xFFFFFFFF; ++map_idx2) + for(unsigned int map_idx2 = map_idx + 1; map_idx2 < (led_y + 1) * map->width && map->map[map_idx2] == 0xFFFFFFFF; map_idx2++) { - led_pos[color_idx].matrix_w += 1; + led_pos[color_idx].matrix_w += 1.0f; } } } @@ -432,7 +432,7 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Calculate segment label position and size | \*-----------------------------------------------------*/ - segment_pos[segment_count].matrix_x = (maxWidth - zone_pos[zone_idx].matrix_w) / 2.0; + segment_pos[segment_count].matrix_x = (maxWidth - zone_pos[zone_idx].matrix_w) / 2.0f; segment_pos[segment_count].matrix_y = current_y + SIZE_TEXT; segment_pos[segment_count].matrix_w = zone_pos[zone_idx].matrix_w; segment_pos[segment_count].matrix_h = SIZE_TEXT - PAD_TEXT; @@ -455,8 +455,8 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | LED is a 1x1 square, minus padding on all sides | \*-----------------------------------------------------*/ - led_pos[led_pos_idx].matrix_w = (1 - (2 * PAD_LED)); - led_pos[led_pos_idx].matrix_h = (1 - (2 * PAD_LED)); + led_pos[led_pos_idx].matrix_w = (1.0f - (2.0f * PAD_LED)); + led_pos[led_pos_idx].matrix_h = (1.0f - (2.0f * PAD_LED)); } current_y += (leds_count / MAX_COLS) + ((leds_count % MAX_COLS) > 0); @@ -479,8 +479,8 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | LED is a 1x1 square, minus padding on all sides | \*-----------------------------------------------------*/ - led_pos[led_pos_idx].matrix_w = (1 - (2 * PAD_LED)); - led_pos[led_pos_idx].matrix_h = (1 - (2 * PAD_LED)); + led_pos[led_pos_idx].matrix_w = (1.0f - (2.0f * PAD_LED)); + led_pos[led_pos_idx].matrix_h = (1.0f - (2.0f * PAD_LED)); } current_y += (leds_count / MAX_COLS) + ((leds_count % MAX_COLS) > 0); @@ -511,7 +511,7 @@ void DeviceView::InitDeviceView() | thing becomes too tall, we ignore it and let the view | | widget take care of it | \*-----------------------------------------------------*/ - float atom = 1.0 / maxWidth; + float atom = 1.0f / maxWidth; for(std::size_t zone_idx = 0; zone_idx < zone_pos.size(); zone_idx++) { @@ -620,7 +620,7 @@ void DeviceView::mouseMoveEvent(QMouseEvent *event) { previousSelection.clear(); previousFlags.clear(); - previousFlags.resize(controller->leds.size()); + previousFlags.resize((int)controller->leds.size()); } updateSelection(); } @@ -651,7 +651,7 @@ void DeviceView::mouseReleaseEvent(QMouseEvent* event) unsigned int segment_count = 0; - for(std::size_t zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) + for(int zone_idx = 0; zone_idx < controller->zones.size(); zone_idx++) { int posx = zone_pos[zone_idx].matrix_x * size + offset_x + 12; int posy = zone_pos[zone_idx].matrix_y * size; @@ -665,7 +665,7 @@ void DeviceView::mouseReleaseEvent(QMouseEvent* event) selectZone(zone_idx, ctrlDown); } - for(std::size_t segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++) + for(int segment_idx = 0; segment_idx < controller->zones[zone_idx].segments.size(); segment_idx++) { posx = segment_pos[segment_count].matrix_x * size + offset_x + 12; posy = segment_pos[segment_count].matrix_y * size; @@ -724,7 +724,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) /*-----------------------------------------------------*\ | LED rectangles | \*-----------------------------------------------------*/ - for(std::size_t led_idx = 0; led_idx < controller->leds.size(); led_idx++) + for(int led_idx = 0; led_idx < controller->leds.size(); led_idx++) { int posx = led_pos[led_idx].matrix_x * size + offset_x; int posy = led_pos[led_idx].matrix_y * size; @@ -844,12 +844,12 @@ void DeviceView::updateSelection() { selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize(controller->leds.size()); + selectionFlags.resize((int)controller->leds.size()); QRect sel = selectionRect.normalized(); std::vector& leds = controller->leds; - for(std::size_t led_idx = 0; led_idx < leds.size(); ++led_idx) + for(int led_idx = 0; led_idx < leds.size(); ++led_idx) { /*-----------------------------------------------------*\ | Check intersection | @@ -896,7 +896,7 @@ bool DeviceView::selectLed(int target) selectedLeds.resize(1); selectedLeds[0] = target; selectionFlags.clear(); - selectionFlags.resize(controller->leds.size()); + selectionFlags.resize((int)controller->leds.size()); selectionFlags[target] = 1; update(); @@ -920,7 +920,7 @@ bool DeviceView::selectLeds(QVector target) } selectionFlags.clear(); - selectionFlags.resize(controller->leds.size()); + selectionFlags.resize((int)controller->leds.size()); for(int item: target) { @@ -968,13 +968,13 @@ bool DeviceView::selectSegment(int zone, int segment, bool add) { selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize(controller->leds.size()); + selectionFlags.resize((int)controller->leds.size()); } int zoneStart = controller->zones[zone].start_idx; int segStart = controller->zones[zone].segments[segment].start_idx; - for(std::size_t led_idx = 0; led_idx < controller->zones[zone].segments[segment].leds_count; ++led_idx) + for(int led_idx = 0; led_idx < controller->zones[zone].segments[segment].leds_count; ++led_idx) { if(!selectionFlags[zoneStart + segStart + led_idx]) { @@ -1004,12 +1004,12 @@ bool DeviceView::selectZone(int zone, bool add) { selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize(controller->leds.size()); + selectionFlags.resize((int)controller->leds.size()); } int zoneStart = controller->zones[zone].start_idx; - for(std::size_t led_idx = 0; led_idx < controller->zones[zone].leds_count; ++led_idx) + for(int led_idx = 0; led_idx < controller->zones[zone].leds_count; ++led_idx) { if(!selectionFlags[zoneStart + led_idx]) { @@ -1035,7 +1035,7 @@ void DeviceView::clearSelection() \*-----------------------------------------------------*/ selectedLeds.clear(); selectionFlags.clear(); - selectionFlags.resize(controller->leds.size()); + selectionFlags.resize((int)controller->leds.size()); } void DeviceView::setSelectionColor(RGBColor color)