From 4695e20113490869eb05cb0be78ed11400294fa4 Mon Sep 17 00:00:00 2001 From: Micah Snyder Date: Sat, 13 Apr 2024 14:39:19 -0400 Subject: [PATCH] clam-format touchup --- libclamav/filetypes_int.h | 2 +- libclamav/hwp.c | 1 - libclamav/mbox.c | 4 ++-- libclamav/others.h | 24 ++++++++++++------------ libclamav/scanners.c | 1 + libclamav/sis.c | 2 +- libclamav_rust/src/alz.rs | 6 ++++-- libclamav_rust/src/lib.rs | 2 +- 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/libclamav/filetypes_int.h b/libclamav/filetypes_int.h index 256f40c5c5..397c41a49c 100644 --- a/libclamav/filetypes_int.h +++ b/libclamav/filetypes_int.h @@ -301,6 +301,6 @@ static const char *ftypes_int[] = { "1:2:2d6c68(30|31|32|33|34|35|36|37|64|78)2d:LHA or LZH archive:CL_TYPE_ANY:CL_TYPE_LHA_LZH:210", "1:2:2d6c7a(73|34|35)2d:LHA archive using .LZS extension:CL_TYPE_ANY:CL_TYPE_LHA_LZH:210", "1:2:2d706d302d:LHA archive using PMarc (.PMA) extension:CL_TYPE_ANY:CL_TYPE_LHA_LZH:210", - "0:0:414c5a01:ALZ:CL_TYPE_ANY:CL_TYPE_ALZ:210", + "0:0:414c5a01:ALZ:CL_TYPE_ANY:CL_TYPE_ALZ:210", NULL}; #endif diff --git a/libclamav/hwp.c b/libclamav/hwp.c index 763775109f..afa73eaaea 100644 --- a/libclamav/hwp.c +++ b/libclamav/hwp.c @@ -1828,7 +1828,6 @@ static cl_error_t hwp3_cb(void *cbdata, int fd, const char *filepath, cli_ctx *c if (SCAN_COLLECT_METADATA) cli_jsonint(ctx->wrkproperty, "ParagraphCount", p); - last = 0; /* 'additional information block #1's - attachments and media */ while (!last && ((ret = parsehwp3_infoblk_1(ctx, map, &offset, &last)) == CL_SUCCESS)) continue; diff --git a/libclamav/mbox.c b/libclamav/mbox.c index f069b5ef22..23f577002b 100644 --- a/libclamav/mbox.c +++ b/libclamav/mbox.c @@ -3217,7 +3217,7 @@ parseMimeHeader(message *m, const char *cmd, const table_t *rfc821Table, const c #ifdef CL_THREAD_SAFE s = strtok_r(NULL, ";", &strptr); #else - s = strtok(NULL, ";"); + s = strtok(NULL, ";"); #endif if (s == NULL) break; @@ -4387,7 +4387,7 @@ do_multipart(message *mainMessage, message **messages, int i, mbox_status *rc, m * This can save a lot of memory */ messageDestroy(messages[i]); - messages[i] = NULL; + messages[i] = NULL; mctx->wrkobj = thisobj; if (body) { diff --git a/libclamav/others.h b/libclamav/others.h index b2a78b1006..8cebf78d35 100644 --- a/libclamav/others.h +++ b/libclamav/others.h @@ -587,16 +587,16 @@ extern LIBCLAMAV_EXPORT int have_rar; /* based on macros from A. Melnikoff */ #define cbswap16(v) (((v & 0xff) << 8) | (((v) >> 8) & 0xff)) -#define cbswap32(v) ((((v) & 0x000000ff) << 24) | (((v) & 0x0000ff00) << 8) | \ - (((v) & 0x00ff0000) >> 8) | (((v) & 0xff000000) >> 24)) -#define cbswap64(v) ((((v) & 0x00000000000000ffULL) << 56) | \ - (((v) & 0x000000000000ff00ULL) << 40) | \ - (((v) & 0x0000000000ff0000ULL) << 24) | \ - (((v) & 0x00000000ff000000ULL) << 8) | \ - (((v) & 0x000000ff00000000ULL) >> 8) | \ - (((v) & 0x0000ff0000000000ULL) >> 24) | \ - (((v) & 0x00ff000000000000ULL) >> 40) | \ - (((v) & 0xff00000000000000ULL) >> 56)) +#define cbswap32(v) ((((v)&0x000000ff) << 24) | (((v)&0x0000ff00) << 8) | \ + (((v)&0x00ff0000) >> 8) | (((v)&0xff000000) >> 24)) +#define cbswap64(v) ((((v)&0x00000000000000ffULL) << 56) | \ + (((v)&0x000000000000ff00ULL) << 40) | \ + (((v)&0x0000000000ff0000ULL) << 24) | \ + (((v)&0x00000000ff000000ULL) << 8) | \ + (((v)&0x000000ff00000000ULL) >> 8) | \ + (((v)&0x0000ff0000000000ULL) >> 24) | \ + (((v)&0x00ff000000000000ULL) >> 40) | \ + (((v)&0xff00000000000000ULL) >> 56)) #ifndef HAVE_ATTRIB_PACKED #define __attribute__(x) @@ -822,8 +822,8 @@ size_t cli_recursion_stack_get_size(cli_ctx *ctx, int index); /* used by: spin, yc (C) aCaB */ #define __SHIFTBITS(a) (sizeof(a) << 3) #define __SHIFTMASK(a) (__SHIFTBITS(a) - 1) -#define CLI_ROL(a, b) a = (a << ((b) & __SHIFTMASK(a))) | (a >> ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a))) -#define CLI_ROR(a, b) a = (a >> ((b) & __SHIFTMASK(a))) | (a << ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a))) +#define CLI_ROL(a, b) a = (a << ((b)&__SHIFTMASK(a))) | (a >> ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a))) +#define CLI_ROR(a, b) a = (a >> ((b)&__SHIFTMASK(a))) | (a << ((__SHIFTBITS(a) - (b)) & __SHIFTMASK(a))) /* Implementation independent sign-extended signed right shift */ #ifdef HAVE_SAR diff --git a/libclamav/scanners.c b/libclamav/scanners.c index 0831c56ef0..6d15f9d6be 100644 --- a/libclamav/scanners.c +++ b/libclamav/scanners.c @@ -4550,6 +4550,7 @@ cl_error_t cli_magic_scan(cli_ctx *ctx, cli_file_t type) if (SCAN_PARSE_ONENOTE && (DCONF_ARCH & DOC_CONF_ONENOTE)) ret = scan_onenote(ctx); break; + case CL_TYPE_ALZ: if (SCAN_PARSE_ARCHIVE && (DCONF_ARCH & ARCH_CONF_ALZ)) { ret = cli_scanalz(ctx); diff --git a/libclamav/sis.c b/libclamav/sis.c index c3de1983c0..5a6b5d6089 100644 --- a/libclamav/sis.c +++ b/libclamav/sis.c @@ -628,7 +628,7 @@ enum { T_INVALID, const char *sisfields[] = {"Invalid", "String", "Array", "Compressed", "Version", "VersionRange", "Date", "Time", "DateTime", "Uid", "Unused", "Language", "Contents", "Controller", "Info", "SupportedLanguages", "SupportedOptions", "Prerequisites", "Dependency", "Properties", "Property", "Signatures", "CertificateChain", "Logo", "FileDescription", "Hash", "If", "ElseIf", "InstallBlock", "Expression", "Data", "DataUnit", "FileData", "SupportedOption", "ControllerChecksum", "DataChecksum", "Signature", "Blob", "SignatureAlgorithm", "SignatureCertificateChain", "DataIndex", "Capabilities"}; -#define ALIGN4(x) (((x) & ~3) + ((((x) & 1) | (((x) >> 1) & 1)) << 2)) +#define ALIGN4(x) (((x) & ~3) + ((((x)&1) | (((x) >> 1) & 1)) << 2)) #define HERE printf("here\n"), abort(); diff --git a/libclamav_rust/src/alz.rs b/libclamav_rust/src/alz.rs index 41d0b292c7..56674fb9c6 100644 --- a/libclamav_rust/src/alz.rs +++ b/libclamav_rust/src/alz.rs @@ -1,5 +1,5 @@ /* - * ALZ archive extraction. + * ALZ archive extraction. * * Copyright (C) 2024 Cisco Systems, Inc. and/or its affiliates. All rights reserved. * @@ -308,7 +308,9 @@ impl AlzLocalFileHeader { } if self.is_data_descriptor() { - return Err(Error::UnsupportedFeature("Data Descriptors are Unsupported")); + return Err(Error::UnsupportedFeature( + "Data Descriptors are Unsupported", + )); } Ok(()) diff --git a/libclamav_rust/src/lib.rs b/libclamav_rust/src/lib.rs index 3ff2d0e0c3..7db023a234 100644 --- a/libclamav_rust/src/lib.rs +++ b/libclamav_rust/src/lib.rs @@ -23,6 +23,7 @@ /// cbindgen:ignore pub mod sys; +pub mod alz; pub mod cdiff; pub mod css_image_extract; pub mod ctx; @@ -34,4 +35,3 @@ pub mod logging; pub mod onenote; pub mod scanners; pub mod util; -pub mod alz;