public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain Buclaw <ibuclaw@gcc.gnu.org> 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 Date: Sun, 11 Apr 2021 18:58:34 +0000 (GMT) [thread overview] Message-ID: <20210411185834.AB3DD3857818@sourceware.org> (raw) https://gcc.gnu.org/g:6724c01a716b8bf5efaf6a42148cc6f9ea6807f2 commit 6724c01a716b8bf5efaf6a42148cc6f9ea6807f2 Author: Iain Buclaw <ibuclaw@gdcproject.org> 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); ///
next reply other threads:[~2021-04-11 18:58 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-04-11 18:58 Iain Buclaw [this message] 2021-04-13 20:42 Iain Buclaw 2021-04-16 1:04 Iain Buclaw 2021-04-17 20:43 Iain Buclaw
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210411185834.AB3DD3857818@sourceware.org \ --to=ibuclaw@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).