mbrtowc.c: Make mbsrtowcs comply with GNU libc when *dst=NULL mbsrtowcs in GNU libc leaves *src unchanged if *dst=NULL. Currently the implementation of mbsrtowcs in mingw-w64-crt changes *src just like when *dst!=NULL. This bug has caused GNU hello to not say "Hello, world!" when compiled with mingw-w64 and the msys2 distribution. Signed-off-by: Matthew Palermo <matt.r.palermo@gmail.com> Signed-off-by: Liu Hao <lh_mouse@126.com>
diff --git a/mingw-w64-crt/misc/mbrtowc.c b/mingw-w64-crt/misc/mbrtowc.c index c3091cb..2eb4807 100644 --- a/mingw-w64-crt/misc/mbrtowc.c +++ b/mingw-w64-crt/misc/mbrtowc.c
@@ -137,13 +137,10 @@ else { wchar_t byte_bucket = 0; - while ((ret = __mbrtowc_cp (&byte_bucket, *src, mb_max, + while ((ret = __mbrtowc_cp (&byte_bucket, *src + n, mb_max, internal_ps, cp, mb_max)) > 0) - { - *src += ret; - n += ret; - } + n += ret; } return n; }