Skip to content

Commit e07fadf

Browse files
fesh0rSiegeLord
authored andcommitted
prefer _fseeki64 and _ftelli64 if available
For mingw32 builds using fseeko gives an "Invalid argument" error due to conflicting definitions of off_t.
1 parent 7ac585f commit e07fadf

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/file_stdio.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ static int64_t file_stdio_ftell(ALLEGRO_FILE *f)
219219
USERDATA *userdata = get_userdata(f);
220220
int64_t ret;
221221

222-
#if defined(ALLEGRO_HAVE_FTELLO)
223-
ret = ftello(userdata->fp);
224-
#elif defined(ALLEGRO_HAVE_FTELLI64)
222+
#if defined(ALLEGRO_HAVE_FTELLI64)
225223
ret = _ftelli64(userdata->fp);
224+
#elif defined(ALLEGRO_HAVE_FTELLO)
225+
ret = ftello(userdata->fp);
226226
#else
227227
ret = ftell(userdata->fp);
228228
#endif
@@ -247,10 +247,10 @@ static bool file_stdio_fseek(ALLEGRO_FILE *f, int64_t offset,
247247
case ALLEGRO_SEEK_END: whence = SEEK_END; break;
248248
}
249249

250-
#if defined(ALLEGRO_HAVE_FSEEKO)
251-
rc = fseeko(userdata->fp, offset, whence);
252-
#elif defined(ALLEGRO_HAVE_FSEEKI64)
250+
#if defined(ALLEGRO_HAVE_FSEEKI64)
253251
rc = _fseeki64(userdata->fp, offset, whence);
252+
#elif defined(ALLEGRO_HAVE_FSEEKO)
253+
rc = fseeko(userdata->fp, offset, whence);
254254
#else
255255
rc = fseek(userdata->fp, offset, whence);
256256
#endif

0 commit comments

Comments
 (0)