mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-24 12:02:08 +00:00
Add string format checking to err.h functions
And fix all problems this detected... oops
This commit is contained in:
@@ -412,7 +412,7 @@ void assign_AssignSections(void)
|
||||
/* Overlaying requires only fully-constrained sections */
|
||||
verbosePrint("Assigning other sections...\n");
|
||||
if (overlayFileName)
|
||||
errx(1, "All sections must be fixed when using an overlay file; %u %sn't",
|
||||
errx(1, "All sections must be fixed when using an overlay file; %lu %sn't",
|
||||
nbSectionsToAssign, nbSectionsToAssign == 1 ? "is" : "are");
|
||||
|
||||
/* Assign all remaining sections by decreasing constraint order */
|
||||
|
||||
@@ -226,7 +226,8 @@ static void readPatch(FILE *file, struct Patch *patch,
|
||||
|
||||
if (nbElementsRead != patch->rpnSize)
|
||||
errx(1, "%s: Cannot read \"%s\"'s patch #%u's RPN expression: %s",
|
||||
fileName, sectName, i);
|
||||
fileName, sectName, i,
|
||||
feof(file) ? "Unexpected end of file" : strerror(errno));
|
||||
patch->rpnExpression = rpnExpression;
|
||||
}
|
||||
|
||||
@@ -255,7 +256,7 @@ static void readSection(FILE *file, struct Section *section,
|
||||
fileName, section->name);
|
||||
section->isAddressFixed = tmp >= 0;
|
||||
if (tmp > UINT16_MAX)
|
||||
errx(1, "\"%s\" is too large (%d)", tmp);
|
||||
errx(1, "\"%s\"'s org' is too large (%d)", section->name, tmp);
|
||||
section->org = tmp;
|
||||
tryReadlong(tmp, file, "%s: Cannot read \"%s\"'s bank: %s",
|
||||
fileName, section->name);
|
||||
|
||||
@@ -243,7 +243,7 @@ static int32_t computeRPNExpr(struct Patch const *patch,
|
||||
struct Symbol const *symbolDefinition =
|
||||
sym_GetSymbol(symbol->name);
|
||||
if (!symbolDefinition)
|
||||
errx(1, "%s(%d): Unknown symbol \"%s\"",
|
||||
errx(1, "%s: Unknown symbol \"%s\"",
|
||||
patch->fileName, symbol->name);
|
||||
symbol = symbolDefinition;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ static void doSanityChecks(struct Section *section, void *ptr)
|
||||
/* Check if section has a chance to be placed */
|
||||
if (section->size > maxsize[section->type])
|
||||
fail("Section \"%s\" is bigger than the max size for that type: %#x > %#x",
|
||||
section->size, maxsize[section->type]);
|
||||
section->name, section->size, maxsize[section->type]);
|
||||
|
||||
/* Translate loose constraints to strong ones when they're equivalent */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user