Skip to content

Commit

Permalink
rwops: Use SetFilePointerEx on Windows for appending writes.
Browse files Browse the repository at this point in the history
Fixes #7900.

(cherry picked from commit 769bf2e)
  • Loading branch information
icculus committed Jul 1, 2023
1 parent 7207f51 commit cd662ce
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/file/SDL_rwops.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,9 @@ windows_file_write(SDL_RWops *context, const void *ptr, size_t size,

/* if in append mode, we must go to the EOF before write */
if (context->hidden.windowsio.append) {
if (SetFilePointer(context->hidden.windowsio.h, 0L, NULL, FILE_END) ==
INVALID_SET_FILE_POINTER) {
LARGE_INTEGER windowsoffset;
windowsoffset.QuadPart = 0;
if (!SetFilePointerEx(context->hidden.windowsio.h, windowsoffset, &windowsoffset, FILE_END)) {
SDL_Error(SDL_EFWRITE);
return 0;
}
Expand Down

0 comments on commit cd662ce

Please sign in to comment.