From f568253c5124d8e2c5872c15b48724f521f2d095 Mon Sep 17 00:00:00 2001 From: Adam Honse Date: Wed, 2 Sep 2020 18:25:58 -0500 Subject: [PATCH] Clean up more warnings --- NetworkClient.cpp | 4 ++-- NetworkProtocol.h | 2 +- NetworkServer.cpp | 4 ++-- ResourceManager.cpp | 6 +++--- cli.cpp | 8 ++++---- qt/DeviceView.cpp | 8 ++++---- qt/OpenRGBDevicePage.cpp | 2 +- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/NetworkClient.cpp b/NetworkClient.cpp index 8146dc84..074e33d0 100644 --- a/NetworkClient.cpp +++ b/NetworkClient.cpp @@ -381,7 +381,7 @@ void NetworkClient::ListenThreadFunction() } bytes_read += tmp_bytes_read; - } while (bytes_read < header.pkt_size); + } while ((unsigned int)bytes_read < header.pkt_size); } //Entire request received, select functionality based on request ID @@ -448,7 +448,7 @@ void NetworkClient::ProcessReply_ControllerCount(unsigned int data_size, char * } } -void NetworkClient::ProcessReply_ControllerData(unsigned int data_size, char * data, unsigned int dev_idx) +void NetworkClient::ProcessReply_ControllerData(unsigned int /*data_size*/, char * data, unsigned int dev_idx) { RGBController_Network * new_controller = new RGBController_Network(this, dev_idx); diff --git a/NetworkProtocol.h b/NetworkProtocol.h index 86f48ea3..3af28414 100644 --- a/NetworkProtocol.h +++ b/NetworkProtocol.h @@ -20,7 +20,7 @@ typedef struct NetPacketHeader unsigned int pkt_dev_idx; /* Device index */ unsigned int pkt_id; /* Packet ID */ unsigned int pkt_size; /* Packet size */ -}; +} NetPacketHeader; enum { diff --git a/NetworkServer.cpp b/NetworkServer.cpp index f5caaabe..1fff4336 100644 --- a/NetworkServer.cpp +++ b/NetworkServer.cpp @@ -446,7 +446,7 @@ void NetworkServer::ListenThreadFunction(NetworkClientInfo * client_info) } bytes_read += tmp_bytes_read; - } while (bytes_read < header.pkt_size); + } while ((unsigned int)bytes_read < header.pkt_size); } //Entire request received, select functionality based on request ID @@ -584,7 +584,7 @@ listen_done: ClientInfoChanged(); } -void NetworkServer::ProcessRequest_ClientString(SOCKET client_sock, unsigned int data_size, char * data) +void NetworkServer::ProcessRequest_ClientString(SOCKET client_sock, unsigned int /*data_size*/, char * data) { ServerClientsMutex.lock(); for(unsigned int this_idx = 0; this_idx < ServerClients.size(); this_idx++) diff --git a/ResourceManager.cpp b/ResourceManager.cpp index 37de581b..9068ebde 100644 --- a/ResourceManager.cpp +++ b/ResourceManager.cpp @@ -161,7 +161,7 @@ void ResourceManager::DetectDevicesThreadFunction() /*-------------------------------------------------*\ | Detect i2c busses | \*-------------------------------------------------*/ - for(int i2c_bus_detector_idx = 0; i2c_bus_detector_idx < i2c_bus_detectors.size(); i2c_bus_detector_idx++) + for(unsigned int i2c_bus_detector_idx = 0; i2c_bus_detector_idx < i2c_bus_detectors.size(); i2c_bus_detector_idx++) { i2c_bus_detectors[i2c_bus_detector_idx](busses); } @@ -169,7 +169,7 @@ void ResourceManager::DetectDevicesThreadFunction() /*-------------------------------------------------*\ | Detect i2c devices | \*-------------------------------------------------*/ - for(int i2c_detector_idx = 0; i2c_detector_idx < i2c_device_detectors.size(); i2c_detector_idx++) + for(unsigned int i2c_detector_idx = 0; i2c_detector_idx < i2c_device_detectors.size(); i2c_detector_idx++) { detection_string = i2c_device_detector_strings[i2c_detector_idx]; DeviceListChanged(); @@ -207,7 +207,7 @@ void ResourceManager::DetectDevicesThreadFunction() /*-------------------------------------------------*\ | Detect other devices | \*-------------------------------------------------*/ - for(int detector_idx = 0; detector_idx < device_detectors.size(); detector_idx++) + for(unsigned int detector_idx = 0; detector_idx < device_detectors.size(); detector_idx++) { detection_string = device_detector_strings[detector_idx]; DeviceListChanged(); diff --git a/cli.cpp b/cli.cpp index 6226b317..e44bb385 100644 --- a/cli.cpp +++ b/cli.cpp @@ -532,7 +532,7 @@ bool OptionDevice(int *current_device, std::string argument, Options *options, s } } -bool OptionZone(int *current_device, int *current_zone, std::string argument, Options *options, std::vector &rgb_controllers) +bool OptionZone(int *current_device, int *current_zone, std::string argument, Options */*options*/, std::vector &rgb_controllers) { ResourceManager::get()->WaitForDeviceDetection(); @@ -557,7 +557,7 @@ bool OptionZone(int *current_device, int *current_zone, std::string argument, Op } } -bool OptionColor(int *currentDev, int *current_zone, std::string argument, Options *options) +bool OptionColor(int *currentDev, int */*current_zone*/, std::string argument, Options *options) { DeviceOptions* currentDevOpts = GetDeviceOptionsForDevID(options, *currentDev); @@ -587,7 +587,7 @@ bool OptionMode(int *currentDev, std::string argument, Options *options) return true; } -bool OptionSize(int *current_device, int *current_zone, std::string argument, Options *options, std::vector &rgb_controllers) +bool OptionSize(int *current_device, int *current_zone, std::string argument, Options */*options*/, std::vector &rgb_controllers) { const unsigned int new_size = std::stoi(argument); @@ -1024,7 +1024,7 @@ void ApplyOptions(DeviceOptions& options, std::vector &rgb_cont void WaitWhileServerOnline(NetworkServer* srv) { - while (network_server->GetOnline()) + while (srv->GetOnline()) { std::this_thread::sleep_for(1s); }; diff --git a/qt/DeviceView.cpp b/qt/DeviceView.cpp index e70e609b..749d2400 100644 --- a/qt/DeviceView.cpp +++ b/qt/DeviceView.cpp @@ -216,9 +216,9 @@ void DeviceView::setController(RGBController * controller_ptr) { matrix_map_type * map = controller->zones[zone_idx].matrix_map; - for(int led_x = 0; led_x < map->width; led_x++) + for(unsigned int led_x = 0; led_x < map->width; led_x++) { - for(int led_y = 0; led_y < map->height; led_y++) + for(unsigned int led_y = 0; led_y < map->height; led_y++) { unsigned int map_idx = led_y * map->width + led_x; unsigned int color_idx = map->map[map_idx] + controller->zones[zone_idx].start_idx; @@ -281,7 +281,7 @@ void DeviceView::setController(RGBController * controller_ptr) led_pos[color_idx].matrix_x -= atom; led_pos[color_idx].matrix_w += atom; } - for(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 += atom; } @@ -294,7 +294,7 @@ void DeviceView::setController(RGBController * controller_ptr) } else { - for(int i = 0; i < controller->zones[zone_idx].leds_count; i++) + for(unsigned int i = 0; i < controller->zones[zone_idx].leds_count; i++) { led_pos[i + controller->zones[zone_idx].start_idx].matrix_x = zone_pos[zone_idx].matrix_x + (i % maxCols + ledPadding) * atom; led_pos[i + controller->zones[zone_idx].start_idx].matrix_y = current_y + (i / maxCols + ledPadding) * atom; diff --git a/qt/OpenRGBDevicePage.cpp b/qt/OpenRGBDevicePage.cpp index 44d52d86..c7dc0a85 100644 --- a/qt/OpenRGBDevicePage.cpp +++ b/qt/OpenRGBDevicePage.cpp @@ -640,7 +640,7 @@ void Ui::OpenRGBDevicePage::UpdateModeUi() for (std::size_t i = 0; i < device->modes[selected_mode].colors.size(); i++) { char id_buf[32]; - snprintf(id_buf, 16, "Mode Color %lu", i); + snprintf(id_buf, 16, "Mode Color %u", i); ui->LEDBox->addItem(id_buf); }