fix for vector readers

This commit is contained in:
Jack Andersen 2015-06-18 19:33:46 -10:00
parent 7b1b027192
commit fd3db3e1db
3 changed files with 13 additions and 7 deletions

View File

@ -1,7 +1,7 @@
# PKGBUILD for libAthena
_pkgname=libathena
pkgname=$_pkgname-git
pkgver=1.1.0.17.gfb722a9
pkgver=1.1.0.34.g7b1b027
pkgrel=1
pkgdesc="Basic cross platform IO library"
arch=('i686' 'x86_64')

View File

@ -303,11 +303,11 @@ bool FileReader::readBool()
atVec3f FileReader::readVec3f()
{
atVec3f val = {};
if (!isOpen())
THROW_INVALID_OPERATION_EXCEPTION_RETURN({}, "File not open for reading");
THROW_INVALID_OPERATION_EXCEPTION_RETURN(val, "File not open for reading");
m_bitValid = false;
atVec3f val = {};
fread(&val, 1, 12, m_fileHandle);
if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian()))
@ -322,11 +322,11 @@ atVec3f FileReader::readVec3f()
atVec4f FileReader::readVec4f()
{
atVec4f val = {};
if (!isOpen())
THROW_INVALID_OPERATION_EXCEPTION_RETURN({}, "File not open for reading");
THROW_INVALID_OPERATION_EXCEPTION_RETURN(val, "File not open for reading");
m_bitValid = false;
atVec4f val = {};
fread(&val, 1, 16, m_fileHandle);
if ((!utility::isSystemBigEndian() && isBigEndian()) || (utility::isSystemBigEndian() && isLittleEndian()))

View File

@ -431,7 +431,10 @@ atVec3f MemoryReader::readVec3f()
}
if (m_position + 12 > m_length)
THROW_IO_EXCEPTION_RETURN({}, "Position %0.8X outside stream bounds ", m_position);
{
atVec3f zero = {};
THROW_IO_EXCEPTION_RETURN(zero, "Position %0.8X outside stream bounds ", m_position);
}
float* source = (float*)(m_data + m_position);
atVec3f result = {source[0], source[1], source[2]};
@ -464,7 +467,10 @@ atVec4f MemoryReader::readVec4f()
}
if (m_position + 16 > m_length)
THROW_IO_EXCEPTION_RETURN({}, "Position %0.8X outside stream bounds ", m_position);
{
atVec4f zero = {};
THROW_IO_EXCEPTION_RETURN(zero, "Position %0.8X outside stream bounds ", m_position);
}
float* source = (float*)(m_data + m_position);
atVec4f result = {source[0], source[1], source[2], source[3]};