mirror of https://github.com/libAthena/athena.git
Fix error handling
This commit is contained in:
parent
ab86e2195f
commit
64f34cc903
|
@ -57,7 +57,8 @@ void FileReader::open()
|
||||||
|
|
||||||
if (!m_fileHandle)
|
if (!m_fileHandle)
|
||||||
{
|
{
|
||||||
atError("File not found '%s'", filename());
|
std::string _filename = filename();
|
||||||
|
atError("File not found '%s'", _filename.c_str());
|
||||||
setError();
|
setError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -82,6 +83,9 @@ void FileReader::close()
|
||||||
|
|
||||||
void FileReader::seek(atInt64 pos, SeekOrigin origin)
|
void FileReader::seek(atInt64 pos, SeekOrigin origin)
|
||||||
{
|
{
|
||||||
|
if (!isOpen())
|
||||||
|
return;
|
||||||
|
|
||||||
// check block position
|
// check block position
|
||||||
if (m_blockSize > 0)
|
if (m_blockSize > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,6 +84,13 @@ void FileWriter::close()
|
||||||
|
|
||||||
void FileWriter::seek(atInt64 pos, SeekOrigin origin)
|
void FileWriter::seek(atInt64 pos, SeekOrigin origin)
|
||||||
{
|
{
|
||||||
|
if (!isOpen())
|
||||||
|
{
|
||||||
|
atError("Unable to seek in file, not open");
|
||||||
|
setError();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (fseeko64(m_fileHandle, pos, (int)origin) != 0)
|
if (fseeko64(m_fileHandle, pos, (int)origin) != 0)
|
||||||
{
|
{
|
||||||
atError("Unable to seek in file");
|
atError("Unable to seek in file");
|
||||||
|
|
Loading…
Reference in New Issue