From 07d368adcad1f9efb67feabb92f31317841314bc Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Thu, 20 Oct 2022 00:31:02 +0200 Subject: [PATCH] all: misc cleanups --- .github/workflows/codeql-analysis.yml | 37 +-------------------------- Makefile | 4 ++- doc/upx-doc.html | 2 +- doc/upx-doc.txt | 2 +- doc/upx.1 | 2 +- doc/upx.pod | 2 +- src/util/bptr.h | 1 + src/util/membuffer.h | 14 +++++----- src/util/xspan_impl.h | 9 ++++--- src/util/xspan_impl_common.h | 3 +-- src/util/xspan_impl_ptr.h | 3 +-- src/util/xspan_impl_ptr_or_null.h | 3 ++- src/util/xspan_impl_ptr_or_span.h | 2 +- src/util/xspan_impl_span.h | 2 +- 14 files changed, 28 insertions(+), 58 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d58ee4c7..4465b5ee 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,19 +1,8 @@ -# For most projects, this workflow file will not need changing; you simply need -# to commit it to your repository. -# -# You may wish to alter this file to override the set of languages analyzed, -# or to provide custom queries or build logic. -# -# ******** NOTE ******** -# We have attempted to detect the languages in your repository. Please check -# the `language` matrix defined below to confirm you have the correct set of -# supported CodeQL languages. -# name: "CodeQL" on: push: - branches: [ "devel4" ] + branches: [ "devel", "devel4", "devel5", "master" ] pull_request: # The branches below must be a subset of the branches above branches: [ "devel4" ] @@ -34,40 +23,16 @@ jobs: fail-fast: false matrix: language: [ 'cpp' ] - # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] - # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support steps: - name: Checkout repository uses: actions/checkout@v3 with: { submodules: true } - - # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL uses: github/codeql-action/init@v2 with: languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - - # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs - # queries: security-extended,security-and-quality - - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild uses: github/codeql-action/autobuild@v2 - - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun - - # If the Autobuild fails above, remove it and uncomment the following three lines. - # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. - - # - run: | - # echo "Run, Build Application using script" - # ./location_of_script_within_repo/buildscript.sh - - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/Makefile b/Makefile index 7106dc5c..074b348c 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,9 @@ CMAKE = cmake UPX_CMAKE_BUILD_FLAGS += --parallel -#UPX_CMAKE_BUILD_FLAGS += --verbose +ifneq ($(VERBOSE),) + UPX_CMAKE_BUILD_FLAGS += --verbose +endif # check git submodules ifeq ($(wildcard ./vendor/doctest/doctest/.),) diff --git a/doc/upx-doc.html b/doc/upx-doc.html index 0741b046..64231260 100644 --- a/doc/upx-doc.html +++ b/doc/upx-doc.html @@ -52,7 +52,7 @@ Copyright (c) 1996-2022 Markus Oberhumer, Laszlo Molnar & John Reiser - excellent compression ratio: typically compresses better than Zip, use UPX to decrease the size of your distribution ! -- very fast decompression: more than 1000 MB/sec on any reasonably modern +- very fast decompression: more than 500 MB/sec on any reasonably modern machine - no memory overhead for your compressed executables for most of the diff --git a/doc/upx-doc.txt b/doc/upx-doc.txt index 2996ec48..9ce627cc 100644 --- a/doc/upx-doc.txt +++ b/doc/upx-doc.txt @@ -40,7 +40,7 @@ DESCRIPTION - excellent compression ratio: typically compresses better than Zip, use UPX to decrease the size of your distribution ! - - very fast decompression: more than 1000 MB/sec on any reasonably modern + - very fast decompression: more than 500 MB/sec on any reasonably modern machine - no memory overhead for your compressed executables for most of the diff --git a/doc/upx.1 b/doc/upx.1 index 264e0389..e6a40fc4 100644 --- a/doc/upx.1 +++ b/doc/upx.1 @@ -181,7 +181,7 @@ Use \fB\s-1UPX\s0\fR on trusted files only! \& \- excellent compression ratio: typically compresses better than Zip, \& use UPX to decrease the size of your distribution ! \& -\& \- very fast decompression: more than 1000 MB/sec on any reasonably modern +\& \- very fast decompression: more than 500 MB/sec on any reasonably modern \& machine \& \& \- no memory overhead for your compressed executables for most of the diff --git a/doc/upx.pod b/doc/upx.pod index 2c545778..5d65f2d5 100644 --- a/doc/upx.pod +++ b/doc/upx.pod @@ -55,7 +55,7 @@ B is a versatile executable packer with the following features: - excellent compression ratio: typically compresses better than Zip, use UPX to decrease the size of your distribution ! - - very fast decompression: more than 1000 MB/sec on any reasonably modern + - very fast decompression: more than 500 MB/sec on any reasonably modern machine - no memory overhead for your compressed executables for most of the diff --git a/src/util/bptr.h b/src/util/bptr.h index 64646c8f..0a3faace 100644 --- a/src/util/bptr.h +++ b/src/util/bptr.h @@ -31,6 +31,7 @@ /************************************************************************* // BoundedPtr +// (deprecated, use xspan.h instead) **************************************************************************/ template diff --git a/src/util/membuffer.h b/src/util/membuffer.h index 9e516a75..8ef1820e 100644 --- a/src/util/membuffer.h +++ b/src/util/membuffer.h @@ -37,7 +37,7 @@ template class MemBufferBase { public: typedef T element_type; - typedef T *pointer; + typedef typename std::add_pointer::type pointer; protected: pointer b = nullptr; @@ -124,15 +124,17 @@ private: // raw_bytes overload template -inline T *raw_bytes(const MemBufferBase &a, size_t size_in_bytes) { - return a.raw_bytes(size_in_bytes); +inline typename MemBufferBase::pointer raw_bytes(const MemBufferBase &mbb, + size_t size_in_bytes) { + return mbb.raw_bytes(size_in_bytes); } // global operators // rewrite "n + membuffer" to "membuffer + n" so that this will get checked above -template ::value, U>::type> -typename MemBuffer::pointer operator+(U n, const MemBuffer &mb) { - return mb + n; +template ::value, U>::type> +inline typename MemBufferBase::pointer operator+(U n, const MemBufferBase &mbb) { + return mbb + n; } /* vim:set ts=4 sw=4 et: */ diff --git a/src/util/xspan_impl.h b/src/util/xspan_impl.h index 1caf32ca..d27f0960 100644 --- a/src/util/xspan_impl.h +++ b/src/util/xspan_impl.h @@ -192,13 +192,14 @@ template struct Ptr; template -inline T *raw_bytes(const PtrOrSpanOrNull &a, size_t size_in_bytes); +inline typename PtrOrSpanOrNull::pointer raw_bytes(const PtrOrSpanOrNull &a, + size_t size_in_bytes); template -inline T *raw_bytes(const PtrOrSpan &a, size_t size_in_bytes); +inline typename PtrOrSpan::pointer raw_bytes(const PtrOrSpan &a, size_t size_in_bytes); template -inline T *raw_bytes(const Span &a, size_t size_in_bytes); +inline typename Span::pointer raw_bytes(const Span &a, size_t size_in_bytes); template -inline T *raw_bytes(const Ptr &a, size_t size_in_bytes); +inline typename Ptr::pointer raw_bytes(const Ptr &a, size_t size_in_bytes); class SpanInternalDummyArg; // not implemented diff --git a/src/util/xspan_impl_common.h b/src/util/xspan_impl_common.h index e5b9b7fe..792a6252 100644 --- a/src/util/xspan_impl_common.h +++ b/src/util/xspan_impl_common.h @@ -31,8 +31,7 @@ public: typedef T element_type; typedef typename std::add_lvalue_reference::type reference; -// typedef typename std::add_pointer::type pointer; -typedef T *pointer; +typedef typename std::add_pointer::type pointer; typedef size_t size_type; // befriend all diff --git a/src/util/xspan_impl_ptr.h b/src/util/xspan_impl_ptr.h index e3a60674..3c0fac24 100644 --- a/src/util/xspan_impl_ptr.h +++ b/src/util/xspan_impl_ptr.h @@ -45,7 +45,6 @@ public: typedef T element_type; typedef typename std::add_lvalue_reference::type reference; - // typedef T *pointer; typedef typename std::add_pointer::type pointer; private: @@ -194,7 +193,7 @@ public: // raw access // raw_bytes overload template -inline T *raw_bytes(const Ptr &a, size_t size_in_bytes) { +inline typename Ptr::pointer raw_bytes(const Ptr &a, size_t size_in_bytes) { return a.raw_bytes(size_in_bytes); } diff --git a/src/util/xspan_impl_ptr_or_null.h b/src/util/xspan_impl_ptr_or_null.h index ec0f169d..06eefb5b 100644 --- a/src/util/xspan_impl_ptr_or_null.h +++ b/src/util/xspan_impl_ptr_or_null.h @@ -92,7 +92,8 @@ public: // raw_bytes overload template -inline T *raw_bytes(const PtrOrSpanOrNull &a, size_t size_in_bytes) { +inline typename PtrOrSpanOrNull::pointer raw_bytes(const PtrOrSpanOrNull &a, + size_t size_in_bytes) { return a.raw_bytes(size_in_bytes); } diff --git a/src/util/xspan_impl_ptr_or_span.h b/src/util/xspan_impl_ptr_or_span.h index 7918ddba..b248413b 100644 --- a/src/util/xspan_impl_ptr_or_span.h +++ b/src/util/xspan_impl_ptr_or_span.h @@ -119,7 +119,7 @@ public: // raw_bytes overload template -inline T *raw_bytes(const PtrOrSpan &a, size_t size_in_bytes) { +inline typename PtrOrSpan::pointer raw_bytes(const PtrOrSpan &a, size_t size_in_bytes) { return a.raw_bytes(size_in_bytes); } diff --git a/src/util/xspan_impl_span.h b/src/util/xspan_impl_span.h index bfdd1d6b..7eac5c36 100644 --- a/src/util/xspan_impl_span.h +++ b/src/util/xspan_impl_span.h @@ -119,7 +119,7 @@ public: // raw_bytes overload template -inline T *raw_bytes(const Span &a, size_t size_in_bytes) { +inline typename Span::pointer raw_bytes(const Span &a, size_t size_in_bytes) { return a.raw_bytes(size_in_bytes); }