File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -75,17 +75,17 @@ void DirkSimple_writelog(const char *str)
7575
7676static long DirkSimple_rwops_read (DirkSimple_Io * io , void * buf , long buflen )
7777{
78- return (long ) /* FIXME MIGRATION: double-check if you use the returned value of SDL_RWread() */
79- SDL_ReadIO ((SDL_IOStream * ) io -> userdata , buf , buflen );
78+ SDL_IOStream * stream = (SDL_IOStream * ) io -> userdata ;
79+ const size_t br = SDL_ReadIO (stream , buf , buflen );
80+ if ((br == 0 ) && (SDL_GetIOStatus (stream ) != SDL_IO_STATUS_EOF )) {
81+ return -1 ;
82+ }
83+ return (long ) br ;
8084}
8185
8286static long DirkSimple_rwops_streamlen (DirkSimple_Io * io )
8387{
84- SDL_IOStream * rwops = (SDL_IOStream * ) io -> userdata ;
85- const Sint64 origpos = SDL_TellIO (rwops );
86- const long retval = (long ) SDL_SeekIO (rwops , 0 , SDL_IO_SEEK_END );
87- SDL_SeekIO (rwops , origpos , SDL_IO_SEEK_SET );
88- return retval ;
88+ return (long ) SDL_GetIOSize ((SDL_IOStream * ) io -> userdata );
8989}
9090
9191static int DirkSimple_rwops_seek (DirkSimple_Io * io , long absolute_offset )
You can’t perform that action at this time.
0 commit comments