compression tests
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4862 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
9cb54c2272
commit
ce18bd8cb8
5 changed files with 358 additions and 1 deletions
59
Source/Tests/decompress.cpp
Normal file
59
Source/Tests/decompress.cpp
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include "decompress.h"
|
||||
|
||||
#define EXEHEAD
|
||||
#define NSIS_CONFIG_COMPRESSION_SUPPORT
|
||||
|
||||
extern "C" {
|
||||
#define NSIS_COMPRESS_USE_BZIP2
|
||||
#include "../bzip2/bzlib.h"
|
||||
#undef NSIS_COMPRESS_USE_BZIP2
|
||||
|
||||
#define NSIS_COMPRESS_USE_LZMA
|
||||
#include "../7zip/LZMADecode.h"
|
||||
#undef NSIS_COMPRESS_USE_LZMA
|
||||
|
||||
#define NSIS_COMPRESS_USE_ZLIB
|
||||
#include "../zlib/ZLIB.H"
|
||||
#undef NSIS_COMPRESS_USE_ZLIB
|
||||
}
|
||||
|
||||
#define DECOMPRESSOR(name, type, initf, dec, u) \
|
||||
name::name() { \
|
||||
vs = new type; \
|
||||
} \
|
||||
\
|
||||
name::~name() { \
|
||||
delete vs; \
|
||||
vs = NULL; \
|
||||
} \
|
||||
\
|
||||
void name::setNextIn(void *buffer, int size) { \
|
||||
type *s = (type *) vs; \
|
||||
s->next_in = (u *) buffer; \
|
||||
s->avail_in = size; \
|
||||
} \
|
||||
\
|
||||
void name::setNextOut(void *buffer, int size) { \
|
||||
type *s = (type *) vs; \
|
||||
s->next_out = (u *) buffer; \
|
||||
s->avail_out = size; \
|
||||
} \
|
||||
\
|
||||
int name::getAvailOut() { \
|
||||
type *s = (type *) vs; \
|
||||
return s->avail_out; \
|
||||
} \
|
||||
\
|
||||
void name::init() { \
|
||||
type *s = (type *) vs; \
|
||||
initf(s); \
|
||||
} \
|
||||
\
|
||||
int name::decompress() { \
|
||||
type *s = (type *) vs; \
|
||||
return dec(s); \
|
||||
}
|
||||
|
||||
DECOMPRESSOR(lzmaDecompressor, lzma_stream, lzmaInit, lzmaDecode, unsigned char);
|
||||
DECOMPRESSOR(bzip2Decompressor, DState, BZ2_bzDecompressInit, BZ2_bzDecompress, char);
|
||||
DECOMPRESSOR(zlibDecompressor, z_stream, inflateReset, inflate, unsigned char);
|
Loading…
Add table
Add a link
Reference in a new issue