summaryrefslogtreecommitdiffstats
path: root/decoder.h
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 09:31:21 +0000
committerDaniel Baumann <mail@daniel-baumann.ch>2015-11-07 09:31:21 +0000
commit418b05fcd64815e6928cb9751285fa2d29a34361 (patch)
tree9c3aea706f65d3822c5fb4a526fd8570a7ded89d /decoder.h
parentAdding upstream version 1.13~rc1. (diff)
downloadlzip-418b05fcd64815e6928cb9751285fa2d29a34361.tar.xz
lzip-418b05fcd64815e6928cb9751285fa2d29a34361.zip
Adding upstream version 1.13~rc2.upstream/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 )
: