summaryrefslogtreecommitdiffstats
path: root/decoder.h
diff options
context:
space:
mode:
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 )
: