mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
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:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user