Don't use a temporary table for block positions

This also moves database functions and data structures to db.h
This commit is contained in:
ShadowNinja
2014-04-19 02:13:34 -04:00
parent 3460dabae0
commit 22d3e401f8
10 changed files with 206 additions and 199 deletions

View File

@ -32,12 +32,12 @@ std::size_t ZlibDecompressor::seekPos() const
return m_seekPos;
}
ZlibDecompressor::string ZlibDecompressor::decompress()
ustring ZlibDecompressor::decompress()
{
const unsigned char *data = m_data + m_seekPos;
const std::size_t size = m_size - m_seekPos;
string buffer;
ustring buffer;
const size_t BUFSIZE = 128 * 1024;
uint8_t temp_buffer[BUFSIZE];
@ -58,7 +58,7 @@ ZlibDecompressor::string ZlibDecompressor::decompress()
strm.avail_out = BUFSIZE;
strm.next_out = temp_buffer;
ret = inflate(&strm, Z_NO_FLUSH);
buffer += string(reinterpret_cast<unsigned char *>(temp_buffer), BUFSIZE - strm.avail_out);
buffer += ustring(reinterpret_cast<unsigned char *>(temp_buffer), BUFSIZE - strm.avail_out);
} while (ret == Z_OK);
if (ret != Z_STREAM_END) {
throw DecompressError();