protected:
virtual bool rawOpen(const std::string &filename, File::Mode mode);
virtual bool rawWrite(const void *buffer, size_t length);
- virtual bool rawRead(void *buffer, size_t length);
+ virtual size_t rawRead(void *buffer, size_t length);
virtual int rawGetc();
virtual void rawClose();
virtual void rawFlush();
SnappyFile::~SnappyFile()
{
+ close();
delete [] m_compressedCache;
delete [] m_cache;
}
return true;
}
-bool SnappyFile::rawRead(void *buffer, size_t length)
+size_t SnappyFile::rawRead(void *buffer, size_t length)
{
if (endOfData()) {
- return false;
+ return 0;
}
if (freeCacheSize() >= length) {
flushReadCache();
}
if (!m_cacheSize) {
- break;
+ return length - sizeToRead;
}
}
}
- return true;
+ return length;
}
int SnappyFile::rawGetc()
{
- int c = 0;
- if (!rawRead(&c, 1))
+ unsigned char c = 0;
+ if (rawRead(&c, 1) != 1)
return -1;
return c;
}