From 22406c7d862c1a5e48d32d711a4488669596f7e2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 14 Jan 2017 00:07:44 +0100 Subject: [PATCH] Fix configure build with MinGW 5.3.0 Provide our own wcsnlen() declaration as the function is detected by configure but is not declared in MinGW headers. Closes #17762. --- include/wx/wxcrtbase.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/wx/wxcrtbase.h b/include/wx/wxcrtbase.h index 77c93c8e0b..7391bc5283 100644 --- a/include/wx/wxcrtbase.h +++ b/include/wx/wxcrtbase.h @@ -221,6 +221,13 @@ extern unsigned long android_wcstoul(const wchar_t *nptr, wchar_t **endptr, int #endif #ifdef HAVE_WCSNLEN + /* + When using MinGW, wcsnlen() is not declared, but is still found by + configure -- just declare it in this case as it seems better to use it + if it's available (see https://sourceforge.net/p/mingw/bugs/2332/) + */ + wxDECL_FOR_MINGW32_ALWAYS(size_t, wcsnlen, (const wchar_t*, size_t)) + #define wxCRT_StrnlenW wcsnlen #endif