Return 1 from SetPosition(n) on success, 0 on seek past EOF, not

"the position seeked to".  This fixes a special case: SetPosition(n)
returning 0 was EOF except when SetPosition(0).  The returned value
on success was always n, anyway; we never seek to a different position
and return success.
This commit is contained in:
Glenn Maynard
2006-12-21 05:07:49 +00:00
parent ea7e48e08e
commit aa4be6dffb
6 changed files with 15 additions and 18 deletions
+3 -4
View File
@@ -152,7 +152,7 @@ class RageSoundReader_Silence: public RageSoundReader
public:
int GetLength() const { return 0; }
int GetLength_Fast() const { return 0; }
int SetPosition( int iFrame ) { return 0; }
int SetPosition( int iFrame ) { return 1; }
int Read( char *buf, int iFrames ) { return 0; }
RageSoundReader *Copy() const { return new RageSoundReader_Silence; }
int GetSampleRate() const { return 44100; }
@@ -754,10 +754,9 @@ bool RageSound::SetPositionFrames( int iFrames )
m_iStoppedSourceFrame = iFrames;
}
if( iRet == 0 && iFrames != 0 )
if( iRet == 0 )
{
/* We were told to seek somewhere, and we got 0 instead, which means
* we passed EOF. This could be a truncated file or invalid data. */
/* Seeked past EOF. */
LOG->Warn( "SetPositionFrames: %i samples is beyond EOF in %s",
iFrames, GetLoadedFilePath().c_str() );