public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin/main] stdio: set and test stream orientation in low-level input function __srget_r
Date: Mon, 20 Nov 2023 20:02:11 +0000 (GMT)	[thread overview]
Message-ID: <20231120200211.1B6A83858C31@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=c190063f9658153988d735a333a7a3c7aeadc001

commit c190063f9658153988d735a333a7a3c7aeadc001
Author:     Corinna Vinschen <corinna@vinschen.de>
AuthorDate: Mon Nov 20 20:47:52 2023 +0100
Commit:     Corinna Vinschen <corinna@vinschen.de>
CommitDate: Mon Nov 20 20:59:13 2023 +0100

    stdio: set and test stream orientation in low-level input function __srget_r
    
    This allows to set and test orientation correctly if input is only
    using macros from stdio.h.  Wide-char-oriented functions must call
    __srefill_r directly.
    
    Signed-off-by: Corinna Vinschen <corinna@vinschen.de>

Diff:
---
 newlib/libc/stdio/rget.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/newlib/libc/stdio/rget.c b/newlib/libc/stdio/rget.c
index a9a0d2f2f246..38e8b5dd1959 100644
--- a/newlib/libc/stdio/rget.c
+++ b/newlib/libc/stdio/rget.c
@@ -39,6 +39,11 @@ __srget_r (struct _reent *ptr,
      we call __srefill_r so we may access the true read buffer. */
   CHECK_INIT(ptr, fp);
 
+  /* Have to set and check orientation here, otherwise the macros in
+     stdio.h never set it. */
+  if (ORIENT (fp, -1) != -1)
+    return EOF;
+
   if (__srefill_r (ptr, fp) == 0)
     {
       fp->_r--;

                 reply	other threads:[~2023-11-20 20:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20231120200211.1B6A83858C31@sourceware.org \
    --to=corinna@sourceware.org \
    --cc=newlib-cvs@sourceware.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: link
Be 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).