all: assorted cleanups and updates

Changes include:
  - add a bunch of "noexcept", mostly to operators and forceinline
  - use "uchar"
  - use "charptr"
  - rename options_t to Options
  - add ptr_check_no_overlap()
  - rewrite p_exe.cpp, NFCI
  - clang-format help.cpp
  - spelling fixes
This commit is contained in:
Markus F.X.J. Oberhumer
2023-03-15 00:19:55 +01:00
parent 127fd095e7
commit a627648249
65 changed files with 1492 additions and 1138 deletions
+20 -21
View File
@@ -46,7 +46,7 @@ Packer::Packer(InputFile *f)
mem_clear(&ph, sizeof(ph));
}
Packer::~Packer() {
Packer::~Packer() noexcept {
delete uip;
uip = nullptr;
delete linker;
@@ -834,27 +834,26 @@ static const char *getIdentstr(unsigned *size, int small) {
"\n";
static char identtiny[] = UPX_VERSION_STRING4;
static int done;
if (!done && (opt->debug.fake_stub_version[0] || opt->debug.fake_stub_year[0])) {
struct strinfo_t {
char *s;
int size;
};
static const strinfo_t strlist[] = {{identbig, (int) sizeof(identbig)},
{identsmall, (int) sizeof(identsmall)},
{identtiny, (int) sizeof(identtiny)},
{nullptr, 0}};
const strinfo_t *iter;
for (iter = strlist; iter->s; ++iter) {
if (opt->debug.fake_stub_version[0])
mem_replace(iter->s, iter->size, UPX_VERSION_STRING4, 4,
opt->debug.fake_stub_version);
if (opt->debug.fake_stub_year[0])
mem_replace(iter->s, iter->size, UPX_VERSION_YEAR, 4, opt->debug.fake_stub_year);
static upx_std_once_flag init_done;
upx_std_call_once(init_done, []() noexcept {
if (opt->debug.fake_stub_version[0] || opt->debug.fake_stub_year[0]) {
struct Ident {
char *s;
int len;
};
static const Ident idents[] = {{identbig, (int) sizeof(identbig) - 1},
{identsmall, (int) sizeof(identsmall) - 1},
{identtiny, (int) sizeof(identtiny) - 1},
{nullptr, 0}};
for (const Ident *iter = idents; iter->s; ++iter) {
if (opt->debug.fake_stub_version[0])
mem_replace(iter->s, iter->len, UPX_VERSION_STRING4, 4,
opt->debug.fake_stub_version);
if (opt->debug.fake_stub_year[0])
mem_replace(iter->s, iter->len, UPX_VERSION_YEAR, 4, opt->debug.fake_stub_year);
}
}
done = 1;
}
});
if (small < 0)
small = opt->small;