RageFile::GetFileSize() const

This commit is contained in:
Glenn Maynard
2004-02-17 21:42:06 +00:00
parent 8a6c2cd486
commit 4af86cda13
2 changed files with 6 additions and 3 deletions
+5 -2
View File
@@ -319,7 +319,7 @@ int RageFile::SeekCur( int offset )
return m_FilePos;
}
int RageFile::GetFileSize()
int RageFile::GetFileSize() const
{
if( !IsOpen() )
RageException::Throw("\"%s\" is not open.", GetPath().c_str());
@@ -327,7 +327,10 @@ int RageFile::GetFileSize()
if( !(m_Mode&READ) )
RageException::Throw("\"%s\" is not open for reading; can't GetFileSize", GetPath().c_str());
return m_File->GetFileSize();
/* 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
* the way it was, so pretend it's const. */
return const_cast<RageFileObj*>(m_File)->GetFileSize();
}
void RageFile::Rewind()