]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix compile warnings
authorVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 16 Feb 2026 16:00:52 +0000 (16:00 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Mon, 16 Feb 2026 16:00:52 +0000 (16:00 +0000)
- Fix hexdigests array size (use empty brackets for compiler to determine)
- Fix char8_t to char32_t implicit conversion in replxx terminal
- Fix hex format specifier in hyperscan debug logging (%xd not %x)
- Add forward declaration for struct rspamd_external_libs_ctx
- Remove unused is_msgpack variable in protocol.c
- Fix logic bug: c >= 'a' || c <= 'f' should be && in hex parsing

contrib/libottery/chacha_merged.c
contrib/replxx/src/terminal.cxx
src/libserver/hyperscan_tools.cxx
src/libserver/logger/logger.c
src/libserver/protocol.c
src/libserver/ssl_util.h
src/libserver/url.c
src/libutil/str_util.c
src/libutil/util.c
src/lua/lua_logger.c
src/lua/lua_tcp.c

index c31a8bbd57734e8b134b835025c9e66cb3c9442c..3958574eeff7c208914ef1469574583761788a13 100644 (file)
@@ -34,7 +34,7 @@ Public domain.
   a = PLUS(a,b); d = ROTATE(XOR(d,a), 8); \
   c = PLUS(c,d); b = ROTATE(XOR(b,c), 7);
 
-static const char sigma[16] = "expand 32-byte k";
+static const char sigma[] = "expand 32-byte k";
 
 static void ECRYPT_keysetup(ECRYPT_ctx *x,const u8 *k,u32 ivbits)
 {
index e618219e5dbf184ab2cc34b77487af69c4933b10..bff62a1c4d856f47c0e4b975f02b00db527d343c 100644 (file)
@@ -295,7 +295,7 @@ char32_t read_unicode_character(void) {
                if (nread <= 0) return 0;
                if (c <= 0x7F || locale::is8BitEncoding) { // short circuit ASCII
                        utf8Count = 0;
-                       return c;
+                       return static_cast<char32_t>(c);
                } else if (utf8Count < sizeof(utf8String) - 1) {
                        utf8String[utf8Count++] = c;
                        utf8String[utf8Count] = 0;
index 2922b8e611de6cd0b379b8734d810962fe40721d..d19d674ccde005c401e5b8c0cc95339fa662c464 100644 (file)
@@ -397,7 +397,7 @@ hs_get_runtime_db_version() -> std::uint32_t
                if (sscanf(version_str, "%u.%u.%u", &major, &minor, &patch) == 3) {
                        // Format: (major << 24) | (minor << 16) | (patch << 8) | 0
                        cached_version = (major << 24) | (minor << 16) | (patch << 8);
-                       msg_debug_hyperscan("detected hyperscan runtime version: %s (0x%08x)",
+                       msg_debug_hyperscan("detected hyperscan runtime version: %s (0x%08xd)",
                                                                version_str, cached_version);
                }
                else {
@@ -405,7 +405,7 @@ hs_get_runtime_db_version() -> std::uint32_t
                        // Fallback to compile-time version if available
 #ifdef HS_DB_VERSION
                        cached_version = HS_DB_VERSION;
-                       msg_debug_hyperscan("using compile-time hyperscan version: 0x%08x", cached_version);
+                       msg_debug_hyperscan("using compile-time hyperscan version: 0x%08xd", cached_version);
 #else
                        cached_version = 0;
 #endif
index 37741743cb69d57bb196ef6d28916e56ff8d59f5..5f558cc07ea293a2ffae6efc743a1c2d67b4206f 100644 (file)
@@ -980,7 +980,7 @@ char *
 rspamd_log_line_hex_escape(const unsigned char *src, gsize srclen,
                                                   char *dst, gsize dstlen)
 {
-       static const char hexdigests[16] = "0123456789ABCDEF";
+       static const char hexdigests[] = "0123456789ABCDEF";
        char *d = dst;
 
        static uint32_t escape[] = {
index 092c4855dddce6fe5fcbf317a78e1ca388ce8891..69a21fcfcf02c5c78b6eb630935cc615d4107889 100644 (file)
@@ -2572,7 +2572,6 @@ rspamd_protocol_handle_v3_request(struct rspamd_task *task,
 
        /* Parse metadata as UCL (detect JSON vs msgpack from Content-Type) */
        struct ucl_parser *parser;
-       gboolean is_msgpack = FALSE;
 
        if (metadata_part->content_type &&
                metadata_part->content_type_len > 0 &&
@@ -2580,7 +2579,6 @@ rspamd_protocol_handle_v3_request(struct rspamd_task *task,
                                                                                 metadata_part->content_type_len,
                                                                                 "msgpack",
                                                                                 sizeof("msgpack") - 1) != -1) {
-               is_msgpack = TRUE;
                parser = ucl_parser_new(UCL_PARSER_SAFE_FLAGS);
                ucl_parser_add_chunk_full(parser, (const unsigned char *) metadata_part->data,
                                                                  metadata_part->data_len,
index 0a042dbff61a0339ed26c7f1eb02faedeee8091b..647530710c11b72018af45d8996669d07be25ae7 100644 (file)
@@ -25,6 +25,7 @@ extern "C" {
 #endif
 
 struct rspamd_ssl_connection;
+struct rspamd_external_libs_ctx;
 
 typedef void (*rspamd_ssl_handler_t)(int fd, short what, gpointer d);
 
index 90d64af9501612db77ac8bb38a0972db60e1da89..2147fb780d978cd024ecb48a2d0a0bad069cd3ad 100644 (file)
@@ -4214,7 +4214,7 @@ rspamd_url_encode(struct rspamd_url *url, gsize *pdlen,
                                  rspamd_mempool_t *pool)
 {
        unsigned char *dest, *d, *dend;
-       static const char hexdigests[16] = "0123456789ABCDEF";
+       static const char hexdigests[] = "0123456789ABCDEF";
        unsigned int i;
        gsize dlen = 0;
 
index b73593653ec7b56fc39b48692c5a90b0c5cd256f..f59ff4dd407cf8ed3f523eeb96e5dfcd0c14137c 100644 (file)
@@ -578,7 +578,7 @@ rspamd_xstrtoul(const char *s, gsize len, gulong *value)
                                v += c;
                        }
                }
-               else if (c >= 'a' || c <= 'f') {
+               else if (c >= 'a' && c <= 'f') {
                        c = c - 'a' + 10;
                        if (v > cutoff || (v == cutoff && (uint8_t) c > cutlim)) {
                                /* Range error */
@@ -1450,7 +1450,7 @@ rspamd_encode_qp_fold(const unsigned char *in, gsize inlen, int str_len,
        char *out;
        int ch, last_sp;
        const unsigned char *end = in + inlen, *p = in;
-       static const char hexdigests[16] = "0123456789ABCDEF";
+       static const char hexdigests[] = "0123456789ABCDEF";
 
        while (p < end) {
                ch = *p;
@@ -2503,7 +2503,7 @@ int rspamd_encode_hex_buf(const unsigned char *in, gsize inlen, char *out,
 {
        char *o, *end;
        const unsigned char *p;
-       static const char hexdigests[16] = "0123456789abcdef";
+       static const char hexdigests[] = "0123456789abcdef";
 
        end = out + outlen;
        o = out;
@@ -3194,7 +3194,7 @@ rspamd_encode_qp2047_buf(const char *in, gsize inlen,
                                                 char *out, gsize outlen)
 {
        char *o = out, *end = out + outlen, c;
-       static const char hexdigests[16] = "0123456789ABCDEF";
+       static const char hexdigests[] = "0123456789ABCDEF";
 
        while (inlen > 0 && o < end) {
                c = *in;
@@ -3454,7 +3454,7 @@ rspamd_str_regexp_escape(const char *pattern, gsize slen,
        const char *p, *end = pattern + slen;
        char *res, *d, t, *tmp_utf = NULL, *dend;
        gsize len;
-       static const char hexdigests[16] = "0123456789abcdef";
+       static const char hexdigests[] = "0123456789abcdef";
 
        len = 0;
        p = pattern;
index 7714195c4b5c9215eba6e43236130f1426318757..2f432c253eaedd2774e65a5697f64ed824e66d7f 100644 (file)
@@ -1588,7 +1588,7 @@ rspamd_get_calendar_ticks(void)
 
 void rspamd_random_hex(char *buf, uint64_t len)
 {
-       static const char hexdigests[16] = "0123456789abcdef";
+       static const char hexdigests[] = "0123456789abcdef";
        int64_t i;
 
        g_assert(len > 0);
index 30cd53a2bcb9dfad5ef6be103e531f65ad5c6522..2145d408633f1cb321b402519e7ce7c0bcde68f1 100644 (file)
@@ -619,7 +619,7 @@ lua_logger_out_str(lua_State *L, int pos,
                                   char *outbuf, gsize len,
                                   enum lua_logger_escape_type esc_type)
 {
-       static const char hexdigests[16] = "0123456789abcdef";
+       static const char hexdigests[] = "0123456789abcdef";
        gsize slen;
        const unsigned char *str = lua_tolstring(L, pos, &slen);
        unsigned char c;
index bea8d2ef9bffeefc063c646a0d92a9cfe8c515ce..62df4a4c376e0904949a8f1550a8f946fa3129be 100644 (file)
@@ -2027,7 +2027,7 @@ lua_tcp_connect_sync(lua_State *L)
        cbd = g_new0(struct lua_tcp_cbdata, 1);
 
        if (task) {
-               static const char hexdigests[16] = "0123456789abcdef";
+               static const char hexdigests[] = "0123456789abcdef";
 
                cfg = task->cfg;
                ev_base = task->event_loop;