mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH V2 1/1] ungetc: Cast to unsigned char before returning
@ 2019-10-20  4:43 wangjianjian (C)
  0 siblings, 0 replies; only message in thread
From: wangjianjian (C) @ 2019-10-20  4:43 UTC (permalink / raw)
  To: musl

Per Posix and ISO-C standard, casting to unsigned char is needed before
returning.

Signed-off-by: Wang Jianjian <wangjianjian3@huawei.com>
---
 src/stdio/ungetc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/stdio/ungetc.c b/src/stdio/ungetc.c
index 180673a4..bc629d4c 100644
--- a/src/stdio/ungetc.c
+++ b/src/stdio/ungetc.c
@@ -16,5 +16,5 @@ int ungetc(int c, FILE *f)
        f->flags &= ~F_EOF;

        FUNLOCK(f);
-       return c;
+       return (unsigned char)c;
 }
--
2.17.1

BR,
Wang Jianjian




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-20  4:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-20  4:43 [PATCH V2 1/1] ungetc: Cast to unsigned char before returning wangjianjian (C)

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).