summaryrefslogtreecommitdiffstats
path: root/decoder.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 09:31:27 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 09:31:27 +0000
commitcf8ea9129f6b44e25b06d81523234f7036462ed4 (patch)
tree9bc87ee0802620ef7df254b09a03916afb2e3e52 /decoder.h
parentAdding debian version 1.13~rc1-1. (diff)
downloadlzip-cf8ea9129f6b44e25b06d81523234f7036462ed4.tar.xz
lzip-cf8ea9129f6b44e25b06d81523234f7036462ed4.zip
Merging upstream version 1.13~rc2.
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to '')
-rw-r--r--decoder.h23
1 files changed, 21 insertions, 2 deletions
diff --git a/decoder.h b/decoder.h
index a974b33..ad3ff7c 100644
--- a/decoder.h
+++ b/decoder.h
@@ -1,5 +1,5 @@
/* Lzip - Data compressor based on the LZMA algorithm
- Copyright (C) 2008, 2009, 2010, 2011 Antonio Diaz Diaz.
+ Copyright (C) 2008, 2009, 2010, 2011, 2012 Antonio Diaz Diaz.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -29,8 +29,11 @@ class Range_decoder
bool read_block();
+ Range_decoder( const Range_decoder & );
+ void operator=( const Range_decoder & );
+
public:
- Range_decoder( const int ifd )
+ explicit Range_decoder( const int ifd )
:
partial_member_pos( 0 ),
buffer( new uint8_t[buffer_size] ),
@@ -56,6 +59,19 @@ public:
return buffer[pos++];
}
+ int read( uint8_t * const outbuf, const int size )
+ {
+ int rest = size;
+ while( rest > 0 && !finished() )
+ {
+ const int rd = std::min( rest, stream_pos - pos );
+ std::memcpy( outbuf + size - rest, buffer + pos, rd );
+ pos += rd;
+ rest -= rd;
+ }
+ return ( rest > 0 ) ? size - rest : size;
+ }
+
void load()
{
code = 0;
@@ -242,6 +258,9 @@ class LZ_decoder
}
}
+ LZ_decoder( const LZ_decoder & );
+ void operator=( const LZ_decoder & );
+
public:
LZ_decoder( const File_header & header, Range_decoder & rdec, const int ofd )
: