shithub: rgbds

Download patch

ref: 0793e9effe02e1ccd623704412aa750063f7d46b
parent: c25b0be085b67cf4b5fec4df034786e4e603fd1a
author: ISSOtm <[email protected]>
date: Tue Jul 21 16:08:11 EDT 2020

Fix develop compilation error

This bug slipped by because my pre-commit hook for testing was broken...

--- a/src/link/patch.c
+++ b/src/link/patch.c
@@ -439,12 +439,12 @@
 			/* Target is relative to the byte *after* the operand */
 			uint16_t address = patch->pcSection->org
 							+ patch->pcOffset + 1;
-			int16_t offset = value - address;
+			int16_t jumpOffset = value - address;
 
-			if (offset < -128 || offset > 127)
+			if (jumpOffset < -128 || jumpOffset > 127)
 				error("%s: jr target out of reach (expected -129 < %" PRId16 " < 128)",
-				      patch->fileName, offset);
-			dataSection->data[offset] = offset & 0xFF;
+				      patch->fileName, jumpOffset);
+			dataSection->data[offset] = jumpOffset & 0xFF;
 		} else {
 			/* Patch a certain number of bytes */
 			struct {