Change the start position check on INCBIN

Currently INCBIN gives an error if your start position == file size.
This means you cannot include an empty file.
It also means the text of the error message is incorrect
(as the start is not greater, but equal to the length of the file)
This commit is contained in:
daid
2021-03-09 08:49:48 +01:00
committed by Eldred Habert
parent 028e7af7d1
commit cb47ac8b97

View File

@@ -774,7 +774,7 @@ void out_BinaryFile(char const *s, int32_t startPos)
if (fseek(f, 0, SEEK_END) != -1) { if (fseek(f, 0, SEEK_END) != -1) {
fsize = ftell(f); fsize = ftell(f);
if (startPos >= fsize) { if (startPos > fsize) {
error("Specified start position is greater than length of file\n"); error("Specified start position is greater than length of file\n");
fclose(f); fclose(f);
return; return;
@@ -841,7 +841,7 @@ void out_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length)
if (fseek(f, 0, SEEK_END) != -1) { if (fseek(f, 0, SEEK_END) != -1) {
fsize = ftell(f); fsize = ftell(f);
if (start_pos >= fsize) { if (start_pos > fsize) {
error("Specified start position is greater than length of file\n"); error("Specified start position is greater than length of file\n");
return; return;
} }