NSIS/Source/cbzip2.h
kichik 594c3ed0f6 - First LZMA enhanced NSIS version - experimental
- Added SetCompressorDictSize (only works for LZMA)
- Added SetCompressionLevel (only "works" for zlib and bzip2) - doesn't work for now
- Section is only supposed to get 4 parameters if /o is specified
- Updated version numbers


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3190 212acab6-be3b-0410-9dea-997c60f758d6
2003-11-24 00:08:58 +00:00

55 lines
No EOL
1 KiB
C++

#ifndef __CBZIP2_H__
#define __CBZIP2_H__
#include "compressor.h"
#include "bzip2/bzlib.h"
class CBzip2 : public ICompressor {
public:
int Init(int level) {
stream = new bz_stream;
if (!stream) return BZ_MEM_ERROR;
return BZ2_bzCompressInit(stream, level, 0, 30);
}
int End() {
int ret = BZ2_bzCompressEnd(stream);
delete stream;
return ret;
}
int Compress(BOOL finish) {
return BZ2_bzCompress(stream, finish?BZ_FINISH:0);
}
void SetNextIn(char *in, unsigned int size) {
stream->next_in = in;
stream->avail_in = size;
}
void SetNextOut(char *out, unsigned int size) {
stream->next_out = out;
stream->avail_out = size;
}
virtual char* GetNextOut() {
return stream->next_out;
}
virtual unsigned int GetAvailIn() {
return stream->avail_in;
}
virtual unsigned int GetAvailOut() {
return stream->avail_out;
}
const char* GetName() {
return "bzip2";
}
private:
bz_stream *stream;
};
#endif