simplify error check

This commit is contained in:
Glenn Maynard
2004-06-06 22:46:42 +00:00
parent 73dff7b6c7
commit 02608c5e5a
2 changed files with 3 additions and 6 deletions
+2 -5
View File
@@ -43,7 +43,7 @@ unsigned int RageFileStore::TransferTo2(BufferedTransformation &target, unsigned
if (m_waiting)
goto output;
while( size && m_file.IsGood() )
while( size && !m_file.AtEOF() )
{
{
unsigned int spaceSize = 1024;
@@ -51,7 +51,7 @@ unsigned int RageFileStore::TransferTo2(BufferedTransformation &target, unsigned
m_len = m_file.Read( (char *)m_space, STDMIN(size, (unsigned long)spaceSize));
if( m_len == -1 )
throw ReadErr();
throw ReadErr( m_file );
}
unsigned int blockedBytes;
output:
@@ -63,9 +63,6 @@ output:
transferBytes += m_len;
}
if (!m_file.IsGood() && !m_file.AtEOF())
throw ReadErr();
return 0;
}
+1 -1
View File
@@ -20,7 +20,7 @@ public:
Err(const std::string &s) : Exception(IO_ERROR, s) {}
};
class OpenErr : public Err {public: OpenErr(const std::string &filename) : Err("FileStore: error opening file for reading: " + filename) {}};
class ReadErr : public Err {public: ReadErr() : Err("FileStore: error reading file") {}};
struct ReadErr : public Err { ReadErr(const RageFile &f) : Err("RageFileStore(" + f.GetPath() + "): read error: " + f.GetError() ) {}};
RageFileStore() {}
RageFileStore(const char *filename)