Skip to content

Commit

Permalink
Clang-format touchup
Browse files Browse the repository at this point in the history
  • Loading branch information
micahsnyder committed Jan 10, 2024
1 parent 481235c commit 81449c5
Show file tree
Hide file tree
Showing 27 changed files with 176 additions and 176 deletions.
2 changes: 1 addition & 1 deletion clamdscan/proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ struct client_parallel_data {
unsigned int id;
const char *file;
struct SCANID *next;
} * ids;
} *ids;
};

/* Sends a proper scan request to clamd and parses its replies
Expand Down
2 changes: 1 addition & 1 deletion libclamav/apm.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "scanners.h"
#include "dconf.h"

//#define DEBUG_APM_PARSE
// #define DEBUG_APM_PARSE

#ifdef DEBUG_APM_PARSE
#define apm_parsemsg(...) cli_dbgmsg(__VA_ARGS__)
Expand Down
32 changes: 16 additions & 16 deletions libclamav/bytecode_vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,17 +286,17 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
*(uint8_t *)&values[p] = x
#define WRITE16(p, x) \
CHECK_GT(func->numBytes, p + 1); \
CHECK_EQ((p) & 1, 0); \
CHECK_EQ((p)&1, 0); \
TRACE_W(x, p, 16); \
*(uint16_t *)&values[p] = x
#define WRITE32(p, x) \
CHECK_GT(func->numBytes, p + 3); \
CHECK_EQ((p) & 3, 0); \
CHECK_EQ((p)&3, 0); \
TRACE_W(x, p, 32); \
*(uint32_t *)&values[p] = x
#define WRITE64(p, x) \
CHECK_GT(func->numBytes, p + 7); \
CHECK_EQ((p) & 7, 0); \
CHECK_EQ((p)&7, 0); \
TRACE_W(x, p, 64); \
*(uint64_t *)&values[p] = x
#define WRITEP(x, p) \
Expand Down Expand Up @@ -346,16 +346,16 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
} \
TRACE_R(x) \
}
#define READPOP(x, p, asize) \
{ \
if ((p) & 0x40000000) { \
unsigned ptr__ = (p) & 0xbfffffff; \
CHECK_GT(func->numBytes, ptr__); \
TRACE_PTR(ptr__, asize); \
x = (void *)&values[ptr__]; \
} else { \
READP(x, p, asize) \
} \
#define READPOP(x, p, asize) \
{ \
if ((p)&0x40000000) { \
unsigned ptr__ = (p)&0xbfffffff; \
CHECK_GT(func->numBytes, ptr__); \
TRACE_PTR(ptr__, asize); \
x = (void *)&values[ptr__]; \
} else { \
READP(x, p, asize) \
} \
}

#define READOLD8(x, p) \
Expand All @@ -364,17 +364,17 @@ static always_inline struct stack_entry *pop_stack(struct stack *stack,
TRACE_R(x)
#define READOLD16(x, p) \
CHECK_GT(func->numBytes, p + 1); \
CHECK_EQ((p) & 1, 0); \
CHECK_EQ((p)&1, 0); \
x = *(uint16_t *)&old_values[p]; \
TRACE_R(x)
#define READOLD32(x, p) \
CHECK_GT(func->numBytes, p + 3); \
CHECK_EQ((p) & 3, 0); \
CHECK_EQ((p)&3, 0); \
x = *(uint32_t *)&old_values[p]; \
TRACE_R(x)
#define READOLD64(x, p) \
CHECK_GT(func->numBytes, p + 7); \
CHECK_EQ((p) & 7, 0); \
CHECK_EQ((p)&7, 0); \
x = *(uint64_t *)&old_values[p]; \
TRACE_R(x)

Expand Down
2 changes: 1 addition & 1 deletion libclamav/c++/bytecode2llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void LLVMInitializePowerPCAsmPrinter();

#include "llvm/IR/Dominators.h"

//#define TIMING
// #define TIMING
#undef TIMING

#include "llvm/Config/llvm-config.h"
Expand Down
2 changes: 1 addition & 1 deletion libclamav/crtmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ static cl_error_t crtmgr_get_recov_data(BIGNUM *sig, cli_crt *x509,
int pad_size;
int keylen;
uint8_t *d = NULL;
BIGNUM *x = NULL;
BIGNUM *x = NULL;
cl_error_t ret;

*buffer = NULL;
Expand Down
76 changes: 38 additions & 38 deletions libclamav/egg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,9 @@ static cl_error_t egg_parse_file_extra_field(egg_handle* handle, egg_file* eggFi
* Comment found. Add comment to our list.
*/
CLI_SAFER_REALLOC_OR_GOTO_DONE(eggFile->comments,
sizeof(char*) * (eggFile->nComments + 1),
free(comment),
status = CL_EMEM);
sizeof(char*) * (eggFile->nComments + 1),
free(comment),
status = CL_EMEM);
eggFile->comments[eggFile->nComments] = comment;
eggFile->nComments++;
}
Expand Down Expand Up @@ -1668,9 +1668,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
} else {
/* Add file to list. */
CLI_SAFER_REALLOC_OR_GOTO_DONE(handle->files,
sizeof(egg_file*) * (handle->nFiles + 1),
egg_free_egg_file(found_file),
status = CL_EMEM);
sizeof(egg_file*) * (handle->nFiles + 1),
egg_free_egg_file(found_file),
status = CL_EMEM);
handle->files[handle->nFiles] = found_file;
handle->nFiles++;
}
Expand All @@ -1690,9 +1690,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
/* Add block to list. */
if (handle->bSolid) {
CLI_SAFER_REALLOC_OR_GOTO_DONE(handle->blocks,
sizeof(egg_block*) * (handle->nBlocks + 1),
egg_free_egg_block(found_block),
status = CL_EMEM);
sizeof(egg_block*) * (handle->nBlocks + 1),
egg_free_egg_block(found_block),
status = CL_EMEM);
handle->blocks[handle->nBlocks] = found_block;
handle->nBlocks++;
} else {
Expand All @@ -1708,9 +1708,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
eggFile = handle->files[handle->nFiles - 1];

CLI_SAFER_REALLOC_OR_GOTO_DONE(eggFile->blocks,
sizeof(egg_block*) * (eggFile->nBlocks + 1),
egg_free_egg_block(found_block),
status = CL_EMEM);
sizeof(egg_block*) * (eggFile->nBlocks + 1),
egg_free_egg_block(found_block),
status = CL_EMEM);
eggFile->blocks[eggFile->nBlocks] = found_block;
eggFile->nBlocks++;
}
Expand Down Expand Up @@ -1786,9 +1786,9 @@ cl_error_t cli_egg_open(fmap_t* map, void** hArchive, char*** comments, uint32_t
* Comment found. Add comment to our list.
*/
CLI_SAFER_REALLOC_OR_GOTO_DONE(handle->comments,
sizeof(char*) * (handle->nComments + 1),
free(comment),
status = CL_EMEM);
sizeof(char*) * (handle->nComments + 1),
free(comment),
status = CL_EMEM);
handle->comments[handle->nComments] = comment;
handle->nComments++;
}
Expand Down Expand Up @@ -1973,9 +1973,9 @@ cl_error_t cli_egg_deflate_decompress(char* compressed, size_t compressed_size,
/* extend output capacity if needed,*/
if (stream.avail_out == 0) {
CLI_SAFER_REALLOC_OR_GOTO_DONE(decoded,
capacity + BUFSIZ,
cli_errmsg("cli_egg_deflate_decompress: cannot reallocate memory for decompressed output\n"),
status = CL_EMEM);
capacity + BUFSIZ,
cli_errmsg("cli_egg_deflate_decompress: cannot reallocate memory for decompressed output\n"),
status = CL_EMEM);
stream.next_out = decoded + capacity;
stream.avail_out = BUFSIZ;
declen += BUFSIZ;
Expand Down Expand Up @@ -2095,9 +2095,9 @@ cl_error_t cli_egg_bzip2_decompress(char* compressed, size_t compressed_size, ch
/* extend output capacity if needed,*/
if (stream.avail_out == 0) {
CLI_SAFER_REALLOC_OR_GOTO_DONE(decoded,
capacity + BUFSIZ,
cli_errmsg("cli_egg_bzip2_decompress: cannot reallocate memory for decompressed output\n");
status = CL_EMEM);
capacity + BUFSIZ,
cli_errmsg("cli_egg_bzip2_decompress: cannot reallocate memory for decompressed output\n");
status = CL_EMEM);
stream.next_out = decoded + capacity;
stream.avail_out = BUFSIZ;
declen += BUFSIZ;
Expand Down Expand Up @@ -2212,9 +2212,9 @@ cl_error_t cli_egg_lzma_decompress(char* compressed, size_t compressed_size, cha
/* extend output capacity if needed,*/
if (stream.avail_out == 0) {
CLI_SAFER_REALLOC_OR_GOTO_DONE(decoded,
capacity + BUFSIZ,
cli_errmsg("cli_egg_lzma_decompress: cannot reallocate memory for decompressed output\n");
status = CL_EMEM);
capacity + BUFSIZ,
cli_errmsg("cli_egg_lzma_decompress: cannot reallocate memory for decompressed output\n");
status = CL_EMEM);
stream.next_out = decoded + capacity;
stream.avail_out = BUFSIZ;
declen += BUFSIZ;
Expand Down Expand Up @@ -2362,10 +2362,10 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
}

CLI_SAFER_REALLOC_OR_GOTO_DONE(decompressed,
(size_t)decompressed_size + currBlock->blockHeader->compress_size,
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
decompressed_size),
status = CL_EMEM);
(size_t)decompressed_size + currBlock->blockHeader->compress_size,
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
decompressed_size),
status = CL_EMEM);

memcpy(decompressed + decompressed_size, currBlock->compressedData, currBlock->blockHeader->compress_size);
decompressed_size += currBlock->blockHeader->compress_size;
Expand All @@ -2387,11 +2387,11 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
}
/* Decompressed block. Add it to the file data */
CLI_SAFER_REALLOC_OR_GOTO_DONE(decompressed,
(size_t)decompressed_size + decompressed_block_size,
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
decompressed_size),
free(decompressed_block),
status = CL_EMEM);
(size_t)decompressed_size + decompressed_block_size,
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
decompressed_size),
free(decompressed_block),
status = CL_EMEM);

memcpy(decompressed + decompressed_size, decompressed_block, decompressed_block_size);
decompressed_size += decompressed_block_size;
Expand All @@ -2416,11 +2416,11 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
}
/* Decompressed block. Add it to the file data */
CLI_SAFER_REALLOC_OR_GOTO_DONE(decompressed,
(size_t)decompressed_size + decompressed_block_size,
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
decompressed_size),
free(decompressed_block),
status = CL_EMEM);
(size_t)decompressed_size + decompressed_block_size,
cli_errmsg("cli_egg_extract_file: Failed to allocate %" PRIu64 " bytes for decompressed file!\n",
decompressed_size),
free(decompressed_block),
status = CL_EMEM);

memcpy(decompressed + decompressed_size, decompressed_block, decompressed_block_size);
decompressed_size += decompressed_block_size;
Expand Down
2 changes: 1 addition & 1 deletion libclamav/entconv.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
typedef struct {
enum encodings encoding;
size_t size;
} * iconv_t;
}* iconv_t;
#endif

static unsigned char tohex[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
Expand Down
4 changes: 2 additions & 2 deletions libclamav/gpt.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
#include "scanners.h"
#include "dconf.h"

//#define DEBUG_GPT_PARSE
//#define DEBUG_GPT_PRINT
// #define DEBUG_GPT_PARSE
// #define DEBUG_GPT_PRINT

#ifdef DEBUG_GPT_PARSE
#define gpt_parsemsg(...) cli_dbgmsg(__VA_ARGS__)
Expand Down
6 changes: 3 additions & 3 deletions libclamav/htmlnorm.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,18 +372,18 @@ void html_tag_arg_add(tag_arguments_t *tags,
int len, i;
tags->count++;
tags->tag = (unsigned char **)cli_max_realloc_or_free(tags->tag,
tags->count * sizeof(char *));
tags->count * sizeof(char *));
if (!tags->tag) {
goto done;
}
tags->value = (unsigned char **)cli_max_realloc_or_free(tags->value,
tags->count * sizeof(char *));
tags->count * sizeof(char *));
if (!tags->value) {
goto done;
}
if (tags->scanContents) {
tags->contents = (unsigned char **)cli_max_realloc_or_free(tags->contents,
tags->count * sizeof(*tags->contents));
tags->count * sizeof(*tags->contents));
if (!tags->contents) {
goto done;
}
Expand Down
2 changes: 1 addition & 1 deletion libclamav/ishield.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ struct IS_CABSTUFF {
unsigned int cabno;
off_t off;
size_t sz;
} * cabs;
} *cabs;
off_t hdr;
size_t hdrsz;
unsigned int cabcnt;
Expand Down
2 changes: 1 addition & 1 deletion libclamav/jpeg.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ cl_error_t cli_parsejpeg(cli_ctx *ctx)
{
cl_error_t status = CL_SUCCESS;

fmap_t *map = NULL;
fmap_t *map = NULL;
jpeg_marker_t marker = JPEG_MARKER_NOT_A_MARKER_0x00, prev_marker, prev_segment = JPEG_MARKER_NOT_A_MARKER_0x00;
uint8_t buff[50]; /* 50 should be sufficient for now */
uint16_t len_u16;
Expand Down
2 changes: 1 addition & 1 deletion libclamav/jsparse/js-norm.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ typedef struct scanner {
size_t lastpos;
enum tokenizer_state state;
enum tokenizer_state last_state;
} * yyscan_t;
} *yyscan_t;

static int yylex(YYSTYPE *lvalp, yyscan_t);
static void yy_scan_bytes(const char *, size_t, yyscan_t scanner);
Expand Down
4 changes: 2 additions & 2 deletions libclamav/mbox.c
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ typedef enum {
* Slows things down a lot and only catches unencoded copies
* of EICAR within bounces, which don't matter
*/
//#define SCAN_UNENCODED_BOUNCES
// #define SCAN_UNENCODED_BOUNCES

typedef struct mbox_ctx {
const char *dir;
Expand Down Expand Up @@ -265,7 +265,7 @@ static bool haveTooManyMIMEArguments(size_t argCnt, cli_ctx *ctx, bool *heuristi
* protocol="application/pgp-encrypted" \
*/
#define X_BFILE RELATED /* \
* BeOS, expert two parts: the file and its \
* BeOS, expert two parts: the file and its \
* attributes. The attributes part comes as \
* Content-Type: application/x-be_attribute \
* name="foo" \
Expand Down
4 changes: 2 additions & 2 deletions libclamav/mbr.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
#include "scanners.h"
#include "dconf.h"

//#define DEBUG_MBR_PARSE
//#define DEBUG_EBR_PARSE
// #define DEBUG_MBR_PARSE
// #define DEBUG_EBR_PARSE

#ifdef DEBUG_MBR_PARSE
#define mbr_parsemsg(...) cli_dbgmsg(__VA_ARGS__)
Expand Down
Loading

0 comments on commit 81449c5

Please sign in to comment.