shithub: scc

Download patch

ref: fef98680b811aac701fc7d4b7babb3d4f7993c95
parent: 590ba0dfe7a73ab2e47fe333cf700e01d9cda6e9
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Mon Oct 15 09:15:20 EDT 2018

[lib/c] Several small fixes

--- a/lib/c/memchr.c
+++ b/lib/c/memchr.c
@@ -4,7 +4,7 @@
 void *
 memchr(const void *s, int c, size_t n)
 {
-	unsigned char *bp = (unsigned char *) s;
+	const unsigned char *bp = s;
 
 	while (n > 0 && *bp++ != c)
 		--n;
--- a/lib/c/vfprintf.c
+++ b/lib/c/vfprintf.c
@@ -45,7 +45,7 @@
 
 	if (flags & CHAR) {
 		val = va_arg(*va, int);
-		uval = (unsigned char) uval;
+		uval = (unsigned char) val;
 	} else if (flags & SHORT) {
 		val = va_arg(*va, int);
 		uval = (unsigned short) val;
@@ -78,7 +78,7 @@
 numtostr(uintmax_t val, int flags, struct conv *conv, char *buf)
 {
 	char *buf0 = buf;
-	int len, base = conv->base, prec = conv->prec;
+	int base = conv->base, prec = conv->prec;
 	uintmax_t oval = val;
 
 	if (prec == -1)
@@ -197,7 +197,7 @@
 int
 vfprintf(FILE * restrict fp, const char *fmt, va_list va)
 {
-	int *p, ch, n, flags, width, left, fill, cnt = 0;
+	int ch, n, flags, width, left, fill, cnt = 0;
 	size_t inc, len;
 	char *s;
 	wchar_t *ws;