summaryrefslogtreecommitdiff
path: root/linkers/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
commitdb216fec03f2252de4fa85e6808432690169e7d0 (patch)
tree20cc6ce13fb990edc059445c3f7a3090329668c7 /linkers/rld-compression.h
parentb2b811cbc702a3b761f51a63af5f2e0db0aa0d14 (diff)
Decompression support added.
The compressor can now decompress LZ77 files.
Diffstat (limited to '')
-rw-r--r--linkers/rld-compression.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/linkers/rld-compression.h b/linkers/rld-compression.h
index accc177..20a1e44 100644
--- a/linkers/rld-compression.h
+++ b/linkers/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.