From dc2978c34339f8a1097069a122fb32cfc41cf3d1 Mon Sep 17 00:00:00 2001 From: Vitaly Samoylik Date: Mon, 16 Nov 2026 20:32:37 +0000 Subject: [PATCH] macos: Fix `shorten-64-to-32` compilation warning The issue was found during publication of the latest hidapi version to cocoapods. `pod lib lint` shows this warning, because cocoapods verification is implemented via Xcode project and `-Wshorten-64-to-32` is on by default in Xcode builds. --- .github/workflows/builds.yml | 3 ++- mac/hid.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 06cbcbe1a..a7a3d2cec 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -3,7 +3,8 @@ name: GitHub Builds on: [push, pull_request] env: - NIX_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror + # -Wshorten-64-to-32 is on by default in Xcode builds (and so in `pod lib lint`) + NIX_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror -Wshorten-64-to-32 GNU_COMPILE_FLAGS: -Wall -Wextra -pedantic -Werror -Wformat-signedness MSVC_COMPILE_FLAGS: /W4 /WX diff --git a/mac/hid.c b/mac/hid.c index bcf7a2310..4eb683c97 100644 --- a/mac/hid.c +++ b/mac/hid.c @@ -1598,7 +1598,7 @@ int HID_API_EXPORT_CALL hid_get_report_descriptor(hid_device *dev, unsigned char } memcpy(buf, descriptor_buf, copy_len); - return copy_len; + return (int) copy_len; } else { register_device_error(dev, "Failed to get kIOHIDReportDescriptorKey property");