mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 18:22:07 +00:00
Reformat code for better spacing, and provide a more detailed error.
This commit is contained in:
@@ -440,24 +440,30 @@ checkcodesection(SLONG size)
|
|||||||
errx(1, "Section '%s' cannot contain code or data (not a "
|
errx(1, "Section '%s' cannot contain code or data (not a "
|
||||||
"ROM0 or ROMX)", pCurrentSection->pzName);
|
"ROM0 or ROMX)", pCurrentSection->pzName);
|
||||||
}
|
}
|
||||||
if (pCurrentSection->nPC + size <= MAXSECTIONSIZE) {
|
if (pCurrentSection->nPC + size > MAXSECTIONSIZE) {
|
||||||
|
/*
|
||||||
|
* N.B.: This check is not sufficient to ensure the section
|
||||||
|
* will fit, because there can be multiple sections of this
|
||||||
|
* type. The definitive check must be done at the linking
|
||||||
|
* stage.
|
||||||
|
*/
|
||||||
|
errx(1, "Section '%s' is too big (old size %d + %d > %d)",
|
||||||
|
pCurrentSection->pzName, pCurrentSection->nPC, size,
|
||||||
|
MAXSECTIONSIZE);
|
||||||
|
}
|
||||||
if (((pCurrentSection->nPC % SECTIONCHUNK) >
|
if (((pCurrentSection->nPC % SECTIONCHUNK) >
|
||||||
((pCurrentSection->nPC + size) % SECTIONCHUNK))
|
((pCurrentSection->nPC + size) % SECTIONCHUNK)) &&
|
||||||
&& (pCurrentSection->nType == SECT_ROM0
|
(pCurrentSection->nType == SECT_ROM0 ||
|
||||||
|| pCurrentSection->nType == SECT_ROMX)) {
|
pCurrentSection->nType == SECT_ROMX)) {
|
||||||
if ((pCurrentSection->tData =
|
pCurrentSection->tData = realloc(pCurrentSection->tData,
|
||||||
(UBYTE *) realloc(pCurrentSection->tData,
|
((pCurrentSection->nPC + size) / SECTIONCHUNK + 1) *
|
||||||
((pCurrentSection->nPC +
|
SECTIONCHUNK);
|
||||||
size) / SECTIONCHUNK +
|
|
||||||
1) * SECTIONCHUNK)) != NULL) {
|
if (pCurrentSection->tData == NULL) {
|
||||||
return;
|
err(1, "Could not expand section");
|
||||||
} else
|
}
|
||||||
fatalerror
|
|
||||||
("Not enough memory to expand section");
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else
|
|
||||||
errx(1, "Section '%s' is too big", pCurrentSection->pzName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user