aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-12 21:44:22 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-08-12 21:44:22 +0100
commite900e3fce155c8ad08c69b3be0668e25262b15d1 (patch)
treec7edc70667ca9f13fee88faced42a8a562b0f2b8
parentaf366b20a32902e5e3aa222d3f087ff085901a49 (diff)
downloadrspamd-e900e3fce155c8ad08c69b3be0668e25262b15d1.tar.gz
rspamd-e900e3fce155c8ad08c69b3be0668e25262b15d1.zip
[Minor] Some more alignment fixes
-rw-r--r--src/libcryptobox/base64/ref.c10
-rw-r--r--src/libstat/tokenizers/tokenizers.c4
2 files changed, 4 insertions, 10 deletions
diff --git a/src/libcryptobox/base64/ref.c b/src/libcryptobox/base64/ref.c
index c7cefd761..68889b90e 100644
--- a/src/libcryptobox/base64/ref.c
+++ b/src/libcryptobox/base64/ref.c
@@ -35,7 +35,6 @@ extern const uint8_t base64_table_dec[256];
#define INNER_LOOP_64 do { \
uint64_t str, res, dec; \
bool aligned = rspamd_is_aligned_as(c, str); \
- bool oaligned = rspamd_is_aligned_as(o, res); \
while (inlen >= 13) { \
if (aligned) { str = *(uint64_t *)c; } else {memcpy(&str, c, sizeof(str)); } \
str = GUINT64_TO_BE(str); \
@@ -72,7 +71,7 @@ extern const uint8_t base64_table_dec[256];
} \
res |= dec << 16; \
res = GUINT64_FROM_BE(res); \
- if (oaligned) {*(uint64_t *)o = res;} else {memcpy(o, &res, sizeof(res));} \
+ memcpy(o, &res, sizeof(res)); \
c += 8; \
o += 6; \
outl += 6; \
@@ -83,7 +82,6 @@ extern const uint8_t base64_table_dec[256];
#define INNER_LOOP_32 do { \
uint32_t str, res, dec; \
bool aligned = rspamd_is_aligned_as(c, str); \
- bool oaligned = rspamd_is_aligned_as(o, res); \
while (inlen >= 8) { \
if (aligned) { str = *(uint32_t *)c; } else {memcpy(&str, c, sizeof(str)); } \
str = GUINT32_TO_BE(str); \
@@ -104,7 +102,7 @@ extern const uint8_t base64_table_dec[256];
} \
res |= dec << 8; \
res = GUINT32_FROM_BE(res); \
- if (oaligned) {*(uint32_t *)o = res;} else {memcpy(o, &res, sizeof(res));} \
+ memcpy(o, &res, sizeof(res)); \
c += 4; \
o += 3; \
outl += 3; \
@@ -142,7 +140,7 @@ repeat:
ret = 0;
break;
}
- carry = q << 2;
+ carry = (uint8_t)(q << 2);
leftover++;
case 1:
@@ -186,7 +184,7 @@ repeat:
break;
}
*o++ = carry | (q >> 2);
- carry = q << 6;
+ carry = (uint8_t)(q << 6);
leftover++;
outl++;
diff --git a/src/libstat/tokenizers/tokenizers.c b/src/libstat/tokenizers/tokenizers.c
index 12b860b67..ea3c84c67 100644
--- a/src/libstat/tokenizers/tokenizers.c
+++ b/src/libstat/tokenizers/tokenizers.c
@@ -173,13 +173,9 @@ rspamd_tokenize_check_limit (gboolean decay,
if (!decay) {
if (token->original.len >= sizeof (guint64)) {
-#ifdef _MUM_UNALIGNED_ACCESS
- *hv = mum_hash_step (*hv, *(guint64 *)token->original.begin);
-#else
guint64 tmp;
memcpy (&tmp, token->original.begin, sizeof (tmp));
*hv = mum_hash_step (*hv, tmp);
-#endif
}
/* Check for decay */