Compare commits
2 Commits
d8b01cdaee
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
c6f47a0981
|
|||
|
c8f3b9ba38
|
@@ -41,13 +41,16 @@ pkg_check_modules (libusb libusb-1.0)
|
|||||||
|
|
||||||
# On MSYS2, the CMake package cannot link statically, but pkg-config can.
|
# On MSYS2, the CMake package cannot link statically, but pkg-config can.
|
||||||
# On macOS, we explicitly want to use the CMake package.
|
# On macOS, we explicitly want to use the CMake package.
|
||||||
if (WIN32)
|
if (NOT WIN32)
|
||||||
|
find_package (hidapi QUIET)
|
||||||
|
if (hidapi_FOUND)
|
||||||
|
set (hidapi_INCLUDE_DIRS)
|
||||||
|
set (hidapi_LIBRARY_DIRS)
|
||||||
|
set (hidapi_LIBRARIES hidapi::hidapi)
|
||||||
|
endif ()
|
||||||
|
endif ()
|
||||||
|
if (NOT hidapi_FOUND)
|
||||||
pkg_search_module (hidapi hidapi hidapi-hidraw hidapi-libusb)
|
pkg_search_module (hidapi hidapi hidapi-hidraw hidapi-libusb)
|
||||||
else ()
|
|
||||||
find_package (hidapi)
|
|
||||||
set (hidapi_INCLUDE_DIRS)
|
|
||||||
set (hidapi_LIBRARY_DIRS)
|
|
||||||
set (hidapi_LIBRARIES hidapi::hidapi)
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
option (WITH_LIBUSB "Compile with libusb-based utilities" ${libusb_FOUND})
|
option (WITH_LIBUSB "Compile with libusb-based utilities" ${libusb_FOUND})
|
||||||
|
|||||||
@@ -1251,10 +1251,13 @@ message_printf(const char *format, va_list ap)
|
|||||||
return NULL;
|
return NULL;
|
||||||
mbstowcs(format_wide, format, format_wide_len);
|
mbstowcs(format_wide, format, format_wide_len);
|
||||||
|
|
||||||
int message_len = vswprintf(NULL, 0, format_wide, ap) + 1;
|
// Note that just vswprintf() cannot be used like this
|
||||||
|
// (at least since mingw-w64 commit c85d64),
|
||||||
|
// and vsnwprintf() is a MinGW extension, acting like C11 vsnwprintf_s.
|
||||||
|
int message_len = vsnwprintf(NULL, 0, format_wide, ap) + 1;
|
||||||
wchar_t *message = calloc(message_len, sizeof *message);
|
wchar_t *message = calloc(message_len, sizeof *message);
|
||||||
if (message_len > 0 && message)
|
if (message_len > 0 && message)
|
||||||
vswprintf(message, message_len, format_wide, ap);
|
vsnwprintf(message, message_len, format_wide, ap);
|
||||||
|
|
||||||
free(format_wide);
|
free(format_wide);
|
||||||
return message;
|
return message;
|
||||||
|
|||||||
Reference in New Issue
Block a user