mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
src/options: fix bad TriBool ThirdValue for pefile compress_resources
This commit is contained in:
parent
acfda848cd
commit
19c6b969ab
|
@ -88,14 +88,26 @@ void Options::reset() noexcept {
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
TEST_CASE("Options::reset") {
|
TEST_CASE("Options::reset") {
|
||||||
|
#define opt DO_NOT_USE_opt
|
||||||
COMPILE_TIME_ASSERT(std::is_standard_layout<Options>::value)
|
COMPILE_TIME_ASSERT(std::is_standard_layout<Options>::value)
|
||||||
COMPILE_TIME_ASSERT(std::is_nothrow_default_constructible<Options>::value)
|
COMPILE_TIME_ASSERT(std::is_nothrow_default_constructible<Options>::value)
|
||||||
COMPILE_TIME_ASSERT(std::is_trivially_copyable<Options>::value)
|
COMPILE_TIME_ASSERT(std::is_trivially_copyable<Options>::value)
|
||||||
|
|
||||||
Options local_options;
|
Options local_options;
|
||||||
Options *o = &local_options;
|
Options *const o = &local_options;
|
||||||
o->reset();
|
o->reset();
|
||||||
CHECK(o->o_unix.osabi0 == 3);
|
CHECK(o->o_unix.osabi0 == 3);
|
||||||
|
//
|
||||||
|
static_assert(TABLESIZE(o->win32_pe.compress_rt) == 25); // 25 == RT_LAST
|
||||||
|
CHECK(o->win32_pe.compress_exports);
|
||||||
|
CHECK(o->win32_pe.compress_icons);
|
||||||
|
CHECK(o->win32_pe.strip_relocs);
|
||||||
|
// issue 728
|
||||||
|
CHECK(o->win32_pe.compress_resources);
|
||||||
|
for (size_t i = 0; i < 24; i++)
|
||||||
|
CHECK(o->win32_pe.compress_rt[i]);
|
||||||
|
CHECK(!o->win32_pe.compress_rt[24]); // 24 == RT_MANIFEST
|
||||||
|
#undef opt
|
||||||
}
|
}
|
||||||
|
|
||||||
template <size_t N>
|
template <size_t N>
|
||||||
|
|
|
@ -170,8 +170,8 @@ struct Options final {
|
||||||
struct {
|
struct {
|
||||||
int compress_exports;
|
int compress_exports;
|
||||||
int compress_icons;
|
int compress_icons;
|
||||||
upx::TriBool<upx_int8_t> compress_resources;
|
upx::TriBool<upx_int8_t, 2> compress_resources;
|
||||||
upx::TriBool<upx_int8_t> compress_rt[25]; // 25 == RT_LAST
|
upx::TriBool<upx_int8_t, 2> compress_rt[25]; // 25 == RT_LAST
|
||||||
int strip_relocs;
|
int strip_relocs;
|
||||||
const char *keep_resource;
|
const char *keep_resource;
|
||||||
} win32_pe;
|
} win32_pe;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user