@@ -158,7 +158,7 @@ fill_symv(ACISM *psp, MEMREF const *strv, int nstrs) | |||
#if ACISM_SIZE < 8 | |||
psp->sym_bits = bitwid(psp->nsyms); | |||
psp->sym_mask = ~(-1 << psp->sym_bits); | |||
psp->sym_mask = ~((~0u) << psp->sym_bits); | |||
#endif | |||
} | |||
@@ -66,7 +66,7 @@ extern const guchar lc_map[256]; | |||
static inline uint32_t | |||
ucl_hash_func (const ucl_object_t *o) | |||
{ | |||
return rspamd_cryptobox_fast_hash (o->key, o->keylen, 0xb9a1ef83c4561c95ULL); | |||
return (uint32_t)rspamd_cryptobox_fast_hash (o->key, o->keylen, 0xb9a1ef83c4561c95ULL); | |||
} | |||
static inline int | |||
@@ -124,7 +124,7 @@ ucl_hash_caseless_func (const ucl_object_t *o) | |||
break; | |||
} | |||
return rspamd_cryptobox_fast_hash_final (&hst); | |||
return (uint32_t)rspamd_cryptobox_fast_hash_final (&hst); | |||
} | |||
@@ -34,7 +34,7 @@ extern const uint8_t base64_table_dec[256]; | |||
#define INNER_LOOP_64 do { \ | |||
while (inlen >= 13) { \ | |||
uint64_t str, res, dec; \ | |||
str = *(uint64_t *)c; \ | |||
memcpy(&str, c, sizeof(str)); \ | |||
str = GUINT64_TO_BE(str); \ | |||
if ((dec = base64_table_dec[str >> 56]) > 63) { \ | |||
break; \ | |||
@@ -80,7 +80,7 @@ extern const uint8_t base64_table_dec[256]; | |||
#define INNER_LOOP_32 do { \ | |||
while (inlen >= 8) { \ | |||
uint32_t str, res, dec; \ | |||
str = *(uint32_t *)c; \ | |||
memcpy(&str, c, sizeof(str)); \ | |||
str = GUINT32_TO_BE(str); \ | |||
if ((dec = base64_table_dec[str >> 24]) > 63) { \ | |||
break; \ |
@@ -1684,7 +1684,10 @@ rspamd_url_is_ip (struct rspamd_url *uri, rspamd_mempool_t *pool) | |||
* 192.168 -> 192.0.0.168 | |||
*/ | |||
shift = 8 * (4 - i); | |||
n |= t << shift; | |||
if (shift < 32) { | |||
n |= t << shift; | |||
} | |||
if (check_num && dots <= 4) { | |||
memcpy (&in4, &n, sizeof (in4)); |
@@ -255,7 +255,7 @@ rspamd_strcase_hash (gconstpointer key) | |||
len = strlen (p); | |||
return rspamd_icase_hash (p, len, rspamd_hash_seed ()); | |||
return (guint)rspamd_icase_hash (p, len, rspamd_hash_seed ()); | |||
} | |||
guint | |||
@@ -293,7 +293,7 @@ rspamd_ftok_icase_hash (gconstpointer key) | |||
{ | |||
const rspamd_ftok_t *f = key; | |||
return rspamd_icase_hash (f->begin, f->len, rspamd_hash_seed ()); | |||
return (guint)rspamd_icase_hash (f->begin, f->len, rspamd_hash_seed ()); | |||
} | |||
gboolean | |||
@@ -791,7 +791,7 @@ while (0) | |||
cols = 0; | |||
while (inlen > 6) { | |||
n = *(guint64 *)in; | |||
memcpy (&n, in, sizeof (n)); | |||
n = GUINT64_TO_BE (n); | |||
if (str_len <= 0 || cols <= str_len - 8) { |
@@ -26,7 +26,7 @@ | |||
/* Utils for uthash tuning */ | |||
#ifndef HASH_CASELESS | |||
#define HASH_FUNCTION(key,keylen,num_bkts,hashv,bkt) do {\ | |||
hashv = rspamd_cryptobox_fast_hash(key, keylen, rspamd_hash_seed ()); \ | |||
hashv = (__typeof (hashv))rspamd_cryptobox_fast_hash(key, keylen, rspamd_hash_seed ()); \ | |||
bkt = (hashv) & (num_bkts-1); \ | |||
} while (0) | |||
@@ -78,7 +78,7 @@ | |||
rspamd_cryptobox_fast_hash_update (&_hst, &_u, sizeof (_u)); \ | |||
break; \ | |||
} \ | |||
hashv = rspamd_cryptobox_fast_hash_final (&_hst); \ | |||
hashv = (__typeof (hashv))rspamd_cryptobox_fast_hash_final (&_hst); \ | |||
bkt = (hashv) & (num_bkts-1); \ | |||
} while (0) | |||
#define HASH_KEYCMP(a,b,len) rspamd_lc_cmp(a,b,len) |