diff options
author | Bruno Haible <bruno@clisp.org> | 2019-12-17 10:35:05 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2019-12-17 10:35:05 +0100 |
commit | f61573abd91da7f722b8b4a1dc97bea9b81b17a3 (patch) | |
tree | cd4a6dd7c5154f551d42d72d602039fdc3b27afe | |
parent | 290331834d4f200042e01da78e38ff944a55703c (diff) | |
download | gnulib-f61573abd91da7f722b8b4a1dc97bea9b81b17a3.tar.gz |
mbsinit: Fix compilation error in mingw-w64 7.0 with _UCRT defined.
Reported by Tom Kacvinsky <tom.kacvinsky@vector.com>
and Martin Storsjö <martin@martin.st>
in <https://savannah.gnu.org/bugs/?57406>.
* lib/mbsinit.c: Accommodate an MSVC-like mbstate_t definition with
mingw.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | lib/mbsinit.c | 9 |
2 files changed, 12 insertions, 6 deletions
@@ -1,5 +1,14 @@ 2019-12-17 Bruno Haible <bruno@clisp.org> + mbsinit: Fix compilation error in mingw-w64 7.0 with _UCRT defined. + Reported by Tom Kacvinsky <tom.kacvinsky@vector.com> + and Martin Storsjö <martin@martin.st> + in <https://savannah.gnu.org/bugs/?57406>. + * lib/mbsinit.c: Accommodate an MSVC-like mbstate_t definition with + mingw. + +2019-12-17 Bruno Haible <bruno@clisp.org> + glob: Avoid warning on mingw. Reported by Christian Biesinger <cbiesinger@google.com> in <https://lists.gnu.org/archive/html/bug-gnulib/2019-12/msg00122.html>. diff --git a/lib/mbsinit.c b/lib/mbsinit.c index 5ecaef77c7..b42909e61d 100644 --- a/lib/mbsinit.c +++ b/lib/mbsinit.c @@ -56,13 +56,10 @@ mbsinit (const mbstate_t *ps) { # if defined _WIN32 && !defined __CYGWIN__ /* Native Windows. */ -# ifdef __MINGW32__ - /* On mingw, 'mbstate_t' is defined as 'int'. */ - return ps == NULL || *ps == 0; -# else - /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4-bytes matter. */ + /* MSVC defines 'mbstate_t' as an 8-byte struct; the first 4 bytes matter. + On mingw, 'mbstate_t' is sometimes defined as 'int', sometimes defined as + an 8-byte struct, of which the first 4 bytes matter. */ return ps == NULL || *(const unsigned int *)ps == 0; -# endif # else /* Minix, HP-UX 11.00, Solaris 2.6, Interix, ... */ /* Maybe this definition works, maybe not... */ |