diff options
author | Oto Šťáva <oto.stava@nic.cz> | 2024-05-29 16:04:45 +0200 |
---|---|---|
committer | Oto Šťáva <oto.stava@nic.cz> | 2024-06-04 13:05:00 +0200 |
commit | a805ad6355812ed21669ca99ebb28cff245e7374 (patch) | |
tree | 0be7a9f981f6459db1cc52ffffa37e299777e27c /lib | |
parent | daemon/session2: optimize allocations (diff) | |
download | knot-resolver-a805ad6355812ed21669ca99ebb28cff245e7374.tar.xz knot-resolver-a805ad6355812ed21669ca99ebb28cff245e7374.zip |
Some more Clang-Tidy silencing
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rules/api.c | 12 | ||||
-rw-r--r-- | lib/rules/local-addr.c | 2 | ||||
-rw-r--r-- | lib/rules/zonefile.c | 3 |
3 files changed, 9 insertions, 8 deletions
diff --git a/lib/rules/api.c b/lib/rules/api.c index c10cbb0b..8e908a7a 100644 --- a/lib/rules/api.c +++ b/lib/rules/api.c @@ -158,7 +158,7 @@ int kr_rules_init(const char *path, size_t maxsize) // Later we might improve it to auto-resize in case of running out of space. // Caveat: mdb_env_set_mapsize() can only be called without transactions open. .maxsize = maxsize ? maxsize : - (sizeof(size_t) > 4 ? 2048 : 500) * 1024*(size_t)1024, + (size_t)(sizeof(size_t) > 4 ? 2048 : 500) * 1024*1024, }; int ret = the_rules->api->open(&the_rules->db, &the_rules->stats, &opts, NULL); /* No persistence - we always refill from config for now. @@ -848,8 +848,8 @@ static int subnet_encode(const struct sockaddr *addr, int sub_len, uint8_t buf[3 uint16_t x = a[i] * 85; // interleave by zero bits uint8_t sub_mask = 255 >> (8 - MIN(sub_len, 8)); uint16_t r = x | (sub_mask * 85 * 2); - buf[2*i] = r / 256; - buf[2*i + 1] = r % 256; + buf[(ssize_t)2*i] = r / 256; + buf[(ssize_t)2*i + 1] = r % 256; } return i * 2; } @@ -870,9 +870,9 @@ bool subnet_is_prefix(uint8_t a, uint8_t b) } #define KEY_PREPEND(key, arr) do { \ - key.data -= sizeof(arr); \ - key.len += sizeof(arr); \ - memcpy(key.data, arr, sizeof(arr)); \ + (key).data -= sizeof(arr); \ + (key).len += sizeof(arr); \ + memcpy((key).data, arr, sizeof(arr)); \ } while (false) int kr_view_insert_action(const char *subnet, const char *dst_subnet, diff --git a/lib/rules/local-addr.c b/lib/rules/local-addr.c index 787639df..cd5d456b 100644 --- a/lib/rules/local-addr.c +++ b/lib/rules/local-addr.c @@ -67,7 +67,7 @@ static const knot_dname_t * raw_addr2reverse(const uint8_t *raw_addr, int family #undef REV_MAXLEN if (family == AF_INET) { - snprintf(reverse_addr, sizeof(reverse_addr), + (void)snprintf(reverse_addr, sizeof(reverse_addr), "%d.%d.%d.%d.in-addr.arpa.", raw_addr[3], raw_addr[2], raw_addr[1], raw_addr[0]); } else if (family == AF_INET6) { diff --git a/lib/rules/zonefile.c b/lib/rules/zonefile.c index 74a7317d..d308f375 100644 --- a/lib/rules/zonefile.c +++ b/lib/rules/zonefile.c @@ -203,6 +203,7 @@ static void process_record(zs_scanner_t *s) KR_RRTYPE_GET_STR(type_str, s->r_type); kr_log_warning(RULES, "skipping unsupported RR type %s\n", type_str); return; + default:; // Continue below } if (knot_rrtype_is_metatype(s->r_type)) goto unsupported_type; @@ -245,7 +246,7 @@ int kr_rule_zonefile(const struct kr_rule_zonefile_config *c) s_data_t s_data = { 0 }; s_data.c = c; - s_data.pool = mm_ctx_mempool2(64 * 1024); + s_data.pool = mm_ctx_mempool2((size_t)64 * 1024); s_data.rrs = trie_create(s_data.pool); ret = zs_set_processing(s, process_record, NULL, &s_data); if (kr_fails_assert(ret == 0)) |