mirror of https://github.com/upx/upx.git
all: clang-format-15.0.6
This commit is contained in:
parent
91aa5b55ab
commit
d873a26f41
|
@ -3,26 +3,40 @@
|
|||
# for clang-format-15.0.6 from https://github.com/upx/upx-stubtools/releases
|
||||
---
|
||||
BasedOnStyle: LLVM
|
||||
AccessModifierOffset: -4
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
ColumnLimit: 100
|
||||
IndentWidth: 4
|
||||
---
|
||||
Language: Cpp
|
||||
AccessModifierOffset: -4
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
AttributeMacros:
|
||||
- __acc_cdecl
|
||||
- __acc_cdecl_atexit
|
||||
- __acc_cdecl_qsort
|
||||
- __acc_cdecl_sighandler
|
||||
- __acc_forceinline
|
||||
- __acc_noinline
|
||||
- __acc_static_noinline
|
||||
- __acc_static_forceinline
|
||||
EmptyLineBeforeAccessModifier: Leave
|
||||
SortIncludes: false
|
||||
SpaceAfterCStyleCast: true
|
||||
Standard: Cpp03
|
||||
StatementMacros: [
|
||||
ACCCHK_ASSERT,
|
||||
ACCCHK_ASSERT_IS_SIGNED_T,
|
||||
ACCCHK_ASSERT_IS_UNSIGNED_T,
|
||||
ACCCHK_ASSERT_SIGN_T,
|
||||
ACC_BLOCK_BEGIN,
|
||||
ACC_COMPILE_TIME_ASSERT,
|
||||
ACC_COMPILE_TIME_ASSERT_HEADER,
|
||||
ACC_CXX_DISABLE_NEW_DELETE,
|
||||
ACC_CXX_TRIGGER_FUNCTION,
|
||||
ACC_CXX_TRIGGER_FUNCTION_IMPL,
|
||||
CLANG_FORMAT_DUMMY_STATEMENT,
|
||||
COMPILE_TIME_ASSERT,
|
||||
COMPILE_TIME_ASSERT_ALIGNED1,
|
||||
]
|
||||
StatementMacros:
|
||||
- ACCCHK_ASSERT
|
||||
- ACCCHK_ASSERT_IS_SIGNED_T
|
||||
- ACCCHK_ASSERT_IS_UNSIGNED_T
|
||||
- ACCCHK_ASSERT_SIGN_T
|
||||
- ACC_BLOCK_BEGIN
|
||||
- ACC_COMPILE_TIME_ASSERT
|
||||
- ACC_COMPILE_TIME_ASSERT_HEADER
|
||||
- ACC_CXX_DISABLE_NEW_DELETE
|
||||
- ACC_CXX_TRIGGER_FUNCTION
|
||||
- ACC_CXX_TRIGGER_FUNCTION_IMPL
|
||||
- CLANG_FORMAT_DUMMY_STATEMENT
|
||||
- COMPILE_TIME_ASSERT
|
||||
- COMPILE_TIME_ASSERT_ALIGNED1
|
||||
WhitespaceSensitiveMacros:
|
||||
- ACC_PP_MACRO_EXPAND
|
||||
- ACC_PP_STRINGIZE
|
||||
...
|
||||
|
|
|
@ -57,7 +57,7 @@ __acc_static_forceinline upx_uint64_t get_ne64(const void *p) {
|
|||
}
|
||||
|
||||
__acc_static_forceinline void set_ne16(void *p, unsigned vv) {
|
||||
upx_uint16_t v = (upx_uint16_t)(vv & 0xffff);
|
||||
upx_uint16_t v = (upx_uint16_t) (vv & 0xffff);
|
||||
upx_memcpy_inline(p, &v, sizeof(v));
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ error:
|
|||
#undef NULL
|
||||
#define NULL nullptr
|
||||
#include <lzma-sdk/C/Common/MyInitGuid.h>
|
||||
//#include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.h>
|
||||
// #include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.h>
|
||||
#include <lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.h>
|
||||
|
||||
namespace MyLzma {
|
||||
|
@ -298,12 +298,12 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS
|
|||
|
||||
#include <lzma-sdk/C/Common/Alloc.cpp>
|
||||
#include <lzma-sdk/C/Common/CRC.cpp>
|
||||
//#include <lzma-sdk/C/7zip/Common/InBuffer.cpp>
|
||||
// #include <lzma-sdk/C/7zip/Common/InBuffer.cpp>
|
||||
#include <lzma-sdk/C/7zip/Common/OutBuffer.cpp>
|
||||
#include <lzma-sdk/C/7zip/Common/StreamUtils.cpp>
|
||||
#include <lzma-sdk/C/7zip/Compress/LZ/LZInWindow.cpp>
|
||||
//#include <lzma-sdk/C/7zip/Compress/LZ/LZOutWindow.cpp>
|
||||
//#include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.cpp>
|
||||
// #include <lzma-sdk/C/7zip/Compress/LZ/LZOutWindow.cpp>
|
||||
// #include <lzma-sdk/C/7zip/Compress/LZMA/LZMADecoder.cpp>
|
||||
#include <lzma-sdk/C/7zip/Compress/LZMA/LZMAEncoder.cpp>
|
||||
#include <lzma-sdk/C/7zip/Compress/RangeCoder/RangeCoderBit.cpp>
|
||||
#undef RC_NORMALIZE
|
||||
|
|
|
@ -198,8 +198,7 @@ void ElfLinker::preprocessSections(char *start, char const *end) {
|
|||
char *n = strstr(start, name);
|
||||
n[strlen(name)] = 0;
|
||||
addSection(n, input + offset, size, align);
|
||||
|
||||
// printf("section %s preprocessed\n", n);
|
||||
NO_printf("section %s preprocessed\n", n);
|
||||
}
|
||||
}
|
||||
addSection("*ABS*", nullptr, 0, 0);
|
||||
|
@ -224,21 +223,21 @@ void ElfLinker::preprocessSymbols(char *start, char const *end) {
|
|||
assert(offset == 0);
|
||||
}
|
||||
#if 0
|
||||
else if (sscanf(start, "%x%*8c %1023s %*x %1023s",
|
||||
else if (sscanf(start, "%x%*8c %1023s %*x %1023s", &offset, section, symbol) == 3)
|
||||
#else
|
||||
// work around broken scanf() implementations
|
||||
// http://bugs.winehq.org/show_bug.cgi?id=10401 (fixed in Wine 0.9.58)
|
||||
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s",
|
||||
else if (sscanf(start, "%x%*c%*c%*c%*c%*c%*c%*c%*c %1023s %*x %1023s", &offset, section,
|
||||
symbol) == 3)
|
||||
#endif
|
||||
&offset, section, symbol) == 3)
|
||||
{
|
||||
char *s = strstr(start, symbol);
|
||||
s[strlen(symbol)] = 0;
|
||||
if (strcmp(section, "*UND*") == 0)
|
||||
offset = 0xdeaddead;
|
||||
assert(strcmp(section, "*ABS*") != 0);
|
||||
addSymbol(s, section, offset);
|
||||
}
|
||||
char *s = strstr(start, symbol);
|
||||
s[strlen(symbol)] = 0;
|
||||
if (strcmp(section, "*UND*") == 0)
|
||||
offset = 0xdeaddead;
|
||||
assert(strcmp(section, "*ABS*") != 0);
|
||||
addSymbol(s, section, offset);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,8 +289,8 @@ void ElfLinker::preprocessRelocations(char *start, char const *end) {
|
|||
|
||||
if (section) {
|
||||
addRelocation(section->name, offset, t, symbol, add);
|
||||
// printf("relocation %s %s %x %llu preprocessed\n", section->name, symbol, offset,
|
||||
// (unsigned long long) add);
|
||||
NO_printf("relocation %s %s %x %llu preprocessed\n", section->name, symbol, offset,
|
||||
(unsigned long long) add);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -317,7 +316,7 @@ ElfLinker::Symbol *ElfLinker::findSymbol(const char *name, bool fatal) const {
|
|||
|
||||
ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata, int slen,
|
||||
unsigned p2align) {
|
||||
// printf("addSection: %s len=%d align=%d\n", sname, slen, p2align);
|
||||
NO_printf("addSection: %s len=%d align=%d\n", sname, slen, p2align);
|
||||
if (!sdata && (!strcmp("ABS*", sname) || !strcmp("UND*", sname)))
|
||||
return nullptr;
|
||||
if (update_capacity(nsections, &nsections_capacity))
|
||||
|
@ -335,7 +334,7 @@ ElfLinker::Section *ElfLinker::addSection(const char *sname, const void *sdata,
|
|||
|
||||
ElfLinker::Symbol *ElfLinker::addSymbol(const char *name, const char *section,
|
||||
upx_uint64_t offset) {
|
||||
// printf("addSymbol: %s %s 0x%x\n", name, section, offset);
|
||||
NO_printf("addSymbol: %s %s 0x%llx\n", name, section, offset);
|
||||
if (update_capacity(nsymbols, &nsymbols_capacity))
|
||||
symbols = static_cast<Symbol **>(realloc(symbols, nsymbols_capacity * sizeof(Symbol *)));
|
||||
assert(symbols != nullptr);
|
||||
|
@ -410,7 +409,7 @@ int ElfLinker::addLoader(const char *sname) {
|
|||
}
|
||||
memcpy(output + outputlen, section->input, section->size);
|
||||
section->output = output + outputlen;
|
||||
// printf("section added: 0x%04x %3d %s\n", outputlen, section->size, section->name);
|
||||
NO_printf("section added: 0x%04x %3d %s\n", outputlen, section->size, section->name);
|
||||
outputlen += section->size;
|
||||
|
||||
if (head) {
|
||||
|
@ -479,11 +478,12 @@ void ElfLinker::relocate() {
|
|||
value = rel->value->section->offset + rel->value->offset + rel->add;
|
||||
}
|
||||
upx_byte *location = rel->section->output + rel->offset;
|
||||
// printf("%-28s %-28s %-10s %#16llx %#16llx\n", rel->section->name, rel->value->name,
|
||||
// rel->type, (long long) value, (long long) value - rel->section->offset - rel->offset);
|
||||
// printf(" %llx %d %llx %d %llx : %d\n", (long long) value,
|
||||
// (int)rel->value->section->offset,
|
||||
// rel->value->offset, rel->offset, (long long) rel->add, *location);
|
||||
NO_printf("%-28s %-28s %-10s %#16llx %#16llx\n", rel->section->name, rel->value->name,
|
||||
rel->type, (long long) value,
|
||||
(long long) value - rel->section->offset - rel->offset);
|
||||
NO_printf(" %llx %d %llx %d %llx :%d\n", (long long) value,
|
||||
(int) rel->value->section->offset, rel->value->offset, rel->offset,
|
||||
(long long) rel->add, *location);
|
||||
relocate1(rel, location, value, rel->type);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
static const CLANG_FORMAT_DUMMY_STATEMENT
|
||||
#include "stub/i086-dos16.com.h"
|
||||
|
||||
//#define TESTING 1
|
||||
// #define TESTING 1
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
static const CLANG_FORMAT_DUMMY_STATEMENT
|
||||
#include "stub/m68k-atari.tos.h"
|
||||
|
||||
//#define TESTING 1
|
||||
// #define TESTING 1
|
||||
|
||||
/*************************************************************************
|
||||
//
|
||||
|
|
|
@ -81,7 +81,9 @@ struct screen_data_t {
|
|||
};
|
||||
|
||||
/* atExit information */
|
||||
static struct { int cursor_shape; } ae = {-1};
|
||||
static struct {
|
||||
int cursor_shape;
|
||||
} ae = {-1};
|
||||
|
||||
#if USE_SCROLLBACK
|
||||
static __inline__ void sb_add(screen_t *this, int *val, int inc) {
|
||||
|
@ -107,7 +109,7 @@ static void refresh(screen_t *this) { UNUSED(this); }
|
|||
|
||||
static __inline__ Cell make_cell(screen_t *this, int ch, int attr) {
|
||||
UNUSED(this);
|
||||
return (Cell)(((attr & 0xff) << 8) | (ch & 0xff));
|
||||
return (Cell) (((attr & 0xff) << 8) | (ch & 0xff));
|
||||
}
|
||||
|
||||
static int getMode(const screen_t *this) {
|
||||
|
|
|
@ -76,7 +76,7 @@ struct screen_data_t {
|
|||
CHAR_INFO empty_line[256];
|
||||
};
|
||||
|
||||
#define P(x) ((SHORT)(x))
|
||||
#define P(x) ((SHORT) (x))
|
||||
|
||||
static const COORD pos00 = {0, 0};
|
||||
static const COORD size11 = {1, 1};
|
||||
|
@ -111,12 +111,12 @@ static int getFg(const screen_t *this) { return this->data->attr & mask_fg; }
|
|||
static int getBg(const screen_t *this) { return this->data->attr & mask_bg; }
|
||||
|
||||
static void setFg(screen_t *this, int fg) {
|
||||
this->data->attr = (WORD)((this->data->attr & mask_bg) | (fg & mask_fg));
|
||||
this->data->attr = (WORD) ((this->data->attr & mask_bg) | (fg & mask_fg));
|
||||
SetConsoleTextAttribute(this->data->ho, this->data->attr);
|
||||
}
|
||||
|
||||
static void setBg(screen_t *this, int bg) {
|
||||
this->data->attr = (WORD)((this->data->attr & mask_fg) | (bg & mask_bg));
|
||||
this->data->attr = (WORD) ((this->data->attr & mask_fg) | (bg & mask_bg));
|
||||
SetConsoleTextAttribute(this->data->ho, this->data->attr);
|
||||
}
|
||||
|
||||
|
|
|
@ -152,7 +152,7 @@ void MemBuffer::fill(unsigned off, unsigned len, int value) {
|
|||
//
|
||||
**************************************************************************/
|
||||
|
||||
#define PTR_BITS(p) ((unsigned) ((upx_uintptr_t)(p) &0xffffffff))
|
||||
#define PTR_BITS(p) ((unsigned) ((upx_uintptr_t) (p) &0xffffffff))
|
||||
#define MAGIC1(p) ((PTR_BITS(p) ^ 0xfefdbeeb) | 1)
|
||||
#define MAGIC2(p) ((PTR_BITS(p) ^ 0xfefdbeeb ^ 0x80024011) | 1)
|
||||
|
||||
|
|
Loading…
Reference in New Issue