Vladimir Stackov 2014-12-16 15:25:02 +03:00
parent e059230ff1
commit 854c8b769a
2 changed files with 12 additions and 0 deletions

View File

@ -126,6 +126,7 @@ void Creator::write( std::string const & fileName, EncryptionKey const & key )
int size;
if ( !os.Next( &data, &size ) )
{
encoder.reset();
throw exBundleWriteFailed();
}
if ( !size )
@ -142,6 +143,8 @@ void Creator::write( std::string const & fileName, EncryptionKey const & key )
}
}
encoder.reset();
os.writeAdler32();
}
@ -179,6 +182,7 @@ Reader::Reader( string const & fileName, EncryptionKey const & key, bool prohibi
int size;
if ( !is.Next( &data, &size ) )
{
decoder.reset();
throw exBundleReadFailed();
}
if ( !size )
@ -195,10 +199,13 @@ Reader::Reader( string const & fileName, EncryptionKey const & key, bool prohibi
if ( !decoder->getAvailableOutput() && decoder->getAvailableInput() )
{
// Apparently we have more data than we were expecting
decoder.reset();
throw exTooMuchData();
}
}
decoder.reset();
is.checkAdler32();
// Populate the map

View File

@ -59,6 +59,11 @@ public:
return ( ret == LZMA_STREAM_END );
}
~LZMAEnDecoder()
{
lzma_end( &strm );
}
};
lzma_stream LZMAEnDecoder::initValue = LZMA_STREAM_INIT;