shithub: rgbds

Download patch

ref: b04e71ed34cbbd9cb15f79cd20ba787438e6bcfb
parent: f82603f196547a41727dbfce055adc013e20b62b
author: ISSOtm <[email protected]>
date: Sat Nov 6 21:23:06 EDT 2021

Use correct length type for `Abs*Group`

--- a/include/asm/section.h
+++ b/include/asm/section.h
@@ -61,9 +61,9 @@
 void sect_CheckUnionClosed(void);
 
 void sect_AbsByte(uint8_t b);
-void sect_AbsByteGroup(uint8_t const *s, uint32_t length);
-void sect_AbsWordGroup(uint8_t const *s, uint32_t length);
-void sect_AbsLongGroup(uint8_t const *s, uint32_t length);
+void sect_AbsByteGroup(uint8_t const *s, size_t length);
+void sect_AbsWordGroup(uint8_t const *s, size_t length);
+void sect_AbsLongGroup(uint8_t const *s, size_t length);
 void sect_Skip(uint32_t skip, bool ds);
 void sect_String(char const *s);
 void sect_RelByte(struct Expression *expr, uint32_t pcShift);
--- a/src/asm/parser.y
+++ b/src/asm/parser.y
@@ -1344,7 +1344,7 @@
 		}
 		| string {
 			uint8_t *output = malloc(strlen($1)); /* Cannot be larger than that */
-			uint32_t length = charmap_Convert($1, output);
+			size_t length = charmap_Convert($1, output);
 
 			sect_AbsByteGroup(output, length);
 			free(output);
@@ -1360,7 +1360,7 @@
 		}
 		| string {
 			uint8_t *output = malloc(strlen($1)); /* Cannot be larger than that */
-			uint32_t length = charmap_Convert($1, output);
+			size_t length = charmap_Convert($1, output);
 
 			sect_AbsWordGroup(output, length);
 			free(output);
@@ -1377,7 +1377,7 @@
 		| string {
 			// Charmaps cannot increase the length of a string
 			uint8_t *output = malloc(strlen($1));
-			uint32_t length = charmap_Convert($1, output);
+			size_t length = charmap_Convert($1, output);
 
 			sect_AbsLongGroup(output, length);
 			free(output);
--- a/src/asm/section.c
+++ b/src/asm/section.c
@@ -628,7 +628,7 @@
 	writebyte(b);
 }
 
-void sect_AbsByteGroup(uint8_t const *s, uint32_t length)
+void sect_AbsByteGroup(uint8_t const *s, size_t length)
 {
 	if (!checkcodesection())
 		return;
@@ -639,7 +639,7 @@
 		writebyte(*s++);
 }
 
-void sect_AbsWordGroup(uint8_t const *s, uint32_t length)
+void sect_AbsWordGroup(uint8_t const *s, size_t length)
 {
 	if (!checkcodesection())
 		return;
@@ -650,7 +650,7 @@
 		writeword(*s++);
 }
 
-void sect_AbsLongGroup(uint8_t const *s, uint32_t length)
+void sect_AbsLongGroup(uint8_t const *s, size_t length)
 {
 	if (!checkcodesection())
 		return;