core: Move parameter validation from backend to core
authorChris Dickens <christopher.a.dickens@gmail.com>
Mon, 16 Mar 2020 08:01:51 +0000 (01:01 -0700)
committerChris Dickens <christopher.a.dickens@gmail.com>
Mon, 16 Mar 2020 08:01:51 +0000 (01:01 -0700)
commit15bd82e9a2935fd4e5c1a9ed83c73d364e92d8ec
treedd1c590d17a0f10adfe9ca98b18b7783de3e3efc
parent26b16eb65a61b37b64ce8962b5b7d927c3c54a7d
core: Move parameter validation from backend to core

Some functions (e.g. libusb_set_interface_alt_setting()) do not perform
sufficient parameter validation, leaving the burden on the backend to
catch invalid user input. Much of this validation is common across all
backends, yet not every backend implemented it. Fix this by moving
parameter validation to the core library functions.

This is also a good opportunity to remove the redundant
'num_configurations' field from the libusb_device structure. The value
of this field is already contained in the 'device_descriptor' member.

Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
libusb/core.c
libusb/descriptor.c
libusb/io.c
libusb/libusbi.h
libusb/os/haiku_usb_raw.cpp
libusb/os/sunos_usb.c
libusb/os/windows_usbdk.c
libusb/os/windows_winusb.c
libusb/os/windows_winusb.h
libusb/version_nano.h