summaryrefslogtreecommitdiff
path: root/rld-compression.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2012-12-19 16:22:37 +1100
committerChris Johns <chrisj@rtems.org>2012-12-19 16:22:37 +1100
commitb8aa7a901ddc68c20548fa194b5d17916bb6fe45 (patch)
tree245fd0195e3b7d2ffa212c4d7ed46ed8da3ec9f8 /rld-compression.h
parentf88e11c2a878be0e2babe61de2ff21bc451f03fa (diff)
Decompression support added.
The compressor can now decompress LZ77 files.
Diffstat (limited to 'rld-compression.h')
-rw-r--r--rld-compression.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/rld-compression.h b/rld-compression.h
index accc177..20a1e44 100644
--- a/rld-compression.h
+++ b/rld-compression.h
@@ -42,10 +42,12 @@ namespace rld
*
* @param image The image to read or write to.
* @param size The size of the input and output buffers.
+ * @param out The compressor is compressing.
* @param compress Set to false to disable compression.
*/
compressor (files::image& image,
size_t size,
+ bool out = true,
bool compress = true);
/**
@@ -79,6 +81,24 @@ namespace rld
void flush ();
/**
+ * Read the compressed data into the input buffer and return the section
+ * requested.
+ *
+ * @param data Write the decompressed data here.
+ * @param length The mount of data in bytes to read.
+ */
+ void read (void* data, size_t length);
+
+ /**
+ * Read the decompressed data writing it to the image.
+ *
+ * @param output The output image.
+ * @param offset The output image offset to write from.
+ * @param length The mount of data in bytes to read.
+ */
+ void read (files::image& output_, off_t offset, size_t length);
+
+ /**
* The amount of uncompressed data transferred.
*
* @param return size_t The amount of data tranferred.
@@ -101,8 +121,14 @@ namespace rld
*/
void output (bool forced = false);
+ /**
+ * Input a block of compressed data and decompress it.
+ */
+ void input ();
+
files::image& image; //< The image to read or write to or from.
size_t size; //< The size of the buffer.
+ bool out; //< If true the it is compression.
bool compress; //< If true compress the data.
uint8_t* buffer; //< The decompressed buffer
uint8_t* io; //< The I/O buffer.