mirror of
https://github.com/RPCS3/hidapi.git
synced 2026-07-19 13:34:37 -04:00
libusb/mac: gcc -pedantic warning fixes
This commit is contained in:
committed by
Alan Ott
parent
69a91a8f6c
commit
b0e2fb8d35
+5
-5
@@ -783,18 +783,17 @@ hid_device * HID_API_EXPORT hid_open_path(const char *path)
|
||||
{
|
||||
hid_device *dev = NULL;
|
||||
|
||||
dev = new_hid_device();
|
||||
|
||||
libusb_device **devs;
|
||||
libusb_device *usb_dev;
|
||||
ssize_t num_devs;
|
||||
int res;
|
||||
int d = 0;
|
||||
int good_open = 0;
|
||||
|
||||
dev = new_hid_device();
|
||||
|
||||
hid_init();
|
||||
|
||||
num_devs = libusb_get_device_list(usb_context, &devs);
|
||||
libusb_get_device_list(usb_context, &devs);
|
||||
while ((usb_dev = devs[d++]) != NULL) {
|
||||
struct libusb_device_descriptor desc;
|
||||
struct libusb_config_descriptor *conf_desc = NULL;
|
||||
@@ -1363,6 +1362,7 @@ uint16_t get_usb_code_for_current_locale(void)
|
||||
char *locale;
|
||||
char search_string[64];
|
||||
char *ptr;
|
||||
struct lang_map_entry *lang;
|
||||
|
||||
/* Get the current locale. */
|
||||
locale = setlocale(0, NULL);
|
||||
@@ -1385,7 +1385,7 @@ uint16_t get_usb_code_for_current_locale(void)
|
||||
}
|
||||
|
||||
/* Find the entry which matches the string code of our locale. */
|
||||
struct lang_map_entry *lang = lang_map;
|
||||
lang = lang_map;
|
||||
while (lang->string_code) {
|
||||
if (!strcmp(lang->string_code, search_string)) {
|
||||
return lang->usb_code;
|
||||
|
||||
@@ -234,14 +234,15 @@ static int get_string_property(IOHIDDeviceRef device, CFStringRef prop, wchar_t
|
||||
buf[0] = 0;
|
||||
|
||||
if (str) {
|
||||
len --;
|
||||
|
||||
CFIndex str_len = CFStringGetLength(str);
|
||||
CFRange range;
|
||||
range.location = 0;
|
||||
range.length = (str_len > len)? len: str_len;
|
||||
CFIndex used_buf_len;
|
||||
CFIndex chars_copied;
|
||||
|
||||
len --;
|
||||
|
||||
range.location = 0;
|
||||
range.length = ((size_t)str_len > len)? len: (size_t)str_len;
|
||||
chars_copied = CFStringGetBytes(str,
|
||||
range,
|
||||
kCFStringEncodingUTF32LE,
|
||||
@@ -618,6 +619,7 @@ static void perform_signal_callback(void *context)
|
||||
static void *read_thread(void *param)
|
||||
{
|
||||
hid_device *dev = param;
|
||||
SInt32 code;
|
||||
|
||||
/* Move the device's run loop to this thread. */
|
||||
IOHIDDeviceScheduleWithRunLoop(dev->device_handle, CFRunLoopGetCurrent(), dev->run_loop_mode);
|
||||
@@ -641,7 +643,6 @@ static void *read_thread(void *param)
|
||||
|
||||
/* Run the Event Loop. CFRunLoopRunInMode() will dispatch HID input
|
||||
reports into the hid_report_callback(). */
|
||||
SInt32 code;
|
||||
while (!dev->shutdown_thread && !dev->disconnected) {
|
||||
code = CFRunLoopRunInMode(dev->run_loop_mode, 1000/*sec*/, FALSE);
|
||||
/* Return if the device has been disconnected */
|
||||
|
||||
Reference in New Issue
Block a user