eizoctl: fix message formatting on Windows
This increases the binary size, but at least we stop showing Chinese characters instead of ASCII.
This commit is contained in:
		
							parent
							
								
									2594f8467d
								
							
						
					
					
						commit
						dab190e857
					
				
							
								
								
									
										16
									
								
								eizoctl.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								eizoctl.c
									
									
									
									
									
								
							| @ -18,6 +18,14 @@ | ||||
|  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||||
|  * | ||||
|  */ | ||||
| 
 | ||||
| // On Windows, vswprintf() interprets %s in the width of the format string,
 | ||||
| // and %hs is not really compliant with any standard:
 | ||||
| // https://devblogs.microsoft.com/oldnewthing/20190830-00/?p=102823
 | ||||
| #ifdef _WIN32 | ||||
| #define __USE_MINGW_ANSI_STDIO | ||||
| #endif | ||||
| 
 | ||||
| #include <stdarg.h> | ||||
| #include <stdbool.h> | ||||
| #include <stdint.h> | ||||
| @ -41,7 +49,9 @@ | ||||
| #define hid_init hidapi_hid_init | ||||
| #endif | ||||
| 
 | ||||
| #if defined __GNUC__ | ||||
| #if defined __MINGW_GNU_PRINTF | ||||
| #define ATTRIBUTE_PRINTF(x, y) __MINGW_GNU_PRINTF((x), (y)) | ||||
| #elif defined __GNUC__ | ||||
| #define ATTRIBUTE_PRINTF(x, y) __attribute__((format(printf, x, y))) | ||||
| #else | ||||
| #define ATTRIBUTE_PRINTF(x, y) | ||||
| @ -1241,8 +1251,8 @@ message_output(const char *format, ...) | ||||
| 	wchar_t *message = message_printf(format, ap); | ||||
| 	va_end(ap); | ||||
| 	if (message) { | ||||
| 		MessageBox( | ||||
| 			NULL, message, NULL, MB_ICONINFORMATION | MB_OK | MB_APPLMODAL); | ||||
| 		MessageBox(NULL, message, | ||||
| 			L"Message", MB_ICONINFORMATION | MB_OK | MB_APPLMODAL); | ||||
| 		free(message); | ||||
| 	} | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user