Win32: Don't access FILE::_file, use _fileno() instead

It has always been ugly to do that with and MSVC2015 doesn't seem to
work at all.
This commit is contained in:
Daniel Gibson 2015-10-11 23:32:31 +02:00
parent c86e394da5
commit 9958e3807c

View file

@ -3368,7 +3368,7 @@ size_t idFileSystemLocal::CurlWriteFunction( void *ptr, size_t size, size_t nmem
return size * nmemb;
}
#ifdef _WIN32
return _write( static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()->_file, ptr, size * nmemb );
return _write( _fileno(static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()), ptr, size * nmemb );
#else
return fwrite( ptr, size, nmemb, static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr() );
#endif
@ -3416,7 +3416,7 @@ int BackgroundDownloadThread( void *pexit ) {
if ( bgl->opcode == DLTYPE_FILE ) {
// use the low level read function, because fread may allocate memory
#if defined(WIN32)
_read( static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()->_file, bgl->file.buffer, bgl->file.length );
_read( _fileno(static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr()), bgl->file.buffer, bgl->file.length );
#else
fread( bgl->file.buffer, bgl->file.length, 1, static_cast<idFile_Permanent*>(bgl->f)->GetFilePtr() );
#endif