Skip to content

Conversation

@triplef
Copy link
Contributor

@triplef triplef commented Feb 1, 2022

Fixes the following warnings (or in our case errors when building with -Werror):

hid.c:420:45: error: variable 'entry_id' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
                        sprintf(cur_dev->path, "DevSrvsID:%llu", entry_id);
                                                                 ^~~~~~~~
In module 'Darwin' imported from hid.c:30:
/Applications/Xcode-13.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^~~~~~~~~~~
hid.c:384:19: note: initialize the variable 'entry_id' to silence this warning
        uint64_t entry_id;
                         ^
                          = 0
hid.c:908:10: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
                return length;
                ~~~~~~ ^~~~~~
hid.c:942:10: error: implicit conversion loses integer precision: 'CFIndex' (aka 'long') to 'int' [-Werror,-Wshorten-64-to-32]
                return report_length;
                ~~~~~~ ^~~~~~~~~~~~~
hid.c:964:9: error: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Werror,-Wshorten-64-to-32]
        return len;
        ~~~~~~ ^~~

@mcuee mcuee added the macOS Related to macOS backend label Feb 4, 2022
@Youw Youw merged commit e08ddce into libusb:master Feb 5, 2022
@triplef triplef deleted the fix-mac-warnings branch February 5, 2022 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macOS Related to macOS backend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants