all: minor cleanups
This commit is contained in:
parent
038743c694
commit
f0cb30e2b9
@ -27,6 +27,12 @@ fi
|
|||||||
|
|
||||||
podman run "${flags[@]}" "$image" bash -c $'
|
podman run "${flags[@]}" "$image" bash -c $'
|
||||||
set -ex; set -o pipefail
|
set -ex; set -o pipefail
|
||||||
|
cd /home/upx/src/upx
|
||||||
|
# check whitespace
|
||||||
|
[[ -d .git ]] && bash ./misc/scripts/check_whitespace_git.sh
|
||||||
|
# rebuild docs
|
||||||
|
make -C doc clean all
|
||||||
|
# rebuild stubs
|
||||||
cd /home/upx/src/upx/src/stub
|
cd /home/upx/src/upx/src/stub
|
||||||
make maintainer-clean extra-clean
|
make maintainer-clean extra-clean
|
||||||
git status . || true # make sure the stub files got deleted
|
git status . || true # make sure the stub files got deleted
|
||||||
|
|||||||
@ -18,7 +18,7 @@ RUN dpkg --add-architecture i386 \
|
|||||||
elfutils execstack fd-find file fish fzf g++ gawk gdb gojq ht htop hyperfine jq ksh \
|
elfutils execstack fd-find file fish fzf g++ gawk gdb gojq ht htop hyperfine jq ksh \
|
||||||
libzstd-dev lsb-release lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
|
libzstd-dev lsb-release lz4 lzip lzop minify mksh moreutils musl neovim ninja-build \
|
||||||
p7zip parallel patch patchelf patchutils pax-utils proot \
|
p7zip parallel patch patchelf patchutils pax-utils proot \
|
||||||
python3 python3-pyasn1 python3-pycryptodome python3-yaml python3-zstd \
|
python3 python3-pyasn1 python3-pycryptodome python3-pycurl python3-toml python3-yaml python3-zstd \
|
||||||
re2c ripgrep rsync screen universal-ctags unzip yash yq \
|
re2c ripgrep rsync screen universal-ctags unzip yash yq \
|
||||||
zip zlib1g-dev zoxide zsh zstd \
|
zip zlib1g-dev zoxide zsh zstd \
|
||||||
# extra packages for compiling with "gcc -m32" and "gcc -mx32":
|
# extra packages for compiling with "gcc -m32" and "gcc -mx32":
|
||||||
|
|||||||
4
misc/podman/rebuild-stubs/packages.txt
generated
4
misc/podman/rebuild-stubs/packages.txt
generated
@ -314,6 +314,7 @@ ii python3-argcomplete 3.1.4-1 all
|
|||||||
ii python3-minimal 3.12.3-0ubuntu1 amd64 minimal subset of the Python language (default python3 version)
|
ii python3-minimal 3.12.3-0ubuntu1 amd64 minimal subset of the Python language (default python3 version)
|
||||||
ii python3-pyasn1 0.4.8-4 all ASN.1 library for Python (Python 3 module)
|
ii python3-pyasn1 0.4.8-4 all ASN.1 library for Python (Python 3 module)
|
||||||
ii python3-pycryptodome 3.20.0+dfsg-1 amd64 cryptographic Python library (Python 3)
|
ii python3-pycryptodome 3.20.0+dfsg-1 amd64 cryptographic Python library (Python 3)
|
||||||
|
ii python3-pycurl 7.45.3-1build2 amd64 Python bindings to libcurl (Python 3)
|
||||||
ii python3-pyelftools 0.30-1 all pure-python3 library for parsing ELF and DWARF
|
ii python3-pyelftools 0.30-1 all pure-python3 library for parsing ELF and DWARF
|
||||||
ii python3-toml 0.10.2-1 all library for Tom's Obvious, Minimal Language - Python 3.x
|
ii python3-toml 0.10.2-1 all library for Tom's Obvious, Minimal Language - Python 3.x
|
||||||
ii python3-xmltodict 0.13.0-1 all Makes working with XML feel like you are working with JSON (Python 3)
|
ii python3-xmltodict 0.13.0-1 all Makes working with XML feel like you are working with JSON (Python 3)
|
||||||
@ -356,7 +357,7 @@ ii zstd 1.5.5+dfsg2-2build1 amd64
|
|||||||
||/ Name Version Architecture Description
|
||/ Name Version Architecture Description
|
||||||
|
|
||||||
Packages sorted by Installed-Size:
|
Packages sorted by Installed-Size:
|
||||||
874050 ===== TOTAL (350 packages)
|
874252 ===== TOTAL (351 packages)
|
||||||
72249 gcc-13-x86-64-linux-gnu amd64
|
72249 gcc-13-x86-64-linux-gnu amd64
|
||||||
37841 g++-13-x86-64-linux-gnu amd64
|
37841 g++-13-x86-64-linux-gnu amd64
|
||||||
36493 cmake amd64
|
36493 cmake amd64
|
||||||
@ -577,6 +578,7 @@ Packages sorted by Installed-Size:
|
|||||||
208 libpam0g amd64
|
208 libpam0g amd64
|
||||||
207 libuchardet0 amd64
|
207 libuchardet0 amd64
|
||||||
206 proot amd64
|
206 proot amd64
|
||||||
|
202 python3-pycurl amd64
|
||||||
200 libselinux1 amd64
|
200 libselinux1 amd64
|
||||||
200 libnghttp2-14 amd64
|
200 libnghttp2-14 amd64
|
||||||
199 execstack amd64
|
199 execstack amd64
|
||||||
|
|||||||
@ -504,6 +504,7 @@ void upx_compiler_sanity_check(void) noexcept {
|
|||||||
COMPILE_TIME_ASSERT_ALIGNED1(upx_charptr_unit_type)
|
COMPILE_TIME_ASSERT_ALIGNED1(upx_charptr_unit_type)
|
||||||
COMPILE_TIME_ASSERT(sizeof(*((charptr) nullptr)) == 1)
|
COMPILE_TIME_ASSERT(sizeof(*((charptr) nullptr)) == 1)
|
||||||
|
|
||||||
|
// check UPX_VERSION_xxx
|
||||||
{
|
{
|
||||||
using upx::compile_time::mem_eq;
|
using upx::compile_time::mem_eq;
|
||||||
using upx::compile_time::string_len;
|
using upx::compile_time::string_len;
|
||||||
@ -511,9 +512,15 @@ void upx_compiler_sanity_check(void) noexcept {
|
|||||||
static_assert(string_len(UPX_VERSION_YEAR) == 4);
|
static_assert(string_len(UPX_VERSION_YEAR) == 4);
|
||||||
static_assert(string_len(UPX_VERSION_DATE_ISO) == 10);
|
static_assert(string_len(UPX_VERSION_DATE_ISO) == 10);
|
||||||
static_assert(string_len(UPX_VERSION_DATE) == 12 || string_len(UPX_VERSION_DATE) == 13);
|
static_assert(string_len(UPX_VERSION_DATE) == 12 || string_len(UPX_VERSION_DATE) == 13);
|
||||||
static_assert(mem_eq(UPX_VERSION_STRING, UPX_VERSION_STRING4, 3));
|
static_assert(mem_eq(UPX_VERSION_STRING4, UPX_VERSION_STRING, 3));
|
||||||
static_assert(mem_eq(UPX_VERSION_DATE_ISO, UPX_VERSION_YEAR, 4));
|
static_assert(mem_eq(UPX_VERSION_YEAR, UPX_VERSION_DATE_ISO, 4));
|
||||||
static_assert(mem_eq(&UPX_VERSION_DATE[sizeof(UPX_VERSION_DATE) - 5], UPX_VERSION_YEAR, 4));
|
static_assert(mem_eq(UPX_VERSION_YEAR, &UPX_VERSION_DATE[sizeof(UPX_VERSION_DATE) - 5], 4));
|
||||||
|
char buf[16];
|
||||||
|
constexpr long long v = UPX_VERSION_HEX;
|
||||||
|
upx_safe_snprintf(buf, sizeof(buf), "%lld.%lld.%lld", (v >> 16), (v >> 8) & 255, v & 255);
|
||||||
|
assert_noexcept(strcmp(buf, UPX_VERSION_STRING) == 0);
|
||||||
|
upx_safe_snprintf(buf, sizeof(buf), "%lld.%lld%lld", (v >> 16), (v >> 8) & 255, v & 255);
|
||||||
|
assert_noexcept(strcmp(buf, UPX_VERSION_STRING4) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gitrev[0]) {
|
if (gitrev[0]) {
|
||||||
|
|||||||
20
src/help.cpp
20
src/help.cpp
@ -105,19 +105,17 @@ struct PackerNames final {
|
|||||||
explicit PackerNames() noexcept = default;
|
explicit PackerNames() noexcept = default;
|
||||||
~PackerNames() noexcept = default;
|
~PackerNames() noexcept = default;
|
||||||
|
|
||||||
static constexpr size_t MAX_NAMES = 64;
|
static constexpr unsigned MAX_NAMES = 64; // arbitrary limit, increase as needed
|
||||||
static constexpr size_t MAX_METHODS = 8;
|
|
||||||
static constexpr size_t MAX_FILTERS = 16;
|
|
||||||
struct Entry {
|
struct Entry {
|
||||||
const char *fname;
|
const char *fname;
|
||||||
const char *sname;
|
const char *sname;
|
||||||
size_t methods_count;
|
unsigned methods_count;
|
||||||
size_t filters_count;
|
unsigned filters_count;
|
||||||
unsigned methods[MAX_METHODS];
|
unsigned methods[PackerBase::MAX_METHODS];
|
||||||
unsigned filters[MAX_FILTERS];
|
unsigned filters[PackerBase::MAX_FILTERS];
|
||||||
};
|
};
|
||||||
Entry names[MAX_NAMES];
|
Entry names[MAX_NAMES];
|
||||||
size_t names_count = 0;
|
unsigned names_count = 0;
|
||||||
const Options *o = nullptr;
|
const Options *o = nullptr;
|
||||||
|
|
||||||
void add(const PackerBase *pb) {
|
void add(const PackerBase *pb) {
|
||||||
@ -129,14 +127,14 @@ struct PackerNames final {
|
|||||||
for (const int *m = pb->getCompressionMethods(M_ALL, 10); *m != M_END; m++) {
|
for (const int *m = pb->getCompressionMethods(M_ALL, 10); *m != M_END; m++) {
|
||||||
if (*m >= 0) {
|
if (*m >= 0) {
|
||||||
assert_noexcept(Packer::isValidCompressionMethod(*m));
|
assert_noexcept(Packer::isValidCompressionMethod(*m));
|
||||||
assert_noexcept(e.methods_count < MAX_METHODS);
|
assert_noexcept(e.methods_count < PackerBase::MAX_METHODS);
|
||||||
e.methods[e.methods_count++] = *m;
|
e.methods[e.methods_count++] = *m;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const int *f = pb->getFilters(); f != nullptr && *f != FT_END; f++) {
|
for (const int *f = pb->getFilters(); f != nullptr && *f != FT_END; f++) {
|
||||||
if (*f >= 0) {
|
if (*f >= 0) {
|
||||||
assert_noexcept(Filter::isValidFilter(*f));
|
assert_noexcept(Filter::isValidFilter(*f));
|
||||||
assert_noexcept(e.filters_count < MAX_FILTERS);
|
assert_noexcept(e.filters_count < PackerBase::MAX_FILTERS);
|
||||||
e.filters[e.filters_count++] = *f;
|
e.filters[e.filters_count++] = *f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,7 +479,7 @@ void show_version(bool one_line) {
|
|||||||
fprintf(f, "Copyright (C) 2015" "-2024 Meta Platforms, Inc. and affiliates\n");
|
fprintf(f, "Copyright (C) 2015" "-2024 Meta Platforms, Inc. and affiliates\n");
|
||||||
#endif
|
#endif
|
||||||
#if (WITH_BZIP2)
|
#if (WITH_BZIP2)
|
||||||
// see <bzlib.h>
|
// see vendor/bzip2/bzlib.h
|
||||||
fprintf(f, "Copyright (C) 1996" "-2010 Julian Seward\n");
|
fprintf(f, "Copyright (C) 1996" "-2010 Julian Seward\n");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(DOCTEST_CONFIG_DISABLE)
|
#if !defined(DOCTEST_CONFIG_DISABLE)
|
||||||
|
|||||||
@ -1031,16 +1031,14 @@ void Packer::compressWithFilters(byte *i_ptr,
|
|||||||
assert(orig_ft.id == 0);
|
assert(orig_ft.id == 0);
|
||||||
|
|
||||||
// prepare methods and filters
|
// prepare methods and filters
|
||||||
constexpr int MAX_METHODS = 8;
|
|
||||||
constexpr int MAX_FILTERS = 16;
|
|
||||||
int methods[MAX_METHODS];
|
int methods[MAX_METHODS];
|
||||||
int nmethods = prepareMethods(methods, ph.method, getCompressionMethods(M_ALL, ph.level));
|
int nmethods = prepareMethods(methods, ph.method, getCompressionMethods(M_ALL, ph.level));
|
||||||
assert(nmethods > 0);
|
assert_noexcept(nmethods > 0);
|
||||||
assert(nmethods < MAX_METHODS);
|
assert_noexcept(nmethods < (int) MAX_METHODS);
|
||||||
int filters[MAX_FILTERS];
|
int filters[MAX_FILTERS];
|
||||||
int nfilters = prepareFilters(filters, filter_strategy, getFilters());
|
int nfilters = prepareFilters(filters, filter_strategy, getFilters());
|
||||||
assert(nfilters > 0);
|
assert_noexcept(nfilters > 0);
|
||||||
assert(nfilters < MAX_FILTERS);
|
assert_noexcept(nfilters < (int) MAX_FILTERS);
|
||||||
#if 0
|
#if 0
|
||||||
printf("compressWithFilters: m(%d):", nmethods);
|
printf("compressWithFilters: m(%d):", nmethods);
|
||||||
for (int i = 0; i < nmethods; i++)
|
for (int i = 0; i < nmethods; i++)
|
||||||
|
|||||||
@ -76,6 +76,10 @@ public:
|
|||||||
virtual void doList() = 0;
|
virtual void doList() = 0;
|
||||||
virtual void doFileInfo() = 0;
|
virtual void doFileInfo() = 0;
|
||||||
|
|
||||||
|
// arbitrary limits, increase as needed
|
||||||
|
static constexpr unsigned MAX_METHODS = 8; // for getCompressionMethods()
|
||||||
|
static constexpr unsigned MAX_FILTERS = 16; // for getFilters()
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
InputFile *const fi; // reference
|
InputFile *const fi; // reference
|
||||||
union { // unnamed union
|
union { // unnamed union
|
||||||
|
|||||||
@ -94,8 +94,6 @@ ACC_COMPILE_TIME_ASSERT_HEADER(sizeof(SizeT) >= 4)
|
|||||||
#if (ACC_ARCH_I086)
|
#if (ACC_ARCH_I086)
|
||||||
# define char char __huge
|
# define char char __huge
|
||||||
#elif (ACC_CC_WATCOMC)
|
#elif (ACC_CC_WATCOMC)
|
||||||
#else
|
|
||||||
#define CLzmaDecoderState const CLzmaDecoderState
|
|
||||||
#endif
|
#endif
|
||||||
int LzmaDecodeProperties(CLzmaProperties *, const unsigned char *, int);
|
int LzmaDecodeProperties(CLzmaProperties *, const unsigned char *, int);
|
||||||
int LzmaDecode(CLzmaDecoderState *, const unsigned char *, SizeT, SizeT *, unsigned char *, SizeT, SizeT *);
|
int LzmaDecode(CLzmaDecoderState *, const unsigned char *, SizeT, SizeT *, unsigned char *, SizeT, SizeT *);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user