aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTormod Volden <debian.tormod@gmail.com>2024-01-19 10:05:46 +0100
committerTormod Volden <debian.tormod@gmail.com>2024-01-19 19:39:26 +0100
commita8fba21b7fa38860d78b131ca72937792adb9d62 (patch)
treefa4578e5e77968e2c8aea1c57adbfb2529b4b312
parent56d8f3c558dad4eaf0d571c054d44d07ace2331f (diff)
downloadlibusb-a8fba21b7fa38860d78b131ca72937792adb9d62.tar.gz
Change libusb_init_option to fix libusb_set_option() on big-endian
libusb_set_option() is a variadic function, so the type of the arguments is not clearly defined. When called with LIBUSB_OPTION_LOG_LEVEL, the argument is read with va_arg() as an int, which matches the type used when passing constants, and also most of the internal calls and the calls in the examples. However the internal call site in libusb_init_context() passes the ival element of the libusb_init_option struct directly, which is of type int64_t. This breaks on big-endian architectures like PowerPC, as detected by tests/set_option. Therefore change the libusb_init_option struct to use int here as well. Thanks to Aurelien Jarno for reporting and initial patch. Closes #1416 Closes #1436 Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
-rw-r--r--libusb/libusb.h2
-rw-r--r--libusb/version_nano.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/libusb/libusb.h b/libusb/libusb.h
index ec14e7e..ffdb96b 100644
--- a/libusb/libusb.h
+++ b/libusb/libusb.h
@@ -1538,7 +1538,7 @@ struct libusb_init_option {
enum libusb_option option;
/** An integer value used by the option (if applicable). */
union {
- int64_t ival;
+ int ival;
libusb_log_cb log_cbval;
} value;
};
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index bbd8bd5..69ee24e 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11861
+#define LIBUSB_NANO 11862