mirror of
https://github.com/gbdev/rgbds.git
synced 2026-05-08 19:09:36 +00:00
Fix two warnings on MinGW
This commit is contained in:
+16
-4
@@ -934,8 +934,14 @@ bool sect_BinaryFile(std::string const &name, uint32_t startPos) {
|
|||||||
Defer closeFile{[&] { fclose(file); }};
|
Defer closeFile{[&] { fclose(file); }};
|
||||||
|
|
||||||
if (fseek(file, 0, SEEK_END) == 0) {
|
if (fseek(file, 0, SEEK_END) == 0) {
|
||||||
if (startPos > ftell(file)) {
|
if (unsigned long fsize = ftell(file);
|
||||||
error("Specified start position is greater than length of file \"%s\"", name.c_str());
|
startPos > fsize) { // `ftell` cannot fail here, since `fseek` succeeded.
|
||||||
|
error(
|
||||||
|
"Specified start position (%" PRIu32 ") is greater than length of \"%s\" (%lu)",
|
||||||
|
startPos,
|
||||||
|
name.c_str(),
|
||||||
|
fsize
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// The file is seekable; skip to the specified start position
|
// The file is seekable; skip to the specified start position
|
||||||
@@ -989,8 +995,14 @@ bool sect_BinaryFileSlice(std::string const &name, uint32_t startPos, uint32_t l
|
|||||||
Defer closeFile{[&] { fclose(file); }};
|
Defer closeFile{[&] { fclose(file); }};
|
||||||
|
|
||||||
if (fseek(file, 0, SEEK_END) == 0) {
|
if (fseek(file, 0, SEEK_END) == 0) {
|
||||||
if (long fsize = ftell(file); startPos > fsize) {
|
if (unsigned long fsize = ftell(file);
|
||||||
error("Specified start position is greater than length of file \"%s\"", name.c_str());
|
startPos > fsize) { // `ftell` cannot fail here, since `fseek` succeeded.
|
||||||
|
error(
|
||||||
|
"Specified start position (%" PRIu32 ") is greater than length of \"%s\" (%lu)",
|
||||||
|
startPos,
|
||||||
|
name.c_str(),
|
||||||
|
fsize
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
} else if (startPos + length > fsize) {
|
} else if (startPos + length > fsize) {
|
||||||
error(
|
error(
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
error: Specified start position is greater than length of file "data.bin"
|
error: Specified start position (999) is greater than length of "data.bin" (123)
|
||||||
at incbin-start-bad.asm(3)
|
at incbin-start-bad.asm(3)
|
||||||
error: Specified start position is greater than length of file "data.bin"
|
error: Specified start position (999) is greater than length of "data.bin" (123)
|
||||||
at incbin-start-bad.asm(4)
|
at incbin-start-bad.asm(4)
|
||||||
Assembly aborted with 2 errors
|
Assembly aborted with 2 errors
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ static char *execProg(char const *name, char * const *argv) {
|
|||||||
nullptr,
|
nullptr,
|
||||||
errnum,
|
errnum,
|
||||||
0,
|
0,
|
||||||
(LPTSTR)&buf,
|
reinterpret_cast<LPTSTR>(&buf),
|
||||||
0,
|
0,
|
||||||
nullptr
|
nullptr
|
||||||
)
|
)
|
||||||
@@ -341,7 +341,8 @@ static char *execProg(char const *name, char * const *argv) {
|
|||||||
|
|
||||||
STARTUPINFOA startupInfo;
|
STARTUPINFOA startupInfo;
|
||||||
GetStartupInfoA(&startupInfo);
|
GetStartupInfoA(&startupInfo);
|
||||||
STARTUPINFOA childStartupInfo = {sizeof(startupInfo)};
|
STARTUPINFOA childStartupInfo = {};
|
||||||
|
childStartupInfo.cb = sizeof(startupInfo);
|
||||||
|
|
||||||
PROCESS_INFORMATION child;
|
PROCESS_INFORMATION child;
|
||||||
if (CreateProcessA(
|
if (CreateProcessA(
|
||||||
|
|||||||
Reference in New Issue
Block a user