1
0
Fork 0
mirror of https://github.com/linux-usb-gadgets/libusbgx.git synced 2025-07-12 21:19:43 +03:00
libusbgx/include/usbg
Michael Grzeschik 8664b79d12 include: function: net: Fix narrowing integer conversions
This fixes the following compilation error/warning:

In file included from ../tests/header_checker.cpp:6:
../include/usbg/function/net.h: In function ‘int usbg_f_net_set_subclass(usbg_f_net*, unsigned int)’:
../include/usbg/function/net.h:278:67: error: narrowing conversion of ‘subclass’ from ‘unsigned int’ to ‘int’ [-Werror=narrowing]
  278 |                                        USBG_F_NET_INT_TO_ATTR_VAL(subclass));
      |                                                                   ^~~~~~~~
../include/usbg/usbg.h:61:34: note: in definition of macro ‘USBG_TO_UNION’
   61 |         ((union UNAME){ .FIELD = WHAT, })
      |                                  ^~~~
../include/usbg/function/net.h:278:40: note: in expansion of macro ‘USBG_F_NET_INT_TO_ATTR_VAL’
  278 |                                        USBG_F_NET_INT_TO_ATTR_VAL(subclass));
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
../include/usbg/function/net.h: In function ‘int usbg_f_net_set_protocol(usbg_f_net*, unsigned int)’:
../include/usbg/function/net.h:302:67: error: narrowing conversion of ‘protocol’ from ‘unsigned int’ to ‘int’ [-Werror=narrowing]
  302 |                                        USBG_F_NET_INT_TO_ATTR_VAL(protocol));
      |                                                                   ^~~~~~~~
../include/usbg/usbg.h:61:34: note: in definition of macro ‘USBG_TO_UNION’
   61 |         ((union UNAME){ .FIELD = WHAT, })
      |                                  ^~~~
../include/usbg/function/net.h:302:40: note: in expansion of macro ‘USBG_F_NET_INT_TO_ATTR_VAL’
  302 |                                        USBG_F_NET_INT_TO_ATTR_VAL(protocol));
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors

In the kernel qmult is also from type unsigned int which alignes with
the rest of this struct and resolves the above compile issue.
2024-09-25 00:34:00 +02:00
..
function include: function: net: Fix narrowing integer conversions 2024-09-25 00:34:00 +02:00
usbg.h Merge pull request #91 from mgrzeschik/usb9pfs 2024-09-24 21:42:11 +02:00
usbg_internal.h uvc: add more controls 2024-08-29 21:33:08 +02:00
usbg_internal_libconfig.h uvc: add more controls 2024-08-29 21:33:08 +02:00
usbg_internal_none.h uvc: fix nop function for usbg_set_config_node_guid 2024-09-13 00:24:20 +02:00
usbg_version.h.in libusbgx: add USBG_VERSION preprocessor symbol 2018-02-06 16:52:56 +01:00