From 194160c9a365cf963ae090adecf012f73a7592a7 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Tue, 18 Dec 2012 20:48:35 +1100 Subject: [PATCH] Update the data out pointer. The data pointer was not updating when looping. Fix the total stats to track the data in the buffer. --- linkers/rld-compression.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/linkers/rld-compression.cpp b/linkers/rld-compression.cpp index 55e7a6c..b3ceb68 100644 --- a/linkers/rld-compression.cpp +++ b/linkers/rld-compression.cpp @@ -83,8 +83,10 @@ namespace rld ::memcpy ((void*) (buffer + level), data, appending); + data += appending; level += appending; length -= appending; + total += appending; output (); } @@ -108,6 +110,7 @@ namespace rld level += appending; length -= appending; + total += appending; output (); } @@ -136,13 +139,15 @@ namespace rld { if ((forced && level) || (level >= size)) { - total += level; - if (compress) { int writing = ::fastlz_compress (buffer, level, io); 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[1] = writing;