shithub: scc

Download patch

ref: 0517d8a80bca67fca4c46dfdf4a8837b967eefbf
parent: 620493c9bdc92f1d4309f1b6bbf9c23f2000aecb
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Thu Nov 23 10:26:49 EST 2017

[lib/scc] Fix types of lpack/lunpack

The buffer pointer should be unsigned to avoid uneeded
sign extensions.

--- a/inc/scc.h
+++ b/inc/scc.h
@@ -33,5 +33,5 @@
 extern void *new(Alloc *allocp);
 extern void delete(Alloc *allocp, void *p);
 extern int casecmp(const char *s1, const char *s2);
-extern int lpack(char *dst, char *fmt, ...);
-extern int lunpack(char *src, char *fmt, ...);
+extern int lpack(unsigned char *dst, char *fmt, ...);
+extern int lunpack(unsigned char *src, char *fmt, ...);
--- a/lib/scc/lpack.c
+++ b/lib/scc/lpack.c
@@ -3,9 +3,9 @@
 #include "../../inc/scc.h"
 
 int
-lpack(char *dst, char *fmt, ...)
+lpack(unsigned char *dst, char *fmt, ...)
 {
-	char *bp;
+	unsigned char *bp;
 	unsigned s;
 	unsigned long l;
 	unsigned long long q;
--- a/lib/scc/lunpack.c
+++ b/lib/scc/lunpack.c
@@ -3,9 +3,9 @@
 #include "../../inc/scc.h"
 
 int
-lunpack(char *src, char *fmt, ...)
+lunpack(unsigned char *src, char *fmt, ...)
 {
-	char *bp, *cp;
+	unsigned char *bp, *cp;
 	unsigned short *sp;
 	unsigned s;
 	unsigned long *lp, l;