dovecot-2.0: doveadm dump: Fixed printing unaligned cache data w...
dovecot at dovecot.org
dovecot at dovecot.org
Fri Oct 23 20:52:21 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/79f1c3ae4a98
changeset: 10168:79f1c3ae4a98
user: Timo Sirainen <tss at iki.fi>
date: Fri Oct 23 13:52:14 2009 -0400
description:
doveadm dump: Fixed printing unaligned cache data with CPUs that require alignment.
diffstat:
1 file changed, 9 insertions(+), 4 deletions(-)
src/doveadm/doveadm-dump-index.c | 13 +++++++++----
diffs (23 lines):
diff -r 56274bd4693c -r 79f1c3ae4a98 src/doveadm/doveadm-dump-index.c
--- a/src/doveadm/doveadm-dump-index.c Fri Oct 23 13:47:10 2009 -0400
+++ b/src/doveadm/doveadm-dump-index.c Fri Oct 23 13:52:14 2009 -0400
@@ -318,10 +318,15 @@ static void dump_cache(struct mail_cache
str_printfa(str, " - %s: ", field->name);
switch (field->type) {
case MAIL_CACHE_FIELD_FIXED_SIZE:
- if (size == sizeof(uint32_t))
- str_printfa(str, "%u ", *((const uint32_t *)data));
- else if (size == sizeof(uint64_t))
- str_printfa(str, "%llu ", (unsigned long long)*((const uint64_t *)data));
+ if (size == sizeof(uint32_t)) {
+ uint32_t value;
+ memcpy(&value, data, sizeof(value));
+ str_printfa(str, "%u ", value);
+ } else if (size == sizeof(uint64_t)) {
+ uint64_t value;
+ memcpy(&value, data, sizeof(value));
+ str_printfa(str, "%llu ", (unsigned long long)value);
+ }
case MAIL_CACHE_FIELD_VARIABLE_SIZE:
case MAIL_CACHE_FIELD_BITMASK:
str_printfa(str, "(%s)", binary_to_hex(data, size));
More information about the dovecot-cvs
mailing list