← KD100

Fix compiler warnings in modular build

f2b1637ecff6259cf8ddf52530b1d7c75a933bc6 · Claude · Jan 22, 2026 06:43

Fixed all compiler warnings from the modular build:

1. src/device.c:82 - Changed info array from 'unsigned char' to 'char'
   to match strlen() and strcmp() parameter types

2. src/device.c:365 - Changed loop variable from 'int' to 'size_t'
   to match sizeof() return type

3. src/compat.c:20 - Increased path buffer from 256 to 512 bytes
   to prevent potential truncation with long directory names

Build now compiles cleanly with -Wall -Wextra -Wpedantic flags.

+3 −3 · 2 files changed

  • src/compat.c +1 −1
  • src/device.c +2 −2
diff --git a/src/compat.c b/src/compat.c
index 35fffb4..1cce5e9 100644
--- a/src/compat.c
+++ b/src/compat.c
@@ -17,7 +17,7 @@ int is_module_loaded(const char* module_name) {
 int try_hidraw_access(void) {
     DIR *dir;
     struct dirent *ent;
-    char path[256];
+    char path[512];
     char buf[256];
 
     dir = opendir("/dev");
diff --git a/src/device.c b/src/device.c
index 22cd763..64d7601 100644
--- a/src/device.c
+++ b/src/device.c
@@ -79,7 +79,7 @@ void device_run(libusb_context* ctx, config_t* config, int debug, int accept, in
 
         while ((dev = devs[d++]) != NULL) {
             struct libusb_device_descriptor devDesc;
-            unsigned char info[200] = "";
+            char info[200] = "";
             err = libusb_get_device_descriptor(dev, &devDesc);
 
             if (err < 0) {
@@ -362,7 +362,7 @@ void device_run(libusb_context* ctx, config_t* config, int debug, int accept, in
 
                     if (debug == 2 || dry) {
                         printf("DATA: [%d", data[0]);
-                        for (int i = 1; i < sizeof(data); i++) {
+                        for (size_t i = 1; i < sizeof(data); i++) {
                             printf(", %d", data[i]);
                         }
                         printf("]\n");