From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1873) id AB3DD3857818; Sun, 11 Apr 2021 18:58:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB3DD3857818 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Iain Buclaw To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/ibuclaw/heads/mingw)] Questionable fix (fgetwc is defined in C library, and this implementation does not really work with X-Act-Checkin: gcc X-Git-Author: Iain Buclaw X-Git-Refname: refs/users/ibuclaw/heads/mingw X-Git-Oldrev: b90017c02476ad452fe042e90e5d3304c8262a0e X-Git-Newrev: 6724c01a716b8bf5efaf6a42148cc6f9ea6807f2 Message-Id: <20210411185834.AB3DD3857818@sourceware.org> Date: Sun, 11 Apr 2021 18:58:34 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Apr 2021 18:58:34 -0000 https://gcc.gnu.org/g:6724c01a716b8bf5efaf6a42148cc6f9ea6807f2 commit 6724c01a716b8bf5efaf6a42148cc6f9ea6807f2 Author: Iain Buclaw Date: Sun Apr 11 20:56:48 2021 +0200 Questionable fix (fgetwc is defined in C library, and this implementation does not really work with wchar_t) Diff: --- libphobos/libdruntime/core/stdc/stdio.d | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/libphobos/libdruntime/core/stdc/stdio.d b/libphobos/libdruntime/core/stdc/stdio.d index 6cd7851f96c..dab5ba8d7b2 100644 --- a/libphobos/libdruntime/core/stdc/stdio.d +++ b/libphobos/libdruntime/core/stdc/stdio.d @@ -1486,6 +1486,35 @@ else version (CRuntime_Microsoft) else return _filbuf(fp); } + /// + int _fputwc_nolock(int c, FILE* fp) + { + pragma(inline, true); + fp._cnt = fp._cnt - 1; + if (fp._cnt >= 0) + { + immutable ch = cast(char)c; + *fp._ptr = ch; + fp._ptr = fp._ptr + 1; + return ch & 0xFF; + } + else + return _flsbuf(c, fp); + } + /// + int _fgetwc_nolock(FILE* fp) + { + pragma(inline, true); + fp._cnt = fp._cnt - 1; + if (fp._cnt >= 0) + { + immutable ch = *fp._ptr; + fp._ptr = fp._ptr + 1; + return ch & 0xFF; + } + else + return _filbuf(fp); + } } else { @@ -1493,11 +1522,11 @@ else version (CRuntime_Microsoft) int _fputc_nolock(int c, FILE* fp); /// int _fgetc_nolock(FILE* fp); - } /// int _fputwc_nolock(int c, FILE* fp); /// int _fgetwc_nolock(FILE* fp); + } /// void _lock_file(FILE* fp); ///