File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -361,13 +361,29 @@ stdio_size(SDL_RWops * context)
361361static  Sint64  SDLCALL 
362362stdio_seek (SDL_RWops  *  context , Sint64  offset , int  whence )
363363{
364+     int  stdiowhence ;
365+ 
366+     switch  (whence ) {
367+     case  RW_SEEK_SET :
368+         stdiowhence  =  SEEK_SET ;
369+         break ;
370+     case  RW_SEEK_CUR :
371+         stdiowhence  =  SEEK_CUR ;
372+         break ;
373+     case  RW_SEEK_END :
374+         stdiowhence  =  SEEK_END ;
375+         break ;
376+     default :
377+         return  SDL_SetError ("Unknown value for 'whence'" );
378+     }
379+ 
364380#if  defined(FSEEK_OFF_MIN ) &&  defined(FSEEK_OFF_MAX )
365381    if  (offset  <  (Sint64 )(FSEEK_OFF_MIN ) ||  offset  >  (Sint64 )(FSEEK_OFF_MAX )) {
366382        return  SDL_SetError ("Seek offset out of range" );
367383    }
368384#endif 
369385
370-     if  (fseek (context -> hidden .stdio .fp , (fseek_off_t )offset , whence ) ==  0 ) {
386+     if  (fseek (context -> hidden .stdio .fp , (fseek_off_t )offset , stdiowhence ) ==  0 ) {
371387        Sint64  pos  =  ftell (context -> hidden .stdio .fp );
372388        if  (pos  <  0 ) {
373389            return  SDL_SetError ("Couldn't get stream offset" );
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments