summaryrefslogtreecommitdiff
path: root/rld-compression.cpp
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-12-18 20:48:35 +1100
committerChris Johns <chrisj@rtems.org>2012-12-18 20:48:35 +1100
commit14bef95b10e40459e4b0e25f1639d5b08b586dee (patch)
tree49003c206595acda1c4125f1eef7530218864538 /rld-compression.cpp
parent95a89337a2148cacc461032173440c01a394422a (diff)
Update the data out pointer.
The data pointer was not updating when looping. Fix the total stats to track the data in the buffer.
Diffstat (limited to 'rld-compression.cpp')
-rw-r--r--rld-compression.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/rld-compression.cpp b/rld-compression.cpp
index 55e7a6c..b3ceb68 100644
--- a/rld-compression.cpp
+++ b/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;