Fix sign bug

Prevent blockSize from exceeding file's length
This commit is contained in:
2015-07-09 20:46:30 -07:00
parent a7c180db00
commit 8d3524b1f6
2 changed files with 9 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ namespace io
class FileReader : public IStreamReader
{
public:
FileReader(const std::string& filename, atUint32 cacheSize = (32 * 1024));
FileReader(const std::string& filename, atInt32 cacheSize = (32 * 1024));
virtual ~FileReader();
inline const std::string& filename() const
{return m_filename;}
@@ -27,12 +27,12 @@ public:
atUint64 length() const;
atUint64 readUBytesToBuf(void* buf, atUint64 len);
void setCacheSize(const atUint32 blockSize);
void setCacheSize(const atInt32 blockSize);
protected:
std::string m_filename;
FILE* m_fileHandle;
std::unique_ptr<atUint8[]> m_cacheData;
atUint32 m_blockSize;
atInt32 m_blockSize;
atInt32 m_curBlock;
atUint64 m_offset;
};