From f5a8ecc3f48f831c59523807ada43ef4fb2f12f7 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Sun, 5 Jul 2026 04:05:52 -0500 Subject: [PATCH] Rework RGBController functions that return vector counts to use unsigned int instead of std::size_t, to be consistent with the size used in the network protocol and to fix warnings --- Documentation/RGBControllerAPI.md | 18 ++++---- ProfileManager.cpp | 10 ++--- RGBController/RGBController.cpp | 42 +++++++++---------- RGBController/RGBController.h | 18 ++++---- RGBController/RGBControllerInterface.h | 18 ++++---- cli.cpp | 20 ++++----- qt/DeviceView.cpp | 18 ++++---- .../OpenRGBClientInfoPage.cpp | 2 +- qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp | 38 ++++++++--------- qt/OpenRGBDevicePage/OpenRGBDevicePage.h | 2 +- 10 files changed, 93 insertions(+), 93 deletions(-) diff --git a/Documentation/RGBControllerAPI.md b/Documentation/RGBControllerAPI.md index e0148ffaa..7fce17de2 100644 --- a/Documentation/RGBControllerAPI.md +++ b/Documentation/RGBControllerAPI.md @@ -411,7 +411,7 @@ Returns the color value of the given color index within the given zone. Returns a pointer to the colors array for the given zone. The caller is responsible for locking and unlocking the access mutex. -#### `std::size_t GetZoneCount()` +#### `unsigned int GetZoneCount()` Returns the number of zones in the `zones` vector. @@ -451,7 +451,7 @@ Returns the height of the matrix map for the given zone. Returns the width of the matrix map for the given zone. -#### `std::size_t GetZoneModeCount(unsigned int zone)` +#### `unsigned int GetZoneModeCount(unsigned int zone)` Returns the number of zone-specific modes for the given zone. @@ -475,7 +475,7 @@ Returns the color at the given index for the given mode in the given zone. Returns the color mode of the given mode in the given zone. -#### `std::size_t GetZoneModeColorsCount(unsigned int zone, unsigned int mode)` +#### `unsigned int GetZoneModeColorsCount(unsigned int zone, unsigned int mode)` Returns the number of colors in the given mode in the given zone. @@ -515,7 +515,7 @@ Returns the minimum speed value of the given mode in the given zone. Returns the name of the given zone. -#### `std::size_t GetZoneSegmentCount(unsigned int zone)` +#### `unsigned int GetZoneSegmentCount(unsigned int zone)` Returns the number of segments in the given zone. @@ -587,7 +587,7 @@ Sets the color at the given index for the given mode in the given zone. Sets the color mode for the given mode in the given zone. -#### `void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, std::size_t count)` +#### `void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, unsigned int count)` Sets the number of colors for the given mode in the given zone. The count must be within the mode's colors_min and colors_max range. @@ -605,7 +605,7 @@ Returns true if any zone has zone-specific modes defined. ### Mode Functions -#### `std::size_t GetModeCount()` +#### `unsigned int GetModeCount()` Returns the number of modes in the `modes` vector. @@ -629,7 +629,7 @@ Returns the color at the given index for the given mode. Returns the color mode of the given mode. -#### `std::size_t GetModeColorsCount(unsigned int mode)` +#### `unsigned int GetModeColorsCount(unsigned int mode)` Returns the number of colors in the given mode. @@ -677,7 +677,7 @@ Sets the color at the given index for the given mode. Sets the color mode for the given mode. -#### `void SetModeColorsCount(unsigned int mode, std::size_t count)` +#### `void SetModeColorsCount(unsigned int mode, unsigned int count)` Sets the number of colors for the given mode. The count must be within the mode's colors_min and colors_max range. @@ -703,7 +703,7 @@ When called, the device should be put into its software-controlled mode. This d ### LED Functions -#### `std::size_t GetLEDCount()` +#### `unsigned int GetLEDCount()` Returns the number of LEDs in the `leds` vector. diff --git a/ProfileManager.cpp b/ProfileManager.cpp index caecb2809..458358e32 100644 --- a/ProfileManager.cpp +++ b/ProfileManager.cpp @@ -736,7 +736,7 @@ bool ProfileManager::SaveConfiguration() save_controller = true; } - for(std::size_t zone_index = 0; zone_index < controllers[controller_index]->GetZoneCount(); zone_index++) + for(unsigned int zone_index = 0; zone_index < controllers[controller_index]->GetZoneCount(); zone_index++) { if(controllers[controller_index]->GetZoneFlags(zone_index) & ZONE_FLAGS_MANUALLY_CONFIGURED) { @@ -1127,7 +1127,7 @@ bool ProfileManager::LoadControllerFromListWithOptions load_controller->modes[mode_index].colors.resize(profile_controller->modes[mode_index].colors.size()); - for(std::size_t mode_color_index = 0; mode_color_index < profile_controller->GetModeColorsCount(mode_index); mode_color_index++) + for(unsigned int mode_color_index = 0; mode_color_index < profile_controller->GetModeColorsCount(mode_index); mode_color_index++) { load_controller->modes[mode_index].colors[mode_color_index] = profile_controller->modes[mode_index].colors[mode_color_index]; } @@ -1157,7 +1157,7 @@ bool ProfileManager::LoadControllerFromListWithOptions \*-----------------------------------------*/ if(profile_controller->GetZoneCount() == load_controller->GetZoneCount()) { - for(std::size_t zone_idx = 0; zone_idx < profile_controller->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < profile_controller->GetZoneCount(); zone_idx++) { if((profile_controller->GetZoneName(zone_idx) == load_controller->GetZoneName(zone_idx) ) &&(profile_controller->GetZoneType(zone_idx) == load_controller->GetZoneType(zone_idx) ) @@ -1165,7 +1165,7 @@ bool ProfileManager::LoadControllerFromListWithOptions &&(profile_controller->GetZoneLEDsMax(zone_idx) == load_controller->GetZoneLEDsMax(zone_idx) ) &&(profile_controller->GetZoneModeCount(zone_idx) == load_controller->GetZoneModeCount(zone_idx))) { - for(std::size_t mode_index = 0; mode_index < profile_controller->GetZoneModeCount(zone_idx); mode_index++) + for(unsigned int mode_index = 0; mode_index < profile_controller->GetZoneModeCount(zone_idx); mode_index++) { if((profile_controller->GetZoneModeName(zone_idx, mode_index) == load_controller->GetZoneModeName(zone_idx, mode_index) ) &&(profile_controller->GetZoneModeFlags(zone_idx, mode_index) == load_controller->GetZoneModeFlags(zone_idx, mode_index) ) @@ -1183,7 +1183,7 @@ bool ProfileManager::LoadControllerFromListWithOptions load_controller->zones[zone_idx].modes[mode_index].colors.resize(profile_controller->zones[zone_idx].modes[mode_index].colors.size()); - for(std::size_t mode_color_index = 0; mode_color_index < profile_controller->GetZoneModeColorsCount(zone_idx, mode_index); mode_color_index++) + for(unsigned int mode_color_index = 0; mode_color_index < profile_controller->GetZoneModeColorsCount(zone_idx, mode_index); mode_color_index++) { load_controller->zones[zone_idx].modes[mode_index].colors[mode_color_index] = profile_controller->zones[zone_idx].modes[mode_index].colors[mode_color_index]; } diff --git a/RGBController/RGBController.cpp b/RGBController/RGBController.cpp index 0726ca639..eebd4f14a 100644 --- a/RGBController/RGBController.cpp +++ b/RGBController/RGBController.cpp @@ -285,9 +285,9 @@ RGBColor* RGBController::GetZoneColorsPointer(unsigned int zone) } } -std::size_t RGBController::GetZoneCount() +unsigned int RGBController::GetZoneCount() { - return(zones.size()); + return((unsigned int)zones.size()); } std::string RGBController::GetZoneDisplayName(unsigned int zone) @@ -455,14 +455,14 @@ unsigned int RGBController::GetZoneMatrixMapWidth(unsigned int zone) return(width); } -std::size_t RGBController::GetZoneModeCount(unsigned int zone) +unsigned int RGBController::GetZoneModeCount(unsigned int zone) { - std::size_t mode_count; + unsigned int mode_count; AccessMutex.lock_shared(); if(zone < zones.size()) { - mode_count = zones[zone].modes.size(); + mode_count = (unsigned int)zones[zone].modes.size(); } else { @@ -563,14 +563,14 @@ unsigned int RGBController::GetZoneModeColorMode(unsigned int zone, unsigned int return(color_mode); } -std::size_t RGBController::GetZoneModeColorsCount(unsigned int zone, unsigned int mode) +unsigned int RGBController::GetZoneModeColorsCount(unsigned int zone, unsigned int mode) { - std::size_t colors_count; + unsigned int colors_count; AccessMutex.lock_shared(); if((zone < zones.size()) && (mode < zones[zone].modes.size())) { - colors_count = zones[zone].modes[mode].colors.size(); + colors_count = (unsigned int)zones[zone].modes[mode].colors.size(); } else { @@ -743,14 +743,14 @@ std::string RGBController::GetZoneName(unsigned int zone) return(name); } -std::size_t RGBController::GetZoneSegmentCount(unsigned int zone) +unsigned int RGBController::GetZoneSegmentCount(unsigned int zone) { - std::size_t count; + unsigned int count; AccessMutex.lock_shared(); if(zone < zones.size()) { - count = zones[zone].segments.size(); + count = (unsigned int)zones[zone].segments.size(); } else { @@ -1053,7 +1053,7 @@ void RGBController::SetZoneModeColorMode(unsigned int zone, unsigned int mode, u AccessMutex.unlock(); } -void RGBController::SetZoneModeColorsCount(unsigned int zone, unsigned int mode, std::size_t count) +void RGBController::SetZoneModeColorsCount(unsigned int zone, unsigned int mode, unsigned int count) { AccessMutex.lock(); if((zone < zones.size()) && (mode < zones[zone].modes.size()) && (count >= zones[zone].modes[mode].colors_min) && (count <= zones[zone].modes[mode].colors_max)) @@ -1111,9 +1111,9 @@ bool RGBController::SupportsPerZoneModes() /*---------------------------------------------------------*\ | Mode Functions | \*---------------------------------------------------------*/ -std::size_t RGBController::GetModeCount() +unsigned int RGBController::GetModeCount() { - return(modes.size()); + return((unsigned int)modes.size()); } unsigned int RGBController::GetModeBrightness(unsigned int mode) @@ -1206,14 +1206,14 @@ unsigned int RGBController::GetModeColorMode(unsigned int mode) return(color_mode); } -std::size_t RGBController::GetModeColorsCount(unsigned int mode) +unsigned int RGBController::GetModeColorsCount(unsigned int mode) { - std::size_t count; + unsigned int count; AccessMutex.lock_shared(); if(mode < modes.size()) { - count = modes[mode].colors.size(); + count = (unsigned int)modes[mode].colors.size(); } else { @@ -1387,7 +1387,7 @@ void RGBController::SetModeColorMode(unsigned int mode, unsigned int color_mode) AccessMutex.unlock(); } -void RGBController::SetModeColorsCount(unsigned int mode, std::size_t count) +void RGBController::SetModeColorsCount(unsigned int mode, unsigned int count) { AccessMutex.lock(); if((mode < modes.size()) && (count >= modes[mode].colors_min) && (count <= modes[mode].colors_max)) @@ -1512,9 +1512,9 @@ void RGBController::SetCustomMode() /*---------------------------------------------------------*\ | LED Functions | \*---------------------------------------------------------*/ -std::size_t RGBController::GetLEDCount() +unsigned int RGBController::GetLEDCount() { - return(leds.size()); + return((unsigned int)leds.size()); } std::string RGBController::GetLEDName(unsigned int led) @@ -4521,7 +4521,7 @@ bool RGBController::CompareControllers(RGBController* controller_1, RGBControlle } else { - for(std::size_t mode_index = 0; mode_index < controller_1->GetZoneModeCount(zone_index); mode_index++) + for(unsigned int mode_index = 0; mode_index < controller_1->GetZoneModeCount(zone_index); mode_index++) { if((controller_1->GetZoneModeName(zone_index, mode_index) != controller_2->GetZoneModeName(zone_index, mode_index) ) || (controller_1->GetZoneModeFlags(zone_index, mode_index) != controller_2->GetZoneModeFlags(zone_index, mode_index) ) diff --git a/RGBController/RGBController.h b/RGBController/RGBController.h index 639a80344..f717f4730 100644 --- a/RGBController/RGBController.h +++ b/RGBController/RGBController.h @@ -55,7 +55,7 @@ public: int GetZoneActiveMode(unsigned int zone); RGBColor GetZoneColor(unsigned int zone, unsigned int color_index); RGBColor* GetZoneColorsPointer(unsigned int zone); - std::size_t GetZoneCount(); + unsigned int GetZoneCount(); std::string GetZoneDisplayName(unsigned int zone); zone_flags GetZoneFlags(unsigned int zone); unsigned int GetZoneLEDsCount(unsigned int zone); @@ -65,13 +65,13 @@ public: const unsigned int* GetZoneMatrixMapData(unsigned int zone); unsigned int GetZoneMatrixMapHeight(unsigned int zone); unsigned int GetZoneMatrixMapWidth(unsigned int zone); - std::size_t GetZoneModeCount(unsigned int zone); + unsigned int GetZoneModeCount(unsigned int zone); unsigned int GetZoneModeBrightness(unsigned int zone, unsigned int mode); unsigned int GetZoneModeBrightnessMax(unsigned int zone, unsigned int mode); unsigned int GetZoneModeBrightnessMin(unsigned int zone, unsigned int mode); RGBColor GetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index); unsigned int GetZoneModeColorMode(unsigned int zone, unsigned int mode); - std::size_t GetZoneModeColorsCount(unsigned int zone, unsigned int mode); + unsigned int GetZoneModeColorsCount(unsigned int zone, unsigned int mode); unsigned int GetZoneModeColorsMax(unsigned int zone, unsigned int mode); unsigned int GetZoneModeColorsMin(unsigned int zone, unsigned int mode); unsigned int GetZoneModeDirection(unsigned int zone, unsigned int mode); @@ -81,7 +81,7 @@ public: unsigned int GetZoneModeSpeedMax(unsigned int zone, unsigned int mode); unsigned int GetZoneModeSpeedMin(unsigned int zone, unsigned int mode); std::string GetZoneName(unsigned int zone); - std::size_t GetZoneSegmentCount(unsigned int zone); + unsigned int GetZoneSegmentCount(unsigned int zone); segment_flags GetZoneSegmentFlags(unsigned int zone, unsigned int segment); unsigned int GetZoneSegmentLEDsCount(unsigned int zone, unsigned int segment); matrix_map_type GetZoneSegmentMatrixMap(unsigned int zone, unsigned int segment); @@ -101,7 +101,7 @@ public: void SetZoneModeBrightness(unsigned int zone, unsigned int mode, unsigned int brightness); void SetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index, RGBColor color); void SetZoneModeColorMode(unsigned int zone, unsigned int mode, unsigned int color_mode); - void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, std::size_t count); + void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, unsigned int count); void SetZoneModeDirection(unsigned int zone, unsigned int mode, unsigned int direction); void SetZoneModeSpeed(unsigned int zone, unsigned int mode, unsigned int speed); @@ -110,13 +110,13 @@ public: /*-----------------------------------------------------*\ | Mode Functions | \*-----------------------------------------------------*/ - std::size_t GetModeCount(); + unsigned int GetModeCount(); unsigned int GetModeBrightness(unsigned int mode); unsigned int GetModeBrightnessMax(unsigned int mode); unsigned int GetModeBrightnessMin(unsigned int mode); RGBColor GetModeColor(unsigned int mode, unsigned int color_index); unsigned int GetModeColorMode(unsigned int mode); - std::size_t GetModeColorsCount(unsigned int mode); + unsigned int GetModeColorsCount(unsigned int mode); unsigned int GetModeColorsMax(unsigned int mode); unsigned int GetModeColorsMin(unsigned int mode); unsigned int GetModeDirection(unsigned int mode); @@ -129,7 +129,7 @@ public: void SetModeBrightness(unsigned int mode, unsigned int brightness); void SetModeColor(unsigned int mode, unsigned int color_index, RGBColor color); void SetModeColorMode(unsigned int mode, unsigned int color_mode); - void SetModeColorsCount(unsigned int mode, std::size_t count); + void SetModeColorsCount(unsigned int mode, unsigned int count); void SetModeDirection(unsigned int mode, unsigned int direction); void SetModeSpeed(unsigned int mode, unsigned int speed); @@ -140,7 +140,7 @@ public: /*-----------------------------------------------------*\ | LED Functions | \*-----------------------------------------------------*/ - std::size_t GetLEDCount(); + unsigned int GetLEDCount(); std::string GetLEDName(unsigned int led); std::string GetLEDDisplayName(unsigned int led); diff --git a/RGBController/RGBControllerInterface.h b/RGBController/RGBControllerInterface.h index d6807d024..e698ee9e0 100644 --- a/RGBController/RGBControllerInterface.h +++ b/RGBController/RGBControllerInterface.h @@ -531,7 +531,7 @@ public: virtual int GetZoneActiveMode(unsigned int zone) = 0; virtual RGBColor GetZoneColor(unsigned int zone, unsigned int color_index) = 0; virtual RGBColor* GetZoneColorsPointer(unsigned int zone) = 0; - virtual std::size_t GetZoneCount() = 0; + virtual unsigned int GetZoneCount() = 0; virtual std::string GetZoneDisplayName(unsigned int zone) = 0; virtual zone_flags GetZoneFlags(unsigned int zone) = 0; virtual unsigned int GetZoneLEDsCount(unsigned int zone) = 0; @@ -541,13 +541,13 @@ public: virtual const unsigned int* GetZoneMatrixMapData(unsigned int zone) = 0; virtual unsigned int GetZoneMatrixMapHeight(unsigned int zone) = 0; virtual unsigned int GetZoneMatrixMapWidth(unsigned int zone) = 0; - virtual std::size_t GetZoneModeCount(unsigned int zone) = 0; + virtual unsigned int GetZoneModeCount(unsigned int zone) = 0; virtual unsigned int GetZoneModeBrightness(unsigned int zone, unsigned int mode) = 0; virtual unsigned int GetZoneModeBrightnessMax(unsigned int zone, unsigned int mode) = 0; virtual unsigned int GetZoneModeBrightnessMin(unsigned int zone, unsigned int mode) = 0; virtual RGBColor GetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index) = 0; virtual unsigned int GetZoneModeColorMode(unsigned int zone, unsigned int mode) = 0; - virtual std::size_t GetZoneModeColorsCount(unsigned int zone, unsigned int mode) = 0; + virtual unsigned int GetZoneModeColorsCount(unsigned int zone, unsigned int mode) = 0; virtual unsigned int GetZoneModeColorsMax(unsigned int zone, unsigned int mode) = 0; virtual unsigned int GetZoneModeColorsMin(unsigned int zone, unsigned int mode) = 0; virtual unsigned int GetZoneModeDirection(unsigned int zone, unsigned int mode) = 0; @@ -557,7 +557,7 @@ public: virtual unsigned int GetZoneModeSpeedMax(unsigned int zone, unsigned int mode) = 0; virtual unsigned int GetZoneModeSpeedMin(unsigned int zone, unsigned int mode) = 0; virtual std::string GetZoneName(unsigned int zone) = 0; - virtual std::size_t GetZoneSegmentCount(unsigned int zone) = 0; + virtual unsigned int GetZoneSegmentCount(unsigned int zone) = 0; virtual segment_flags GetZoneSegmentFlags(unsigned int zone, unsigned int segment) = 0; virtual unsigned int GetZoneSegmentLEDsCount(unsigned int zone, unsigned int segment) = 0; virtual matrix_map_type GetZoneSegmentMatrixMap(unsigned int zone, unsigned int segment) = 0; @@ -577,7 +577,7 @@ public: virtual void SetZoneModeBrightness(unsigned int zone, unsigned int mode, unsigned int brightness) = 0; virtual void SetZoneModeColor(unsigned int zone, unsigned int mode, unsigned int color_index, RGBColor color) = 0; virtual void SetZoneModeColorMode(unsigned int zone, unsigned int mode, unsigned int color_mode) = 0; - virtual void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, std::size_t count) = 0; + virtual void SetZoneModeColorsCount(unsigned int zone, unsigned int mode, unsigned int count) = 0; virtual void SetZoneModeDirection(unsigned int zone, unsigned int mode, unsigned int direction) = 0; virtual void SetZoneModeSpeed(unsigned int zone, unsigned int mode, unsigned int speed) = 0; @@ -586,13 +586,13 @@ public: /*-----------------------------------------------------*\ | Mode Functions | \*-----------------------------------------------------*/ - virtual std::size_t GetModeCount() = 0; + virtual unsigned int GetModeCount() = 0; virtual unsigned int GetModeBrightness(unsigned int mode) = 0; virtual unsigned int GetModeBrightnessMax(unsigned int mode) = 0; virtual unsigned int GetModeBrightnessMin(unsigned int mode) = 0; virtual RGBColor GetModeColor(unsigned int mode, unsigned int color_index) = 0; virtual unsigned int GetModeColorMode(unsigned int mode) = 0; - virtual std::size_t GetModeColorsCount(unsigned int mode) = 0; + virtual unsigned int GetModeColorsCount(unsigned int mode) = 0; virtual unsigned int GetModeColorsMax(unsigned int mode) = 0; virtual unsigned int GetModeColorsMin(unsigned int mode) = 0; virtual unsigned int GetModeDirection(unsigned int mode) = 0; @@ -605,7 +605,7 @@ public: virtual void SetModeBrightness(unsigned int mode, unsigned int brightness) = 0; virtual void SetModeColor(unsigned int mode, unsigned int color_index, RGBColor color) = 0; virtual void SetModeColorMode(unsigned int mode, unsigned int color_mode) = 0; - virtual void SetModeColorsCount(unsigned int mode, std::size_t count) = 0; + virtual void SetModeColorsCount(unsigned int mode, unsigned int count) = 0; virtual void SetModeDirection(unsigned int mode, unsigned int direction) = 0; virtual void SetModeSpeed(unsigned int mode, unsigned int speed) = 0; @@ -616,7 +616,7 @@ public: /*-----------------------------------------------------*\ | LED Functions | \*-----------------------------------------------------*/ - virtual std::size_t GetLEDCount() = 0; + virtual unsigned int GetLEDCount() = 0; virtual std::string GetLEDName(unsigned int led) = 0; virtual std::string GetLEDDisplayName(unsigned int led) = 0; diff --git a/cli.cpp b/cli.cpp index bbb0aa9d1..4c974b631 100644 --- a/cli.cpp +++ b/cli.cpp @@ -337,7 +337,7 @@ unsigned int ParseMode(DeviceOptions& options, std::vector &rgb | Search through all of the device modes and see if there is| | a match. If no match is found, print an error message. | \*---------------------------------------------------------*/ - for(std::size_t mode_idx = 0; mode_idx < rgb_controllers[options.device]->GetModeCount(); mode_idx++) + for(unsigned int mode_idx = 0; mode_idx < rgb_controllers[options.device]->GetModeCount(); mode_idx++) { if(strcasecmp(rgb_controllers[options.device]->GetModeName(mode_idx).c_str(), options.mode.c_str()) == 0) { @@ -514,7 +514,7 @@ void OptionListDevices(std::vector& rgb_controllers) std::cout << " Modes:"; int current_mode = controller->GetActiveMode(); - for(std::size_t mode_idx = 0; mode_idx < controller->GetModeCount(); mode_idx++) + for(unsigned int mode_idx = 0; mode_idx < controller->GetModeCount(); mode_idx++) { std::string modeStr = QuoteIfNecessary(controller->GetModeName(mode_idx)); @@ -534,7 +534,7 @@ void OptionListDevices(std::vector& rgb_controllers) { std::cout << " Zones:"; - for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { std::cout << " " << QuoteIfNecessary(controller->GetZoneDisplayName(zone_idx)); } @@ -548,7 +548,7 @@ void OptionListDevices(std::vector& rgb_controllers) { std::cout << " LEDs:"; - for(std::size_t led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) + for(unsigned int led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) { std::cout << " " << QuoteIfNecessary(controller->GetLEDName(led_idx)); } @@ -1196,8 +1196,8 @@ void ApplyOptions(DeviceOptions& options, std::vector& rgb_cont case MODE_COLORS_PER_LED: if(options.colors.size() != 0) { - std::size_t start_from; - std::size_t led_count; + unsigned int start_from; + unsigned int led_count; if(options.zone < 0) { @@ -1206,13 +1206,13 @@ void ApplyOptions(DeviceOptions& options, std::vector& rgb_cont } else { - start_from = (std::size_t)device->GetZoneStartIndex(options.zone); - led_count = (std::size_t)device->GetLEDsInZone(options.zone); + start_from = device->GetZoneStartIndex(options.zone); + led_count = device->GetLEDsInZone(options.zone); } - for(std::size_t led_idx = 0; led_idx < led_count; led_idx++) + for(unsigned int led_idx = 0; led_idx < led_count; led_idx++) { - std::size_t color_idx = led_idx; + unsigned int color_idx = led_idx; if(color_idx >= options.colors.size()) { diff --git a/qt/DeviceView.cpp b/qt/DeviceView.cpp index fc8fadf69..39126b4a8 100644 --- a/qt/DeviceView.cpp +++ b/qt/DeviceView.cpp @@ -899,9 +899,9 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) \*-----------------------------------------------------*/ unsigned int segments = 0; - for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { - for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { segments++; } @@ -994,7 +994,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) \*-----------------------------------------------------*/ unsigned int segment_count = 0; - for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { /*-------------------------------------------------*\ | Determine position and size for zone name | @@ -1028,7 +1028,7 @@ void DeviceView::paintEvent(QPaintEvent* /* event */) \*-------------------------------------------------*/ painter.drawText(posx, posy + posh, QString(controller->GetZoneDisplayName((unsigned int)zone_idx).c_str())); - for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { /*---------------------------------------------*\ | Determine position and size for segment name | @@ -1135,7 +1135,7 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Determine the total height (in LEDs) of all zones | \*-----------------------------------------------------*/ - for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { /*-------------------------------------------------*\ | For matrix zones, use matrix height from the map | @@ -1151,7 +1151,7 @@ void DeviceView::InitDeviceView() \*-------------------------------------------------*/ else if(controller->GetZoneSegmentCount(zone_idx) > 0) { - for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { if(controller->GetZoneSegmentType(zone_idx, segment_idx) == ZONE_TYPE_MATRIX) { @@ -1199,7 +1199,7 @@ void DeviceView::InitDeviceView() matrix_h = total_height; segment_count = 0; - for(std::size_t zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < controller->GetZoneCount(); zone_idx++) { /*-------------------------------------------------*\ | Calculate zone label position and size | @@ -1302,7 +1302,7 @@ void DeviceView::InitDeviceView() } else if(controller->GetZoneSegmentCount(zone_idx) > 0) { - for(std::size_t segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < controller->GetZoneSegmentCount(zone_idx); segment_idx++) { /*-----------------------------------------*\ | Calculate segment label position and size | @@ -1399,7 +1399,7 @@ void DeviceView::InitDeviceView() /*-----------------------------------------------------*\ | Update LED labels | \*-----------------------------------------------------*/ - for(std::size_t led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) + for(unsigned int led_idx = 0; led_idx < controller->GetLEDCount(); led_idx++) { std::map::const_iterator it = led_label_lookup.find(controller->GetLEDDisplayName((unsigned int)led_idx)); diff --git a/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp b/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp index 210a48348..2c99e315a 100644 --- a/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp +++ b/qt/OpenRGBClientInfoPage/OpenRGBClientInfoPage.cpp @@ -226,7 +226,7 @@ void OpenRGBClientInfoPage::UpdateInfo() /*-----------------------------------------------------*\ | Add child items for each zone in the device | \*-----------------------------------------------------*/ - for(std::size_t zone_idx = 0; zone_idx < ResourceManager::get()->GetClients()[client_idx]->GetRGBControllers()[dev_idx]->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < ResourceManager::get()->GetClients()[client_idx]->GetRGBControllers()[dev_idx]->GetZoneCount(); zone_idx++) { /*-----------------------------------------------------*\ | Create child tree widget items and display the zone | diff --git a/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp index 0d1cc7b3c..53b34ed28 100644 --- a/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage/OpenRGBDevicePage.cpp @@ -514,7 +514,7 @@ void OpenRGBDevicePage::UpdateLEDList() | Fill in the LED list with all LEDs in the | | device | \*-----------------------------------------*/ - for(std::size_t i = 0; i < device->GetLEDCount(); i++) + for(unsigned int i = 0; i < device->GetLEDCount(); i++) { ui->LEDBox->addItem(device->GetLEDDisplayName((unsigned int)i).c_str()); } @@ -808,7 +808,7 @@ void OpenRGBDevicePage::UpdateLEDUi() /*-----------------------------------------*\ | Initialize variables | \*-----------------------------------------*/ - bool multiple = (std::size_t(selected_led) == (device->GetLEDCount() + 1)); + bool multiple = ((unsigned int)selected_led == (device->GetLEDCount() + 1)); RGBColor color = 0x00000000; bool updateColor = false; @@ -1183,7 +1183,7 @@ void OpenRGBDevicePage::UpdateMode() /*-----------------------------------------------------*\ | Don't set the mode if the current mode is invalid | \*-----------------------------------------------------*/ - std::size_t mode_count = 0; + unsigned int mode_count = 0; if(selected_zone_mode) { @@ -1194,7 +1194,7 @@ void OpenRGBDevicePage::UpdateMode() mode_count = device->GetModeCount(); } - if((std::size_t)selected_mode < mode_count) + if((unsigned int)selected_mode < mode_count) { /*-----------------------------------------------------*\ | Update mode parameters | @@ -1287,19 +1287,19 @@ void OpenRGBDevicePage::UpdateModeList() ui->ModeBox->blockSignals(true); ui->ModeBox->clear(); - std::size_t entry_count = 0; + int entry_count = 0; if(!selected_all_zones && !(device->GetModeFlags(device->GetActiveMode()) & MODE_FLAG_REQUIRES_ENTIRE_DEVICE) && (selected_zone >= 0) && device->SupportsPerZoneModes()) { ui->ModeBox->addItem("Follow Device Mode"); - ui->ModeBox->setItemData((int)entry_count, "Follow the device's global mode", Qt::ToolTipRole); + ui->ModeBox->setItemData(entry_count, "Follow the device's global mode", Qt::ToolTipRole); entry_count++; - for(std::size_t i = 0; i < device->GetZoneModeCount(selected_zone); i++) + for(unsigned int i = 0; i < device->GetZoneModeCount(selected_zone); i++) { ui->ModeBox->addItem(device->GetZoneModeName(selected_zone, (unsigned int)i).c_str()); - ui->ModeBox->setItemData((int)entry_count, ModeDescription(device->GetZoneModeName(selected_zone, i)), Qt::ToolTipRole); + ui->ModeBox->setItemData(entry_count, ModeDescription(device->GetZoneModeName(selected_zone, i)), Qt::ToolTipRole); entry_count++; } @@ -1309,10 +1309,10 @@ void OpenRGBDevicePage::UpdateModeList() } else { - for(std::size_t i = 0; i < device->GetModeCount(); i++) + for(unsigned int i = 0; i < device->GetModeCount(); i++) { ui->ModeBox->addItem(device->GetModeName((unsigned int)i).c_str()); - ui->ModeBox->setItemData((int)entry_count, ModeDescription(device->GetModeName(i)), Qt::ToolTipRole); + ui->ModeBox->setItemData(entry_count, ModeDescription(device->GetModeName(i)), Qt::ToolTipRole); entry_count++; } @@ -1682,11 +1682,11 @@ void OpenRGBDevicePage::UpdateModeUi() ui->ZoneBox->addItem(tr("All Zones")); } - for(std::size_t zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) { ui->ZoneBox->addItem(device->GetZoneDisplayName((unsigned int)zone_idx).c_str()); - for(std::size_t segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) { if(device->GetZoneSegmentFlags(zone_idx, segment_idx) & SEGMENT_FLAG_GROUP_MEMBER) { @@ -1770,11 +1770,11 @@ void OpenRGBDevicePage::UpdateZoneList() ui->ZoneBox->setDisabled(1); } - for(std::size_t zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) { ui->ZoneBox->addItem(device->GetZoneDisplayName((unsigned int)zone_idx).c_str()); - for(std::size_t segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) { if(device->GetZoneSegmentFlags(zone_idx, segment_idx) & SEGMENT_FLAG_GROUP_MEMBER) { @@ -1892,7 +1892,7 @@ void OpenRGBDevicePage::GetSelectedZone(bool * selected_all_zones, int * selecte { current_index++; - for(std::size_t zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) { if(index == (int)current_index) { @@ -1902,7 +1902,7 @@ void OpenRGBDevicePage::GetSelectedZone(bool * selected_all_zones, int * selecte current_index++; - for(std::size_t segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) { if(index == (int)current_index) { @@ -1934,7 +1934,7 @@ void OpenRGBDevicePage::SetSelectedZone(bool selected_all_zones, int selected_zo current_index++; - for(std::size_t zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) + for(unsigned int zone_idx = 0; zone_idx < device->GetZoneCount(); zone_idx++) { if((selected_zone == (int)zone_idx) && (selected_segment < 0)) { @@ -1944,7 +1944,7 @@ void OpenRGBDevicePage::SetSelectedZone(bool selected_all_zones, int selected_zo current_index++; - for(std::size_t segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) + for(unsigned int segment_idx = 0; segment_idx < device->GetZoneSegmentCount(zone_idx); segment_idx++) { if((selected_zone == (int)zone_idx) && (selected_segment == (int)segment_idx)) { @@ -2119,7 +2119,7 @@ void OpenRGBDevicePage::on_DeviceSaveButton_clicked() } } -void OpenRGBDevicePage::on_DeviceViewBox_selectionChanged(int selected_zone, int selected_segment, std::vector indices) +void OpenRGBDevicePage::on_DeviceViewBox_selectionChanged(int selected_zone, int selected_segment, std::vector indices) { /*-----------------------------------------------------*\ | Device View only supports per-LED modes | diff --git a/qt/OpenRGBDevicePage/OpenRGBDevicePage.h b/qt/OpenRGBDevicePage/OpenRGBDevicePage.h index 38e560aad..74c69dda5 100644 --- a/qt/OpenRGBDevicePage/OpenRGBDevicePage.h +++ b/qt/OpenRGBDevicePage/OpenRGBDevicePage.h @@ -105,7 +105,7 @@ private slots: void on_BrightnessSlider_valueChanged(int value); void on_ColorWheelBox_colorChanged(const QColor color); void on_DeviceSaveButton_clicked(); - void on_DeviceViewBox_selectionChanged(int selected_zone, int selected_segment, std::vector); + void on_DeviceViewBox_selectionChanged(int selected_zone, int selected_segment, std::vector); void on_DirectionBox_currentIndexChanged(int index); void on_EditButton_clicked(); void on_GreenSpinBox_valueChanged(int green);