shithub: rgbds

Download patch

ref: 43fd1ee02414c098dd3a2f9d1cd767029522d517
parent: d61a0a8a8f3d505bd5c3064260e2d564db6aa044
author: AntonioND <[email protected]>
date: Sun Apr 2 13:07:25 EDT 2017

Fix some signed/unsigned comparison warnings

Signed-off-by: AntonioND <[email protected]>

--- a/src/asm/charmap.c
+++ b/src/asm/charmap.c
@@ -107,7 +107,8 @@
 int
 charmap_Add(char *input, UBYTE output)
 {
-	int i, input_length;
+	int i;
+	size_t input_length;
 	char temp1i[CHARMAPLENGTH + 1], temp2i[CHARMAPLENGTH + 1], temp1o = 0,
 	    temp2o = 0;
 
--- a/src/asm/lexer.c
+++ b/src/asm/lexer.c
@@ -435,7 +435,7 @@
 size_t
 CopyMacroArg(char *dest, size_t maxLength, char c)
 {
-	int i;
+	size_t i;
 	char *s;
 	int argNum;
 	
--- a/src/asm/symbol.c
+++ b/src/asm/symbol.c
@@ -378,8 +378,9 @@
 	if (i == -1)
 		i = MAXMACROARGS + 1;
 
-	assert(i-1 >= 0 &&
-	    i-1 < sizeof currentmacroargs / sizeof *currentmacroargs);
+	assert(i-1 >= 0);
+	assert((size_t)(i-1) < sizeof(currentmacroargs)/sizeof(*currentmacroargs));
+
 	return (currentmacroargs[i - 1]);
 }
 
--- a/src/link/library.c
+++ b/src/link/library.c
@@ -15,7 +15,7 @@
 	pSect = pSections;
 
 	while (pSect) {
-		ULONG i;
+		int i;
 
 		for (i = 0; i < pSect->nNumberOfSymbols; i += 1) {
 			if ((pSect->tSymbols[i]->Type == SYM_EXPORT)
@@ -39,7 +39,7 @@
 	ppLSect = &pLibSections;
 
 	while (*ppLSect) {
-		ULONG i;
+		int i;
 
 		for (i = 0; i < (*ppLSect)->nNumberOfSymbols; i += 1) {
 			if (((*ppLSect)->tSymbols[i]->Type == SYM_EXPORT)
@@ -101,7 +101,7 @@
 	pSect = pSections;
 
 	while (pSect) {
-		ULONG i;
+		int i;
 
 		for (i = 0; i < pSect->nNumberOfSymbols; i += 1) {
 			if ((pSect->tSymbols[i]->Type == SYM_IMPORT)
--- a/src/link/object.c
+++ b/src/link/object.c
@@ -60,7 +60,7 @@
 SLONG
 readasciiz(char **dest, FILE *f)
 {
-	SLONG r = 0;
+	size_t r = 0;
 	
 	size_t bufferLength = 16;
 	char *start = malloc(bufferLength);