Skip to content

Commit 25d7ea3

Browse files
Fix warnings in OpenRGBHardwareIDsDialog.cpp
1 parent 8173275 commit 25d7ea3

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

qt/OpenRGBHardwareIDsDialog.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ int Ui::OpenRGBHardwareIDsDialog::show()
4040
char line[550];
4141
snprintf(line, 550, "%04X:%04X %04X:%04X", bus->pci_vendor, bus->pci_device, bus->pci_subsystem_vendor, bus->pci_subsystem_device);
4242
new QTreeWidgetItem(i2c_top, {line, bus->device_name});
43-
// We keep the strings for the clipboard feature
44-
strncat(line, " - ", 550);
45-
strncat(line, bus->device_name, 550);
43+
44+
snprintf(line, 550, "%04X:%04X %04X:%04X - %s", bus->pci_vendor, bus->pci_device, bus->pci_subsystem_vendor, bus->pci_subsystem_device, bus->device_name);
4645
strings.push_back(line);
4746
}
4847

@@ -68,10 +67,9 @@ int Ui::OpenRGBHardwareIDsDialog::show()
6867
snprintf(line, 550, "[%04X:%04X U=%04X P=0x%04X I=%d]", current_hid_device->vendor_id, current_hid_device->product_id, current_hid_device->usage, current_hid_device->usage_page, current_hid_device->interface_number);
6968
new QTreeWidgetItem(hid_top, {line, prod_name, manu_name});
7069

71-
strncat(line, manu_name, 550);
72-
strncat(line, " - ", 550);
73-
strncat(line, prod_name, 550);
70+
snprintf(line, 550, "[%04X:%04X U=%04X P=0x%04X I=%d] %s - %s", current_hid_device->vendor_id, current_hid_device->product_id, current_hid_device->usage, current_hid_device->usage_page, current_hid_device->interface_number, manu_name, prod_name);
7471
strings.push_back(line);
72+
7573
current_hid_device = current_hid_device->next;
7674
}
7775

@@ -114,7 +112,7 @@ int Ui::OpenRGBHardwareIDsDialog::show()
114112
}
115113

116114
char line[512];
117-
sprintf(line, "%04X:%04X", descriptor.idVendor, descriptor.idProduct);
115+
snprintf(line, 512, "%04X:%04X", descriptor.idVendor, descriptor.idProduct);
118116
new QTreeWidgetItem(libusb_top, {line});
119117
strings.push_back(line);
120118
}

0 commit comments

Comments
 (0)