Remove ugly, brute-force Seek and GetFileSize implementations. Nothing uses them, and nothing ever should.
This commit is contained in:
@@ -13,53 +13,6 @@ void RageFileObj::SetError( const CString &err )
|
|||||||
parent.SetError( err );
|
parent.SetError( err );
|
||||||
}
|
}
|
||||||
|
|
||||||
int RageFileObj::Seek( int offset )
|
|
||||||
{
|
|
||||||
const int OldPos = parent.Tell();
|
|
||||||
if( offset < OldPos )
|
|
||||||
parent.Rewind();
|
|
||||||
else
|
|
||||||
offset -= OldPos;
|
|
||||||
|
|
||||||
char buf[1024*4];
|
|
||||||
while( offset )
|
|
||||||
{
|
|
||||||
/* Must call parent.Read: */
|
|
||||||
int got = parent.Read( buf, min( (int) sizeof(buf), offset ) );
|
|
||||||
if( got == -1 )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if( got == 0 )
|
|
||||||
break;
|
|
||||||
offset -= got;
|
|
||||||
}
|
|
||||||
|
|
||||||
return parent.Tell();
|
|
||||||
}
|
|
||||||
|
|
||||||
int RageFileObj::GetFileSize()
|
|
||||||
{
|
|
||||||
int OldPos = parent.Tell();
|
|
||||||
parent.Rewind();
|
|
||||||
char buf[256];
|
|
||||||
int ret = 0;
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
/* Must call parent.Read: */
|
|
||||||
int got = parent.Read( buf, sizeof(buf) );
|
|
||||||
if( got == -1 )
|
|
||||||
{
|
|
||||||
ret = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if( got == 0 )
|
|
||||||
break;
|
|
||||||
ret += got;
|
|
||||||
}
|
|
||||||
Seek( OldPos );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int RageFileDriver::GetPathValue( const CString &path )
|
int RageFileDriver::GetPathValue( const CString &path )
|
||||||
{
|
{
|
||||||
vector<CString> parts;
|
vector<CString> parts;
|
||||||
|
|||||||
@@ -43,8 +43,8 @@ public:
|
|||||||
|
|
||||||
// virtual CString RealPath() const { return parent->GetPath(); }
|
// virtual CString RealPath() const { return parent->GetPath(); }
|
||||||
|
|
||||||
virtual int Seek( int offset );
|
virtual int Seek( int offset ) = 0;
|
||||||
virtual int GetFileSize();
|
virtual int GetFileSize() = 0;
|
||||||
virtual CString GetDisplayPath() const { return parent.GetRealPath(); }
|
virtual CString GetDisplayPath() const { return parent.GetRealPath(); }
|
||||||
|
|
||||||
/* Raw I/O: */
|
/* Raw I/O: */
|
||||||
|
|||||||
Reference in New Issue
Block a user