mirror of
https://github.com/gbdev/rgbds.git
synced 2026-08-25 16:24:36 +00:00
Encapsulate fseek+ftell idiom in seekSize
This allows a single check for the return value of `seekSize` to verify all three `fseek`+`ftell`+`fseek` calls.
This commit is contained in:
+3
-6
@@ -112,16 +112,13 @@ static uint32_t checkOverlaySize() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (fseek(overlayFile, 0, SEEK_END) != 0) {
|
||||
long overlaySize = seekSize(overlayFile);
|
||||
|
||||
if (overlaySize == -1) {
|
||||
warnx("Overlay file is not seekable, cannot check if properly formed");
|
||||
return 0;
|
||||
}
|
||||
|
||||
long overlaySize = ftell(overlayFile);
|
||||
|
||||
// Reset back to beginning
|
||||
fseek(overlayFile, 0, SEEK_SET);
|
||||
|
||||
if (overlaySize % BANK_SIZE) {
|
||||
warnx("Overlay file does not have a size multiple of 0x4000");
|
||||
} else if (options.is32kMode && overlaySize != 0x8000) {
|
||||
|
||||
Reference in New Issue
Block a user