From: "wangjianjian (C)" <wangjianjian3@huawei.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Cc: "wangjianjian (C)" <wangjianjian3@huawei.com>
Subject: [PATCH 1/1] ungetc: Cast to unsigned char before push back to stream
Date: Fri, 18 Oct 2019 12:35:45 +0000 [thread overview]
Message-ID: <eb6e9ee55907488492048b07884f29a9@huawei.com> (raw)
From 4d24e6fee85ed878dc632dd29aabeb7c7454952e Mon Sep 17 00:00:00 2001
From: Wang Jianjian <wangjianjian3@huawei.com>
Date: Fri, 18 Oct 2019 20:28:29 +0800
Subject: [PATCH 1/1] ungetc: Cast to unsigned char before push back to stream
Per Posix standard, casting to unsigned char is need before returning C
and pushing C back to stream.
Signed-off-by: Wang Jianjian <wangjianjian3@huawei.com>
---
src/stdio/ungetc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/stdio/ungetc.c b/src/stdio/ungetc.c
index 180673a4..9733091a 100644
--- a/src/stdio/ungetc.c
+++ b/src/stdio/ungetc.c
@@ -12,9 +12,9 @@ int ungetc(int c, FILE *f)
return EOF;
}
- *--f->rpos = c;
+ *--f->rpos = (unsigned char)c;
f->flags &= ~F_EOF;
FUNLOCK(f);
- return c;
+ return (unsigned char)c;
}
--
2.17.1
BR,
Wang Jianjian
next reply other threads:[~2019-10-18 12:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-18 12:35 wangjianjian (C) [this message]
2019-10-18 13:11 ` Rich Felker
2019-10-19 1:18 ` Rich Felker
2019-10-18 13:15 ` Szabolcs Nagy
2019-10-20 4:29 ` 答复: [musl] " wangjianjian (C)
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=eb6e9ee55907488492048b07884f29a9@huawei.com \
--to=wangjianjian3@huawei.com \
--cc=musl@lists.openwall.com \
/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.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).