Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/io/SDL_iostream.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,6 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size,
DWORD error = GetLastError();
switch (error) {
case ERROR_BROKEN_PIPE:
case ERROR_HANDLE_EOF:
*status = SDL_IO_STATUS_EOF;
break;
case ERROR_NO_DATA:
Expand All @@ -231,6 +230,8 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size,
break;
}
return 0; // !!! FIXME: this should return the bytes read from any readahead we finished out before this (the `iodata->left > 0` code above). In that case, fail on the next read.
} else if (bytes == 0) {
*status = SDL_IO_STATUS_EOF;
}
read_ahead = SDL_min(total_need, bytes);
SDL_memcpy(ptr, iodata->data, read_ahead);
Expand All @@ -242,7 +243,6 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size,
DWORD error = GetLastError();
switch (error) {
case ERROR_BROKEN_PIPE:
case ERROR_HANDLE_EOF:
*status = SDL_IO_STATUS_EOF;
break;
case ERROR_NO_DATA:
Expand All @@ -254,6 +254,8 @@ static size_t SDLCALL windows_file_read(void *userdata, void *ptr, size_t size,
break;
}
return 0; // !!! FIXME: this should return the bytes read from any readahead we finished out before this (the `iodata->left > 0` code above). In that case, fail on the next read.
} else if (bytes == 0) {
*status = SDL_IO_STATUS_EOF;
}
total_read += bytes;
}
Expand Down
Loading