PAQ8/Paq8.hpp
//----------------------------------------------------------------------------------
// Decompress a file  (DataSize is side of COMPRESSED data)
Decompress a file  (DataSize is side of COMPRESSED data)
Decompress a file ( DataSize is side of COMPRESSED data )
static inline int strm_decompress(STRM& DstStrm, Encoder* en, unsigned long DataSize=0)    
{
 if(en->getMode() != DECOMPRESS)return -1;
 en->ResetDecoderCtx();
 unsigned long ArchSize = en->ArchSize();
 unsigned long DataEnd = 0;
 if(DataSize)
  {
   DataEnd = en->ArchPos() + DataSize;
   if(DataEnd > ArchSize)DataEnd = ArchSize; 
  }
   else DataEnd = ArchSize;
 while((en->ArchPos() < DataEnd) || en->BlkLeft())  
  {
   DstStrm.putc(decode(*en));    
  }
 return 0; 
}
static inline int strm_decompress ( STRM & DstStrm , Encoder * en , unsigned long DataSize = 0 ) { if ( en -> getMode ( ) != DECOMPRESS ) return -1 ; en -> ResetDecoderCtx ( ) ; unsigned long ArchSize = en -> ArchSize ( ) ; unsigned long DataEnd = 0 ; if ( DataSize ) { DataEnd = en -> ArchPos ( ) + DataSize ; if ( DataEnd > ArchSize ) DataEnd = ArchSize ; } else DataEnd = ArchSize ; while ( ( en -> ArchPos ( ) < DataEnd ) || en -> BlkLeft ( ) ) { DstStrm . putc ( decode ( * en ) ) ; } return 0 ; }
Decompress a file  (DataSize is side of COMPRESSED data)
Decompress a file ( DataSize is side of COMPRESSED data )
// DataSize is known size of a single file. If 0 then assume that all blocks belong to a single file //     PRINTF("Extracting %s %ld -> ", filename, filesize); // May be more than one block    // 'decode' can`t detect end of stream // Why headers read by the same function as a compressed data?