From: Vladimír Čunát Date: Tue, 20 May 2025 06:28:32 +0000 (+0200) Subject: treewide: explicit conversions to/from void* in (some) headers X-Git-Tag: v6.0.13~6^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0df5d5f230064ab173693d3f29fa07eab134cb30;p=thirdparty%2Fknot-resolver.git treewide: explicit conversions to/from void* in (some) headers They're not needed in C, but they are in C++. While -fpermissive can downgrade these to warnings, it's still more troublesome than a fix. --- diff --git a/contrib/mempattern.h b/contrib/mempattern.h index 7cb2bae89..105d48331 100644 --- a/contrib/mempattern.h +++ b/contrib/mempattern.h @@ -64,7 +64,7 @@ static inline void mm_ctx_delete(knot_mm_t *mm) { /* The mp_alloc comparison bears a risk of missing the private symbol from knot. */ if (mm && mm->ctx && mm->alloc == (knot_mm_alloc_t)mp_alloc) - mp_delete(mm->ctx); + mp_delete((struct mempool *)mm->ctx); } /*! \brief Readability: avoid const-casts in code. */ diff --git a/contrib/ucw/mempool.h b/contrib/ucw/mempool.h index 031513814..28be73d18 100644 --- a/contrib/ucw/mempool.h +++ b/contrib/ucw/mempool.h @@ -341,7 +341,7 @@ static inline void *mp_spread(struct mempool *pool, void *p, size_t size) **/ static inline char *mp_append_char(struct mempool *pool, char *p, uint c) { - p = mp_spread(pool, p, 1); + p = (char *)mp_spread(pool, p, 1); *p++ = c; return p; } @@ -353,7 +353,7 @@ static inline char *mp_append_char(struct mempool *pool, char *p, uint c) **/ static inline void *mp_append_block(struct mempool *pool, void *p, const void *block, size_t size) { - char *q = mp_spread(pool, p, size); + char *q = (char *)mp_spread(pool, p, size); memcpy(q, block, size); return q + size; } @@ -385,8 +385,8 @@ static inline void *mp_end(struct mempool *pool, void *end) **/ static inline char *mp_end_string(struct mempool *pool, void *end) { - end = mp_append_char(pool, end, 0); - return mp_end(pool, end); + end = mp_append_char(pool, (char *)end, 0); + return (char *)mp_end(pool, end); } /** diff --git a/lib/generic/pack.h b/lib/generic/pack.h index 18d57db51..5741e2774 100644 --- a/lib/generic/pack.h +++ b/lib/generic/pack.h @@ -198,7 +198,7 @@ static inline int pack_clone(pack_t **dst, const pack_t *src, knot_mm_t *pool) return kr_error(EINVAL); /* Get a valid pack_t. */ if (!*dst) { - *dst = mm_alloc(pool, sizeof(pack_t)); + *dst = (pack_t *)mm_alloc(pool, sizeof(pack_t)); if (!*dst) return kr_error(ENOMEM); pack_init(**dst); /* Clone data only if needed */