diff --git a/stepmania/src/CryptHelpers.cpp b/stepmania/src/CryptHelpers.cpp index 5d73e5e99a..4e4685ef33 100644 --- a/stepmania/src/CryptHelpers.cpp +++ b/stepmania/src/CryptHelpers.cpp @@ -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; } diff --git a/stepmania/src/CryptHelpers.h b/stepmania/src/CryptHelpers.h index 106b201d13..f062056b30 100644 --- a/stepmania/src/CryptHelpers.h +++ b/stepmania/src/CryptHelpers.h @@ -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)