hidapi: Explicitly include locale.h, for setlocale
authorEthan Lee <flibitijibibo@flibitijibibo.com>
Tue, 06 Aug 2019 23:08:01 -0400
changeset 13003200f23b4f8d2
parent 13002 4436f8e76e5c
child 13004 ea71847e4e3c
hidapi: Explicitly include locale.h, for setlocale
src/hidapi/libusb/hid.c
     1.1 --- a/src/hidapi/libusb/hid.c	Mon Aug 05 23:52:16 2019 -0700
     1.2 +++ b/src/hidapi/libusb/hid.c	Tue Aug 06 23:08:01 2019 -0400
     1.3 @@ -34,6 +34,7 @@
     1.4  #ifdef SDL_JOYSTICK_HIDAPI
     1.5  
     1.6  #include <libusb.h>
     1.7 +#include <locale.h> /* setlocale */
     1.8  
     1.9  #include "hidapi.h"
    1.10  
    1.11 @@ -452,20 +453,16 @@
    1.12  int HID_API_EXPORT hid_init(void)
    1.13  {
    1.14  	if (!usb_context) {
    1.15 -#ifndef _WIN32 /* TODO: Win32 setlocale */
    1.16  		const char *locale;
    1.17 -#endif /* _WIN32 */
    1.18  
    1.19  		/* Init Libusb */
    1.20  		if (libusb_init(&usb_context))
    1.21  			return -1;
    1.22  
    1.23 -#ifndef _WIN32 /* TODO: Win32 setlocale */
    1.24  		/* Set the locale if it's not set. */
    1.25  		locale = setlocale(LC_CTYPE, NULL);
    1.26  		if (!locale)
    1.27  			setlocale(LC_CTYPE, "");
    1.28 -#endif /* _WIN32 */
    1.29  	}
    1.30  
    1.31  	return 0;
    1.32 @@ -1357,7 +1354,6 @@
    1.33  	uint16_t usb_code;
    1.34  };
    1.35  
    1.36 -#ifndef _WIN32 /* TODO: Win32 setlocale */
    1.37  #define LANG(name,code,usb_code) { name, code, usb_code }
    1.38  static struct lang_map_entry lang_map[] = {
    1.39  	LANG("Afrikaans", "af", 0x0436),
    1.40 @@ -1495,11 +1491,9 @@
    1.41  	LANG("Zulu", "zu", 0x0435),
    1.42  	LANG(NULL, NULL, 0x0),
    1.43  };
    1.44 -#endif /* _WIN32 */
    1.45  
    1.46  uint16_t get_usb_code_for_current_locale(void)
    1.47  {
    1.48 -#ifndef _WIN32 /* TODO: Win32 setlocale? */
    1.49  	char *locale;
    1.50  	char search_string[64];
    1.51  	char *ptr;
    1.52 @@ -1557,7 +1551,6 @@
    1.53  	}
    1.54  #endif
    1.55  
    1.56 -#endif /* _WIN32 */
    1.57  	/* Found nothing. */
    1.58  	return 0x0;
    1.59  }