Fixed a serious bug with Std_File_Reader setting unbuffered mode
parent
810d58b4fe
commit
44da1bda00
|
@ -599,8 +599,10 @@ blargg_err_t Std_File_Reader::open( const char path [] )
|
||||||
|
|
||||||
void Std_File_Reader::make_unbuffered()
|
void Std_File_Reader::make_unbuffered()
|
||||||
{
|
{
|
||||||
|
long offset = ftell( STATIC_CAST(FILE*, file_) );
|
||||||
if ( setvbuf( STATIC_CAST(FILE*, file_), NULL, _IONBF, 0 ) )
|
if ( setvbuf( STATIC_CAST(FILE*, file_), NULL, _IONBF, 0 ) )
|
||||||
check( false ); // shouldn't fail, but OK if it does
|
check( false ); // shouldn't fail, but OK if it does
|
||||||
|
fseek( STATIC_CAST(FILE*, file_), offset, SEEK_SET );
|
||||||
}
|
}
|
||||||
|
|
||||||
blargg_err_t Std_File_Reader::read_v( void* p, int s )
|
blargg_err_t Std_File_Reader::read_v( void* p, int s )
|
||||||
|
|
Loading…
Reference in New Issue