From 905bfacf445210b99dd56c7752c35825125c6d2b Mon Sep 17 00:00:00 2001 From: John Reiser Date: Wed, 26 Jul 2023 17:21:39 -0700 Subject: [PATCH] Pacify clang-tidy --- src/file.cpp | 2 +- src/p_lx_elf.cpp | 5 ++++- src/packer_f.cpp | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/file.cpp b/src/file.cpp index e1072957..f496c699 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -321,7 +321,7 @@ upx_off_t OutputFile::seek(upx_off_t off, int whence) { void OutputFile::set_extent(upx_off_t offset, upx_off_t length) { super::set_extent(offset, length); bytes_written = 0; - if (0 == offset && (upx_off_t) ~0u == length) { + if (0 == offset && ~(upx_off_t) 0 == length) { if (::fstat(_fd, &st) != 0) throwIOException(_name, errno); _length = st.st_size - offset; diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index de96a9d6..5c8b378f 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -386,6 +386,9 @@ PackLinuxElf32::PackLinuxElf32help1(InputFile *f) off_t PackLinuxElf::pack3(OutputFile *fo, Filter &ft) // return length of output { + if (!fo) { + return 0; + } unsigned disp; unsigned len = sz_pack2a; // after headers and all PT_LOAD @@ -4030,7 +4033,7 @@ void PackLinuxElf32x86::pack1(OutputFile *fo, Filter &ft) void PackBSDElf32x86::pack1(OutputFile *fo, Filter &ft) { - PackLinuxElf32::pack1(fo, ft); + super::pack1(fo, ft); if (0!=xct_off) // shared library return; generateElfHdr(fo, stub_i386_bsd_elf_fold, getbrk(phdri, e_phnum) ); diff --git a/src/packer_f.cpp b/src/packer_f.cpp index 607834e6..8687c0e4 100644 --- a/src/packer_f.cpp +++ b/src/packer_f.cpp @@ -255,7 +255,7 @@ void Packer::addFilter32(int filter_id) { addLoader("MRUBYTE2"); } else if (mrupwr2) { addLoader("MRUBITS2"); - } else if (n_mru) { + } else { addLoader("MRUARB20"); } addLoader("LXMRU057");