Skip to content

Commit 78a7fe7

Browse files
committed
explicit casts
1 parent e75ad54 commit 78a7fe7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

include/xorfilter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ static inline bool xor8_deserialize(xor8_t * filter, const char *buffer) {
13741374
static inline size_t xor ## xbits ## _pack_bytes(const xor ## xbits ## _t *filter) \
13751375
{ \
13761376
size_t sz = 0; \
1377-
size_t capacity = 3 * filter->blockLength; \
1377+
size_t capacity = (size_t)(3 * filter->blockLength); \
13781378
sz += sizeof filter->seed; \
13791379
sz += sizeof filter->blockLength; \
13801380
sz += XOR_bitf_sz(capacity); \
@@ -1391,7 +1391,7 @@ static inline size_t xor ## xbits ## _pack_bytes(const xor ## xbits ## _t *filte
13911391
static inline size_t xor ## xbits ## _pack(const xor ## xbits ## _t *filter, char *buffer, size_t space) { \
13921392
uint8_t *s = (uint8_t *)(void *)buffer; \
13931393
uint8_t *buf = s, *e = buf + space; \
1394-
size_t capacity = 3 * filter->blockLength; \
1394+
size_t capacity = (size_t)(3 * filter->blockLength); \
13951395
\
13961396
XOR_ser(buf, e, filter->seed); \
13971397
XOR_ser(buf, e, filter->blockLength); \
@@ -1420,7 +1420,7 @@ static inline bool xor ## xbits ## _unpack(xor ## xbits ## _t *filter, const cha
14201420
memset(filter, 0, sizeof *filter); \
14211421
XOR_deser(filter->seed, buf, e); \
14221422
XOR_deser(filter->blockLength, buf, e); \
1423-
size_t capacity = 3 * filter->blockLength; \
1423+
size_t capacity = (size_t)(3 * filter->blockLength); \
14241424
filter->fingerprints = (uint ## xbits ## _t *)calloc(capacity, sizeof filter->fingerprints[0]); \
14251425
if (filter->fingerprints == NULL) \
14261426
return (false); \

0 commit comments

Comments
 (0)