error checks to trace https://sourceforge.net/tracker/index.php?func=detail&aid=1035264&group_id=37892&atid=421366
fix error message
This commit is contained in:
@@ -333,7 +333,9 @@ int RageFile::GetFileSize() const
|
|||||||
/* GetFileSize() may need to do non-const-like things--the default implementation reads
|
/* GetFileSize() may need to do non-const-like things--the default implementation reads
|
||||||
* until the end of file to emulate it. However, it should always restore the state to
|
* until the end of file to emulate it. However, it should always restore the state to
|
||||||
* the way it was, so pretend it's const. */
|
* the way it was, so pretend it's const. */
|
||||||
return const_cast<RageFileObj*>(m_File)->GetFileSize();
|
int iRet = const_cast<RageFileObj*>(m_File)->GetFileSize();
|
||||||
|
ASSERT_M( iRet >= 0, ssprintf("%i", iRet) );
|
||||||
|
return iRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RageFile::Rewind()
|
void RageFile::Rewind()
|
||||||
@@ -342,7 +344,7 @@ void RageFile::Rewind()
|
|||||||
RageException::Throw("\"%s\" is not open.", GetPath().c_str());
|
RageException::Throw("\"%s\" is not open.", GetPath().c_str());
|
||||||
|
|
||||||
if( !(m_Mode&READ) )
|
if( !(m_Mode&READ) )
|
||||||
RageException::Throw("\"%s\" is not open for reading; can't GetFileSize", GetPath().c_str());
|
RageException::Throw("\"%s\" is not open for reading; can't Rewind", GetPath().c_str());
|
||||||
|
|
||||||
m_EOF = false;
|
m_EOF = false;
|
||||||
|
|
||||||
|
|||||||
@@ -372,7 +372,9 @@ int RageFileObjDirect::Seek( int offset )
|
|||||||
int RageFileObjDirect::GetFileSize()
|
int RageFileObjDirect::GetFileSize()
|
||||||
{
|
{
|
||||||
const int OldPos = lseek( fd, 0, SEEK_CUR );
|
const int OldPos = lseek( fd, 0, SEEK_CUR );
|
||||||
|
ASSERT_M( OldPos != -1, strerror(errno) ):
|
||||||
const int ret = lseek( fd, 0, SEEK_END );
|
const int ret = lseek( fd, 0, SEEK_END );
|
||||||
|
ASSERT_M( ret!= -1, strerror(errno) ):
|
||||||
lseek( fd, OldPos, SEEK_SET );
|
lseek( fd, OldPos, SEEK_SET );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user