all: minor cleanups

This commit is contained in:
Markus F.X.J. Oberhumer
2024-03-08 11:52:44 +01:00
parent 839a78f2e0
commit 52d9b53b74
14 changed files with 208 additions and 63 deletions
+1
View File
@@ -74,6 +74,7 @@ static forceinline constexpr bool use_simple_mcheck() noexcept { return true; }
**************************************************************************/
MemBuffer::MemBuffer(upx_uint64_t bytes) : MemBufferBase<byte>() {
static_assert(element_size == 1);
alloc(bytes);
debug_set(debug.last_return_address_alloc, upx_return_address());
}
+2 -1
View File
@@ -204,7 +204,8 @@ public:
// explicit conversion
void *getVoidPtr() noexcept { return (void *) ptr; }
const void *getVoidPtr() const noexcept { return (const void *) ptr; }
unsigned getSize() const noexcept { return size_in_bytes; }
unsigned getSizeInBytes() const noexcept { return size_in_bytes; }
unsigned getSize() const noexcept { return size_in_bytes; } // note: element_size == 1
// util
noinline void fill(unsigned off, unsigned len, int value) may_throw;
+59
View File
@@ -0,0 +1,59 @@
/* system_defs.h -- system defines
This file is part of the UPX executable compressor.
Copyright (C) 1996-2024 Markus Franz Xaver Johannes Oberhumer
All Rights Reserved.
UPX and the UCL library are free software; you can redistribute them
and/or modify them under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING.
If not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
<markus@oberhumer.com>
*/
#pragma once
#if !defined(_FILE_OFFSET_BITS)
#define _FILE_OFFSET_BITS 64
#endif
#if !defined(__STDC_FORMAT_MACROS) // this is needed for some older glibc/mingw versions
#define __STDC_FORMAT_MACROS 1
#endif
#if defined(_WIN32) && defined(__MINGW32__) && (defined(__clang__) || defined(__GNUC__))
#if !defined(__USE_MINGW_ANSI_STDIO)
#define __USE_MINGW_ANSI_STDIO 1
#endif
#endif
#if defined(_WIN32)
// disable silly warnings about using "deprecated" POSIX functions like fopen()
#if !defined(_CRT_NONSTDC_NO_DEPRECATE)
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif
#if !defined(_CRT_NONSTDC_NO_WARNINGS)
#define _CRT_NONSTDC_NO_WARNINGS 1
#endif
#if !defined(_CRT_SECURE_NO_DEPRECATE)
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#if !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS 1
#endif
#endif // _WIN32
/* vim:set ts=4 sw=4 et: */