NSIS/Source/czlib.h
kichik ae16cbfe3f - Compressor type listed in summary
- SetOutPath now sets the current directory (RegDLL no longer does)
- File names are now validated for commands that need normal files, the directory selection dialog, and every variable that contains a file/dir name
- Fixed a distortion of the MUI's branding text with ClearType
- $INSTDIR is now right in the custom page after the directory selection dialog
- No more squares in the automatically appended directory name in the directory selection dialog
- Size optimizations


git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2121 212acab6-be3b-0410-9dea-997c60f758d6
2003-02-07 23:04:25 +00:00

55 lines
No EOL
1 KiB
C++

#ifndef __CZLIB_H__
#define __CZLIB_H__
#include "compressor.h"
#include "zlib/ZLIB.H"
class CZlib : public ICompressor {
public:
int Init(int level) {
stream = new z_stream;
if (!stream) return Z_MEM_ERROR;
return deflateInit(stream, level);
}
int End() {
int ret = deflateEnd(stream);
delete stream;
return ret;
}
int Compress(BOOL finish) {
return deflate(stream, finish?Z_FINISH:0);
}
void SetNextIn(char *in, unsigned int size) {
stream->next_in = (unsigned char*)in;
stream->avail_in = size;
}
void SetNextOut(char *out, unsigned int size) {
stream->next_out = (unsigned char*)out;
stream->avail_out = size;
}
virtual char* GetNextOut() {
return (char*)stream->next_out;
}
virtual unsigned int GetAvailIn() {
return stream->avail_in;
}
virtual unsigned int GetAvailOut() {
return stream->avail_out;
}
char* GetName() {
return "zlib";
}
private:
z_stream *stream;
};
#endif