Update the data out pointer.

The data pointer was not updating when looping.

Fix the total stats to track the data in the buffer.
This commit is contained in:
Chris Johns 2012-12-18 20:48:35 +11:00
parent 13b9f2b1d7
commit 194160c9a3

View File

@ -83,8 +83,10 @@ namespace rld
::memcpy ((void*) (buffer + level), data, appending); ::memcpy ((void*) (buffer + level), data, appending);
data += appending;
level += appending; level += appending;
length -= appending; length -= appending;
total += appending;
output (); output ();
} }
@ -108,6 +110,7 @@ namespace rld
level += appending; level += appending;
length -= appending; length -= appending;
total += appending;
output (); output ();
} }
@ -136,13 +139,15 @@ namespace rld
{ {
if ((forced && level) || (level >= size)) if ((forced && level) || (level >= size))
{ {
total += level;
if (compress) if (compress)
{ {
int writing = ::fastlz_compress (buffer, level, io); int writing = ::fastlz_compress (buffer, level, io);
uint8_t header[2]; uint8_t header[2];
if (rld::verbose () >= RLD_VERBOSE_FULL_DEBUG)
std::cout << "rtl: comp: offset=" << total_compressed
<< " block-size=" << writing << std::endl;
header[0] = writing >> 8; header[0] = writing >> 8;
header[1] = writing; header[1] = writing;