Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/common/lib/libc/string Cast the fill value to unsigned char ...
details: https://anonhg.NetBSD.org/src/rev/963fbc8d2513
branches: trunk
changeset: 378562:963fbc8d2513
user: simonb <simonb%NetBSD.org@localhost>
date: Sat Apr 17 06:02:35 2021 +0000
description:
Cast the fill value to unsigned char so that the "fill" value used for
full-word fills isn't garbage.
diffstat:
common/lib/libc/string/memset2.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r 286e675e71cd -r 963fbc8d2513 common/lib/libc/string/memset2.c
--- a/common/lib/libc/string/memset2.c Sat Apr 17 05:57:11 2021 +0000
+++ b/common/lib/libc/string/memset2.c Sat Apr 17 06:02:35 2021 +0000
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: memset2.c,v 1.6 2021/04/17 05:57:11 simonb Exp $");
+__RCSID("$NetBSD: memset2.c,v 1.7 2021/04/17 06:02:35 simonb Exp $");
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -97,7 +97,7 @@ memset(void *addr, int c, size_t len)
* The conditional at the end prevents GCC from complaing about
* shift count >= width of type
*/
- fill = c;
+ fill = (unsigned char)c;
fill |= fill << 8;
fill |= fill << 16;
fill |= fill << (sizeof(c) < sizeof(fill) ? 32 : 0);
Home |
Main Index |
Thread Index |
Old Index