shithub: rgbds

Download patch

ref: dd8f396227fafbfad52002f9eef9e8ff8ae8c4a0
parent: b60853ea2184cef66faed4505838e6fa163e4fe0
author: ISSOtm <eldredhabert0@gmail.com>
date: Fri Apr 23 11:12:44 EDT 2021

Fix compiler warnings

As reported in #789

--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -674,8 +674,8 @@
 		report("FATAL: Failed to read \"%s\"'s header: %s\n", name, strerror(errno));
 		return;
 	} else if (rom0Len < 0x150) {
-		report("FATAL: \"%s\" too short, expected at least 336 ($150) bytes, got only %ld\n",
-		       name, rom0Len);
+		report("FATAL: \"%s\" too short, expected at least 336 ($150) bytes, got only %jd\n",
+		       name, (intmax_t)rom0Len);
 		return;
 	}
 	// Accept partial reads if the file contains at least the header
@@ -863,8 +863,8 @@
 		report("FATAL: Failed to write \"%s\"'s ROM0: %s\n", name, strerror(errno));
 		goto free_romx;
 	} else if (writeLen < rom0Len) {
-		report("FATAL: Could only write %ld of \"%s\"'s %ld ROM0 bytes\n",
-		       writeLen, name, rom0Len);
+		report("FATAL: Could only write %jd of \"%s\"'s %jd ROM0 bytes\n",
+		       (intmax_t)writeLen, name, (intmax_t)rom0Len);
 		goto free_romx;
 	}
 
@@ -877,8 +877,8 @@
 			report("FATAL: Failed to write \"%s\"'s ROMX: %s\n", name, strerror(errno));
 			goto free_romx;
 		} else if ((size_t)writeLen < totalRomxLen) {
-			report("FATAL: Could only write %ld of \"%s\"'s %ld ROMX bytes\n",
-			       writeLen, name, totalRomxLen);
+			report("FATAL: Could only write %jd of \"%s\"'s %zu ROMX bytes\n",
+			       (intmax_t)writeLen, name, totalRomxLen);
 			goto free_romx;
 		}
 	}
@@ -949,8 +949,8 @@
 		} else if (stat.st_size < 0x150) {
 			// This check is in theory redundant with the one in `processFile`, but it
 			// prevents passing a file size of 0, which usually indicates pipes
-			report("FATAL: \"%s\" too short, expected at least 336 ($150) bytes, got only %ld\n",
-			       name, stat.st_size);
+			report("FATAL: \"%s\" too short, expected at least 336 ($150) bytes, got only %jd\n",
+			       name, (intmax_t)stat.st_size);
 		} else {
 			processFile(input, input, name, stat.st_size);
 		}