Skip to content

Commit

Permalink
Fix travis linux compile
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Apr 2, 2018
1 parent 8891d93 commit 6e25b33
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/RageFileDriverDirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static RageFileObjDirect *MakeFileObjDirect( RString sPath, int iMode, int &iErr
int iFD;
if( (iMode & RageFile::READ) != 0 )
{
iFD = _open( sPath, O_BINARY|O_RDONLY, 0666 );
iFD = open( sPath, O_BINARY|O_RDONLY, 0666 );

/* XXX: Windows returns EACCES if we try to open a file on a CDROM that isn't
* ready, instead of something like ENODEV. We want to return that case as
Expand All @@ -72,7 +72,7 @@ static RageFileObjDirect *MakeFileObjDirect( RString sPath, int iMode, int &iErr
sOut = MakeTempFilename(sPath);

/* Open a temporary file for writing. */
iFD = _open( sOut, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0666 );
iFD = open( sOut, O_BINARY|O_WRONLY|O_CREAT|O_TRUNC, 0666 );
}

if( iFD == -1 )
Expand Down Expand Up @@ -161,7 +161,7 @@ bool RageFileDriverDirect::Remove( const RString &sPath_ )

case RageFileManager::TYPE_DIR:
TRACE( ssprintf("rmdir '%s'", (m_sRoot + sPath).c_str()) );
if( _rmdir(m_sRoot + sPath) == -1 )
if( rmdir(m_sRoot + sPath) == -1 )
{
WARN( ssprintf("rmdir(%s) failed: %s", (m_sRoot + sPath).c_str(), strerror(errno)) );
return false;
Expand All @@ -185,7 +185,7 @@ RageFileObjDirect *RageFileObjDirect::Copy() const
if( ret == NULL )
RageException::Throw( "Couldn't reopen \"%s\": %s", m_sPath.c_str(), strerror(iErr) );

ret->Seek( static_cast<int>(_lseek( m_iFD, 0, SEEK_CUR )) );
ret->Seek( static_cast<int>(lseek( m_iFD, 0, SEEK_CUR )) );

return ret;
}
Expand Down Expand Up @@ -300,7 +300,7 @@ RageFileObjDirect::~RageFileObjDirect()

if( m_iFD != -1 )
{
if( _close( m_iFD ) == -1 )
if( close( m_iFD ) == -1 )
{
WARN( ssprintf("Error closing %s: %s", this->m_sPath.c_str(), strerror(errno)) );
SetError( strerror(errno) );
Expand Down Expand Up @@ -369,7 +369,7 @@ RageFileObjDirect::~RageFileObjDirect()

int RageFileObjDirect::ReadInternal( void *pBuf, size_t iBytes )
{
int iRet = _read( m_iFD, pBuf, iBytes );
int iRet = read( m_iFD, pBuf, iBytes );
if( iRet == -1 )
{
SetError( strerror(errno) );
Expand All @@ -385,7 +385,7 @@ static int RetriedWrite( int iFD, const void *pBuf, size_t iCount )
int iTries = 3, iRet;
do
{
iRet = _write( iFD, pBuf, iCount );
iRet = write( iFD, pBuf, iCount );
}
while( iRet == -1 && errno == EINTR && iTries-- );

Expand Down Expand Up @@ -426,16 +426,16 @@ int RageFileObjDirect::WriteInternal( const void *pBuf, size_t iBytes )

int RageFileObjDirect::SeekInternal( int iOffset )
{
return static_cast<int>(_lseek( m_iFD, iOffset, SEEK_SET ));
return static_cast<int>(lseek( m_iFD, iOffset, SEEK_SET ));
}

int RageFileObjDirect::GetFileSize() const
{
const long iOldPos = _lseek( m_iFD, 0, SEEK_CUR );
const long iOldPos = lseek( m_iFD, 0, SEEK_CUR );
ASSERT_M( iOldPos != -1, ssprintf("\"%s\": %s", m_sPath.c_str(), strerror(errno)) );
const int iRet = static_cast<int>(_lseek( m_iFD, 0, SEEK_END ));
const int iRet = static_cast<int>(lseek( m_iFD, 0, SEEK_END ));
ASSERT_M( iRet != -1, ssprintf("\"%s\": %s", m_sPath.c_str(), strerror(errno)) );
_lseek( m_iFD, iOldPos, SEEK_SET );
lseek( m_iFD, iOldPos, SEEK_SET );
return iRet;
}

Expand Down

0 comments on commit 6e25b33

Please sign in to comment.