fixed non solid compression using bzip2 or lzma

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3359 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-01-05 14:22:14 +00:00
parent d79b582a67
commit 5391b3569f
2 changed files with 14 additions and 2 deletions

View file

@ -7,6 +7,7 @@
class CBzip2 : public ICompressor {
public:
int Init(int level) {
last_ret = !BZ_STREAM_END;
stream = new bz_stream;
if (!stream) return BZ_MEM_ERROR;
return BZ2_bzCompressInit(stream, level, 0, 30);
@ -19,7 +20,11 @@ class CBzip2 : public ICompressor {
}
int Compress(BOOL finish) {
return BZ2_bzCompress(stream, finish?BZ_FINISH:0);
// act like zlib when it comes to stream ending
if (last_ret == BZ_STREAM_END)
return BZ_STREAM_END;
last_ret = BZ2_bzCompress(stream, finish?BZ_FINISH:0);
return last_ret;
}
void SetNextIn(char *in, unsigned int size) {
@ -50,6 +55,7 @@ class CBzip2 : public ICompressor {
private:
bz_stream *stream;
int last_ret;
};
#endif