From: Timo Kreuzer Date: Sun, 27 Dec 2015 18:22:13 +0000 (+0000) Subject: [CRT] X-Git-Tag: ReactOS-0.4.0~25^2~57 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=4479984cbe86a3490924004ed98a56820ab34593 [CRT] Fix handling of NULL buffer in streamout. Fixes a few msvcrt_crt_apitests, while it breaks a few for crtdll. crtdll is broken anyway and obsolete, nothing uses it, so it doesn't really matter. CORE-9105 #resolve svn path=/trunk/; revision=70443 --- diff --git a/reactos/lib/sdk/crt/printf/streamout.c b/reactos/lib/sdk/crt/printf/streamout.c index ccc56dec152..f427c84f286 100644 --- a/reactos/lib/sdk/crt/printf/streamout.c +++ b/reactos/lib/sdk/crt/printf/streamout.c @@ -227,11 +227,10 @@ static int streamout_char(FILE *stream, int chr) { -#ifdef _LIBCNT_ - if ((stream->_flag & _IOSTRG) && (!stream->_ptr)) +#if !defined(_USER32_WSPRINTF) + if ((stream->_flag & _IOSTRG) && (stream->_base == NULL)) return 1; -#endif - +#endif #if defined(_USER32_WSPRINTF) || defined(_LIBCNT_) /* Check if the buffer is full */ if (stream->_cnt < sizeof(TCHAR)) @@ -254,6 +253,11 @@ streamout_astring(FILE *stream, const char *string, size_t count) TCHAR chr; int written = 0; +#if !defined(_USER32_WSPRINTF) + if ((stream->_flag & _IOSTRG) && (stream->_base == NULL)) + return count; +#endif + while (count--) { #ifdef _UNICODE @@ -277,6 +281,11 @@ streamout_wstring(FILE *stream, const wchar_t *string, size_t count) wchar_t chr; int written = 0; +#if defined(_UNICODE) && !defined(_USER32_WSPRINTF) + if ((stream->_flag & _IOSTRG) && (stream->_base == NULL)) + return count; +#endif + while (count--) { #ifndef _UNICODE