shithub: rgbds

Download patch

ref: 630933b14845e0890cf449a22ca1be6687a6f241
parent: e8a16c6f532864886f96684c57f4f211d0126607
author: Antonio Niño Díaz <[email protected]>
date: Sun Apr 22 17:02:08 EDT 2018

rgbfix: Fix checkpatch issues

Signed-off-by: Antonio Niño Díaz <[email protected]>

--- a/src/fix/main.c
+++ b/src/fix/main.c
@@ -213,9 +213,11 @@
 	 */
 
 	uint8_t header[0x50];
+
 	if (fseek(rom, 0x100, SEEK_SET) != 0)
 		err(1, "Could not locate ROM header");
-	if (fread(header, sizeof(uint8_t), sizeof header, rom) != sizeof header)
+	if (fread(header, sizeof(uint8_t), sizeof(header), rom)
+	    != sizeof(header))
 		err(1, "Could not read ROM header");
 
 	if (fixlogo || trashlogo) {
@@ -240,11 +242,12 @@
 			0xDD, 0xDC, 0x99, 0x9F, 0xBB, 0xB9, 0x33, 0x3E
 		};
 
-		if (trashlogo)
+		if (trashlogo) {
 			for (int i = 0; i < sizeof(ninlogo); i++)
 				ninlogo[i] = ~ninlogo[i];
+		}
 
-		memcpy(header + 0x04, ninlogo, sizeof ninlogo);
+		memcpy(header + 0x04, ninlogo, sizeof(ninlogo));
 	}
 
 	if (settitle) {
@@ -363,8 +366,11 @@
 
 		if (fseek(rom, 0, SEEK_END) != 0)
 			err(1, "Could not pad ROM file");
-		if ((romsize = ftell(rom)) == -1)
+
+		romsize = ftell(rom);
+		if (romsize == -1)
 			err(1, "Could not pad ROM file");
+
 		newsize = 0x8000;
 
 		headbyte = 0;
@@ -454,7 +460,8 @@
 	if (fseek(rom, 0x100, SEEK_SET) != 0)
 		err(1, "Could not locate header for writing");
 
-	if (fwrite(header, sizeof(uint8_t), sizeof header, rom) != sizeof header)
+	if (fwrite(header, sizeof(uint8_t), sizeof(header), rom)
+	    != sizeof(header))
 		err(1, "Could not write modified ROM header");
 
 	if (fixglobalsum || trashglobalsum) {
@@ -469,6 +476,7 @@
 
 		int i = 0;
 		int byte;
+
 		while ((byte = fgetc(rom)) != EOF) {
 			i++;
 			if (i != 0x150)