mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Renamed some cryptic types and vars in the filters.
committer: mfx <mfx> 968641496 +0000
This commit is contained in:
parent
95fa06f507
commit
591127457d
|
@ -30,7 +30,7 @@
|
|||
//
|
||||
**************************************************************************/
|
||||
|
||||
static int F(filter_t *f)
|
||||
static int F(Filter *f)
|
||||
{
|
||||
#ifdef U
|
||||
// filter
|
||||
|
@ -157,7 +157,7 @@ static int F(filter_t *f)
|
|||
|
||||
|
||||
#ifdef U
|
||||
static int U(filter_t *f)
|
||||
static int U(Filter *f)
|
||||
{
|
||||
upx_byte *b = f->buf;
|
||||
const unsigned size5 = f->buf_len - 5;
|
||||
|
|
|
@ -44,26 +44,31 @@ void initFilter(Filter *f, upx_byte *buf, unsigned buf_len)
|
|||
|
||||
|
||||
/*************************************************************************
|
||||
// implementation
|
||||
// get a FilterEntry
|
||||
**************************************************************************/
|
||||
|
||||
const FilterImp::f_t *FilterImp::getFilter(int id)
|
||||
const FilterImp::FilterEntry *FilterImp::getFilter(int id)
|
||||
{
|
||||
static bool done = false;
|
||||
static unsigned filter_id[256];
|
||||
static unsigned char filter_map[256];
|
||||
|
||||
if (id < 0 || id > 255)
|
||||
return NULL;
|
||||
if (!done)
|
||||
{
|
||||
memset(filter_id, 0xff, sizeof(filter_id));
|
||||
// init the filter_map[]
|
||||
memset(filter_map, 0xff, sizeof(filter_map));
|
||||
for (int i = 0; i < n_filters; i++)
|
||||
filter_id[filters[i].id] = i;
|
||||
{
|
||||
int fid = filters[i].id;
|
||||
assert(fid >= 0 && fid <= 255);
|
||||
filter_map[fid] = (unsigned char) i;
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
|
||||
unsigned index = filter_id[id];
|
||||
if (index > 255)
|
||||
if (id < 0 || id > 255)
|
||||
return NULL;
|
||||
unsigned index = filter_map[id];
|
||||
if (index == 0xff)
|
||||
return NULL;
|
||||
assert(filters[index].id == id);
|
||||
return &filters[index];
|
||||
|
@ -90,27 +95,29 @@ void Filter::init(int id_, unsigned addvalue_)
|
|||
bool Filter::filter(upx_byte *buf_, unsigned buf_len_)
|
||||
{
|
||||
initFilter(this, buf_, buf_len_);
|
||||
const FilterImp::f_t *ft = FilterImp::getFilter(id);
|
||||
if (ft == NULL)
|
||||
|
||||
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
||||
if (fe == NULL)
|
||||
throwInternalError("filter-1");
|
||||
if (ft->id == 0)
|
||||
if (fe->id == 0)
|
||||
return true;
|
||||
if (buf_len < ft->min_buf_len)
|
||||
if (buf_len < fe->min_buf_len)
|
||||
return false;
|
||||
if (ft->max_buf_len && buf_len > ft->max_buf_len)
|
||||
if (fe->max_buf_len && buf_len > fe->max_buf_len)
|
||||
return false;
|
||||
if (!ft->f)
|
||||
if (!fe->do_filter)
|
||||
throwInternalError("filter-2");
|
||||
|
||||
// setChecksum
|
||||
// save checksum
|
||||
if (clevel != 1)
|
||||
{
|
||||
this->adler = upx_adler32(0,NULL,0);
|
||||
this->adler = upx_adler32(this->adler, this->buf, this->buf_len);
|
||||
}
|
||||
|
||||
//printf("filter: %02x %p %d\n", this->id, this->buf, this->buf_len);
|
||||
int r = (*ft->f)(this);
|
||||
//printf("filter: %02x %d\n", ft->id, r);
|
||||
int r = (*fe->do_filter)(this);
|
||||
//printf("filter: %02x %d\n", fe->id, r);
|
||||
if (r > 0)
|
||||
throwFilterException();
|
||||
if (r == 0)
|
||||
|
@ -119,29 +126,30 @@ bool Filter::filter(upx_byte *buf_, unsigned buf_len_)
|
|||
}
|
||||
|
||||
|
||||
bool Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool vc)
|
||||
bool Filter::unfilter(upx_byte *buf_, unsigned buf_len_, bool verify_checksum)
|
||||
{
|
||||
initFilter(this, buf_, buf_len_);
|
||||
const FilterImp::f_t *ft = FilterImp::getFilter(id);
|
||||
if (ft == NULL)
|
||||
|
||||
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
||||
if (fe == NULL)
|
||||
throwInternalError("unfilter-1");
|
||||
if (ft->id == 0)
|
||||
if (fe->id == 0)
|
||||
return true;
|
||||
if (buf_len < ft->min_buf_len)
|
||||
if (buf_len < fe->min_buf_len)
|
||||
return false;
|
||||
if (ft->max_buf_len && buf_len > ft->max_buf_len)
|
||||
if (fe->max_buf_len && buf_len > fe->max_buf_len)
|
||||
return false;
|
||||
if (!ft->u)
|
||||
if (!fe->do_unfilter)
|
||||
throwInternalError("unfilter-2");
|
||||
|
||||
//printf("unfilter: %02x %p %d\n", this->id, this->buf, this->buf_len);
|
||||
int r = (*ft->u)(this);
|
||||
//printf("unfilter: %02x %d\n", ft->id, r);
|
||||
int r = (*fe->do_unfilter)(this);
|
||||
//printf("unfilter: %02x %d\n", fe->id, r);
|
||||
if (r != 0)
|
||||
throwInternalError("unfilter-3");
|
||||
|
||||
// verifyChecksum
|
||||
if (vc && clevel != 1)
|
||||
// verify checksum
|
||||
if (verify_checksum && clevel != 1)
|
||||
{
|
||||
unsigned a = upx_adler32(0,NULL,0);
|
||||
if (this->adler != upx_adler32(a, this->buf, this->buf_len))
|
||||
|
@ -177,21 +185,21 @@ bool Filter::scan(const upx_byte *buf_, unsigned buf_len_)
|
|||
upx_byte *b = const_cast<upx_byte *>(buf_);
|
||||
initFilter(this, b, buf_len_);
|
||||
|
||||
const FilterImp::f_t *ft = FilterImp::getFilter(id);
|
||||
if (ft == NULL)
|
||||
throwInternalError("filter-1");
|
||||
if (ft->id == 0)
|
||||
const FilterImp::FilterEntry * const fe = FilterImp::getFilter(id);
|
||||
if (fe == NULL)
|
||||
throwInternalError("scan-1");
|
||||
if (fe->id == 0)
|
||||
return true;
|
||||
if (buf_len < ft->min_buf_len)
|
||||
if (buf_len < fe->min_buf_len)
|
||||
return false;
|
||||
if (ft->max_buf_len && buf_len > ft->max_buf_len)
|
||||
if (fe->max_buf_len && buf_len > fe->max_buf_len)
|
||||
return false;
|
||||
if (!ft->s)
|
||||
throwInternalError("filter-2");
|
||||
if (!fe->do_scan)
|
||||
throwInternalError("scan-2");
|
||||
|
||||
//printf("filter: %02x %p %d\n", this->id, this->buf, this->buf_len);
|
||||
int r = (*ft->s)(this);
|
||||
//printf("filter: %02x %d\n", ft->id, r);
|
||||
int r = (*fe->do_scan)(this);
|
||||
//printf("filter: %02x %d\n", fe->id, r);
|
||||
if (r > 0)
|
||||
throwFilterException();
|
||||
if (r == 0)
|
||||
|
|
23
src/filter.h
23
src/filter.h
|
@ -97,7 +97,7 @@ private:
|
|||
// We don't want a full OO interface here because of
|
||||
// certain implementation speed reasons.
|
||||
//
|
||||
// This class is strictly private to Filter - don't look.
|
||||
// This class is private to Filter - don't look.
|
||||
**************************************************************************/
|
||||
|
||||
class FilterImp
|
||||
|
@ -105,18 +105,23 @@ class FilterImp
|
|||
friend class Filter;
|
||||
|
||||
private:
|
||||
struct f_t {
|
||||
int id;
|
||||
struct FilterEntry
|
||||
{
|
||||
int id; // 0 .. 255
|
||||
unsigned min_buf_len;
|
||||
unsigned max_buf_len;
|
||||
int (*f)(Filter *);
|
||||
int (*u)(Filter *);
|
||||
int (*s)(Filter *);
|
||||
int (*do_filter)(Filter *); // filter a buffer
|
||||
int (*do_unfilter)(Filter *); // unfilter a buffer
|
||||
int (*do_scan)(Filter *); // scan a buffer
|
||||
};
|
||||
static const f_t filters[];
|
||||
static const int n_filters;
|
||||
|
||||
static const f_t *getFilter(int id);
|
||||
// get a specific filter entry
|
||||
static const FilterEntry *getFilter(int id);
|
||||
|
||||
private:
|
||||
// strictly private filter database
|
||||
static const FilterEntry filters[];
|
||||
static const int n_filters; // number of filters[]
|
||||
};
|
||||
|
||||
|
||||
|
|
116
src/filteri.cpp
116
src/filteri.cpp
|
@ -28,7 +28,7 @@
|
|||
#include "conf.h"
|
||||
#include "filter.h"
|
||||
|
||||
#define filter_t Filter
|
||||
|
||||
#define set_dummy(p, v) ((void)0)
|
||||
|
||||
|
||||
|
@ -56,153 +56,153 @@
|
|||
|
||||
|
||||
// filter: e8, e9, e8e9
|
||||
static int f_ct16_e8(filter_t *f)
|
||||
static int f_ct16_e8(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), a + f->addvalue, get_le16, set_le16)
|
||||
}
|
||||
|
||||
static int f_ct16_e9(filter_t *f)
|
||||
static int f_ct16_e9(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), a + f->addvalue, get_le16, set_le16)
|
||||
}
|
||||
|
||||
static int f_ct16_e8e9(filter_t *f)
|
||||
static int f_ct16_e8e9(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), a + f->addvalue, get_le16, set_le16)
|
||||
}
|
||||
|
||||
|
||||
// unfilter: e8, e9, e8e9
|
||||
static int u_ct16_e8(filter_t *f)
|
||||
static int u_ct16_e8(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), 0 - a - f->addvalue, get_le16, set_le16)
|
||||
}
|
||||
|
||||
static int u_ct16_e9(filter_t *f)
|
||||
static int u_ct16_e9(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), 0 - a - f->addvalue, get_le16, set_le16)
|
||||
}
|
||||
|
||||
static int u_ct16_e8e9(filter_t *f)
|
||||
static int u_ct16_e8e9(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le16, set_le16)
|
||||
}
|
||||
|
||||
|
||||
// scan: e8, e9, e8e9
|
||||
static int s_ct16_e8(filter_t *f)
|
||||
static int s_ct16_e8(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), 0 - a - f->addvalue, get_le16, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct16_e9(filter_t *f)
|
||||
static int s_ct16_e9(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), 0 - a - f->addvalue, get_le16, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct16_e8e9(filter_t *f)
|
||||
static int s_ct16_e8e9(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le16, set_dummy)
|
||||
}
|
||||
|
||||
|
||||
// filter: e8, e9, e8e9 with bswap le->be
|
||||
static int f_ct16_e8_bswap_le(filter_t *f)
|
||||
static int f_ct16_e8_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), a + f->addvalue, get_le16, set_be16)
|
||||
}
|
||||
|
||||
static int f_ct16_e9_bswap_le(filter_t *f)
|
||||
static int f_ct16_e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), a + f->addvalue, get_le16, set_be16)
|
||||
}
|
||||
|
||||
static int f_ct16_e8e9_bswap_le(filter_t *f)
|
||||
static int f_ct16_e8e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), a + f->addvalue, get_le16, set_be16)
|
||||
}
|
||||
|
||||
|
||||
// unfilter: e8, e9, e8e9 with bswap le->be
|
||||
static int u_ct16_e8_bswap_le(filter_t *f)
|
||||
static int u_ct16_e8_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), 0 - a - f->addvalue, get_be16, set_le16)
|
||||
}
|
||||
|
||||
static int u_ct16_e9_bswap_le(filter_t *f)
|
||||
static int u_ct16_e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), 0 - a - f->addvalue, get_be16, set_le16)
|
||||
}
|
||||
|
||||
static int u_ct16_e8e9_bswap_le(filter_t *f)
|
||||
static int u_ct16_e8e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_be16, set_le16)
|
||||
}
|
||||
|
||||
|
||||
// scan: e8, e9, e8e9 with bswap le->be
|
||||
static int s_ct16_e8_bswap_le(filter_t *f)
|
||||
static int s_ct16_e8_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), 0 - a - f->addvalue, get_be16, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct16_e9_bswap_le(filter_t *f)
|
||||
static int s_ct16_e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), 0 - a - f->addvalue, get_be16, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct16_e8e9_bswap_le(filter_t *f)
|
||||
static int s_ct16_e8e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_be16, set_dummy)
|
||||
}
|
||||
|
||||
|
||||
// filter: e8, e9, e8e9 with bswap be->le
|
||||
static int f_ct16_e8_bswap_be(filter_t *f)
|
||||
static int f_ct16_e8_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), a + f->addvalue, get_be16, set_le16)
|
||||
}
|
||||
|
||||
static int f_ct16_e9_bswap_be(filter_t *f)
|
||||
static int f_ct16_e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), a + f->addvalue, get_be16, set_le16)
|
||||
}
|
||||
|
||||
static int f_ct16_e8e9_bswap_be(filter_t *f)
|
||||
static int f_ct16_e8e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), a + f->addvalue, get_be16, set_le16)
|
||||
}
|
||||
|
||||
|
||||
// unfilter: e8, e9, e8e9 with bswap be->le
|
||||
static int u_ct16_e8_bswap_be(filter_t *f)
|
||||
static int u_ct16_e8_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), 0 - a - f->addvalue, get_le16, set_be16)
|
||||
}
|
||||
|
||||
static int u_ct16_e9_bswap_be(filter_t *f)
|
||||
static int u_ct16_e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), 0 - a - f->addvalue, get_le16, set_be16)
|
||||
}
|
||||
|
||||
static int u_ct16_e8e9_bswap_be(filter_t *f)
|
||||
static int u_ct16_e8e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le16, set_be16)
|
||||
}
|
||||
|
||||
|
||||
// scan: e8, e9, e8e9 with bswap be->le
|
||||
static int s_ct16_e8_bswap_be(filter_t *f)
|
||||
static int s_ct16_e8_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8), 0 - a - f->addvalue, get_le16, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct16_e9_bswap_be(filter_t *f)
|
||||
static int s_ct16_e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe9), 0 - a - f->addvalue, get_le16, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct16_e8e9_bswap_be(filter_t *f)
|
||||
static int s_ct16_e8e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT16(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le16, set_dummy)
|
||||
}
|
||||
|
@ -234,153 +234,153 @@ static int s_ct16_e8e9_bswap_be(filter_t *f)
|
|||
|
||||
|
||||
// filter: e8, e9, e8e9
|
||||
static int f_ct32_e8(filter_t *f)
|
||||
static int f_ct32_e8(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), a + f->addvalue, get_le32, set_le32)
|
||||
}
|
||||
|
||||
static int f_ct32_e9(filter_t *f)
|
||||
static int f_ct32_e9(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), a + f->addvalue, get_le32, set_le32)
|
||||
}
|
||||
|
||||
static int f_ct32_e8e9(filter_t *f)
|
||||
static int f_ct32_e8e9(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), a + f->addvalue, get_le32, set_le32)
|
||||
}
|
||||
|
||||
|
||||
// unfilter: e8, e9, e8e9
|
||||
static int u_ct32_e8(filter_t *f)
|
||||
static int u_ct32_e8(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), 0 - a - f->addvalue, get_le32, set_le32)
|
||||
}
|
||||
|
||||
static int u_ct32_e9(filter_t *f)
|
||||
static int u_ct32_e9(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), 0 - a - f->addvalue, get_le32, set_le32)
|
||||
}
|
||||
|
||||
static int u_ct32_e8e9(filter_t *f)
|
||||
static int u_ct32_e8e9(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le32, set_le32)
|
||||
}
|
||||
|
||||
|
||||
// scan: e8, e9, e8e9
|
||||
static int s_ct32_e8(filter_t *f)
|
||||
static int s_ct32_e8(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), 0 - a - f->addvalue, get_le32, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct32_e9(filter_t *f)
|
||||
static int s_ct32_e9(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), 0 - a - f->addvalue, get_le32, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct32_e8e9(filter_t *f)
|
||||
static int s_ct32_e8e9(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le32, set_dummy)
|
||||
}
|
||||
|
||||
|
||||
// filter: e8, e9, e8e9 with bswap le->be
|
||||
static int f_ct32_e8_bswap_le(filter_t *f)
|
||||
static int f_ct32_e8_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), a + f->addvalue, get_le32, set_be32)
|
||||
}
|
||||
|
||||
static int f_ct32_e9_bswap_le(filter_t *f)
|
||||
static int f_ct32_e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), a + f->addvalue, get_le32, set_be32)
|
||||
}
|
||||
|
||||
static int f_ct32_e8e9_bswap_le(filter_t *f)
|
||||
static int f_ct32_e8e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), a + f->addvalue, get_le32, set_be32)
|
||||
}
|
||||
|
||||
|
||||
// unfilter: e8, e9, e8e9 with bswap le->be
|
||||
static int u_ct32_e8_bswap_le(filter_t *f)
|
||||
static int u_ct32_e8_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), 0 - a - f->addvalue, get_be32, set_le32)
|
||||
}
|
||||
|
||||
static int u_ct32_e9_bswap_le(filter_t *f)
|
||||
static int u_ct32_e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), 0 - a - f->addvalue, get_be32, set_le32)
|
||||
}
|
||||
|
||||
static int u_ct32_e8e9_bswap_le(filter_t *f)
|
||||
static int u_ct32_e8e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_be32, set_le32)
|
||||
}
|
||||
|
||||
|
||||
// scan: e8, e9, e8e9 with bswap le->be
|
||||
static int s_ct32_e8_bswap_le(filter_t *f)
|
||||
static int s_ct32_e8_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), 0 - a - f->addvalue, get_be32, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct32_e9_bswap_le(filter_t *f)
|
||||
static int s_ct32_e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), 0 - a - f->addvalue, get_be32, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct32_e8e9_bswap_le(filter_t *f)
|
||||
static int s_ct32_e8e9_bswap_le(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_be32, set_dummy)
|
||||
}
|
||||
|
||||
|
||||
// filter: e8, e9, e8e9 with bswap be->le
|
||||
static int f_ct32_e8_bswap_be(filter_t *f)
|
||||
static int f_ct32_e8_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), a + f->addvalue, get_be32, set_le32)
|
||||
}
|
||||
|
||||
static int f_ct32_e9_bswap_be(filter_t *f)
|
||||
static int f_ct32_e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), a + f->addvalue, get_be32, set_le32)
|
||||
}
|
||||
|
||||
static int f_ct32_e8e9_bswap_be(filter_t *f)
|
||||
static int f_ct32_e8e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), a + f->addvalue, get_be32, set_le32)
|
||||
}
|
||||
|
||||
|
||||
// unfilter: e8, e9, e8e9 with bswap be->le
|
||||
static int u_ct32_e8_bswap_be(filter_t *f)
|
||||
static int u_ct32_e8_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), 0 - a - f->addvalue, get_le32, set_be32)
|
||||
}
|
||||
|
||||
static int u_ct32_e9_bswap_be(filter_t *f)
|
||||
static int u_ct32_e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), 0 - a - f->addvalue, get_le32, set_be32)
|
||||
}
|
||||
|
||||
static int u_ct32_e8e9_bswap_be(filter_t *f)
|
||||
static int u_ct32_e8e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le32, set_be32)
|
||||
}
|
||||
|
||||
|
||||
// scan: e8, e9, e8e9 with bswap be->le
|
||||
static int s_ct32_e8_bswap_be(filter_t *f)
|
||||
static int s_ct32_e8_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8), 0 - a - f->addvalue, get_le32, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct32_e9_bswap_be(filter_t *f)
|
||||
static int s_ct32_e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe9), 0 - a - f->addvalue, get_le32, set_dummy)
|
||||
}
|
||||
|
||||
static int s_ct32_e8e9_bswap_be(filter_t *f)
|
||||
static int s_ct32_e8e9_bswap_be(Filter *f)
|
||||
{
|
||||
CT32(f, (*b == 0xe8 || *b == 0xe9), 0 - a - f->addvalue, get_le32, set_dummy)
|
||||
}
|
||||
|
@ -388,6 +388,8 @@ static int s_ct32_e8e9_bswap_be(filter_t *f)
|
|||
|
||||
#undef CT32
|
||||
|
||||
#undef set_dummy
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
// 32-bit calltrick with cto ("clever")
|
||||
|
@ -406,10 +408,10 @@ static int s_ct32_e8e9_bswap_be(filter_t *f)
|
|||
|
||||
|
||||
/*************************************************************************
|
||||
// database for class Filter
|
||||
// database for use in class Filter
|
||||
**************************************************************************/
|
||||
|
||||
const FilterImp::f_t FilterImp::filters[] = {
|
||||
const FilterImp::FilterEntry FilterImp::filters[] = {
|
||||
// no filter
|
||||
{ 0x00, 0, 0, NULL, NULL, NULL },
|
||||
// 16-bit calltrick
|
||||
|
|
|
@ -974,7 +974,7 @@ void Packer::addFilter32(int filter_id)
|
|||
// -1: try all filters, use first working one
|
||||
// -2: try only the opt->filter filter
|
||||
//
|
||||
// This is prepared for generalization into class Packer so that
|
||||
// This has been prepared for generalization into class Packer so that
|
||||
// opt->all_filters is available for all executable formats.
|
||||
//
|
||||
// It will replace the tryFilters() / compress() call sequence.
|
||||
|
@ -1048,7 +1048,7 @@ void Packer::compressWithFilters(Filter *parm_ft, unsigned *parm_overlapoh,
|
|||
filters[nfilters++] = 0;
|
||||
filters[nfilters] = -1;
|
||||
|
||||
// update
|
||||
// update total_passes
|
||||
if (strategy < 0)
|
||||
this->total_passes += 1;
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user