dovecot: Compiler warning fixes on 32bit systems.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Dec 28 00:00:07 EET 2007
details: http://hg.dovecot.org/dovecot/rev/7708a8c166d6
changeset: 7043:7708a8c166d6
user: Timo Sirainen <tss at iki.fi>
date: Fri Dec 28 00:00:07 2007 +0200
description:
Compiler warning fixes on 32bit systems.
diffstat:
8 files changed, 28 insertions(+), 26 deletions(-)
src/deliver/duplicate.c | 2 -
src/lib-index/mail-cache-compress.c | 2 -
src/lib-index/mail-cache-fields.c | 31 ++++++++++----------
src/lib-storage/index/dbox/dbox-sync.c | 4 +-
src/lib-storage/index/index-sort.c | 4 +-
src/lib-storage/index/maildir/maildir-sync-index.c | 4 +-
src/lib/failures.c | 2 -
src/plugins/fts-squat/squat-trie.c | 5 +--
diffs (181 lines):
diff -r dcbf6afdf931 -r 7708a8c166d6 src/deliver/duplicate.c
--- a/src/deliver/duplicate.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/deliver/duplicate.c Fri Dec 28 00:00:07 2007 +0200
@@ -130,7 +130,7 @@ duplicate_read_records(struct duplicate_
return -1;
}
- if (hdr.stamp >= ioloop_time) {
+ if ((time_t)hdr.stamp >= ioloop_time) {
/* still valid, save it */
struct duplicate *d;
void *new_id;
diff -r dcbf6afdf931 -r 7708a8c166d6 src/lib-index/mail-cache-compress.c
--- a/src/lib-index/mail-cache-compress.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/lib-index/mail-cache-compress.c Fri Dec 28 00:00:07 2007 +0200
@@ -206,7 +206,7 @@ mail_cache_copy(struct mail_cache *cache
used_fields_count = i;
} else {
for (i = used_fields_count = 0; i < orig_fields_count; i++) {
- if (cache->fields[i].last_used < max_drop_time)
+ if ((time_t)cache->fields[i].last_used < max_drop_time)
cache->fields[i].used = FALSE;
ctx.field_file_map[i] = !cache->fields[i].used ?
diff -r dcbf6afdf931 -r 7708a8c166d6 src/lib-index/mail-cache-fields.c
--- a/src/lib-index/mail-cache-fields.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/lib-index/mail-cache-fields.c Fri Dec 28 00:00:07 2007 +0200
@@ -256,7 +256,7 @@ int mail_cache_header_fields_read(struct
const uint8_t *types, *decisions;
const char *p, *names, *end;
void *orig_key, *orig_value;
- unsigned int new_fields_count;
+ unsigned int fidx, new_fields_count;
time_t max_drop_time;
uint32_t offset, i;
@@ -337,12 +337,12 @@ int mail_cache_header_fields_read(struct
if (hash_lookup_full(cache->field_name_hash, names,
&orig_key, &orig_value)) {
/* already exists, see if decision can be updated */
- field.idx = POINTER_CAST_TO(orig_value, unsigned int);
- if (!cache->fields[field.idx].decision_dirty) {
- cache->fields[field.idx].field.decision =
+ fidx = POINTER_CAST_TO(orig_value, unsigned int);
+ if (!cache->fields[fidx].decision_dirty) {
+ cache->fields[fidx].field.decision =
decisions[i];
}
- if (field_type_verify(cache, field.idx,
+ if (field_type_verify(cache, fidx,
types[i], sizes[i]) < 0)
return -1;
} else {
@@ -351,23 +351,24 @@ int mail_cache_header_fields_read(struct
field.field_size = sizes[i];
field.decision = decisions[i];
mail_cache_register_fields(cache, &field, 1);
- }
- if (cache->field_file_map[field.idx] != (uint32_t)-1) {
+ fidx = field.idx;
+ }
+ if (cache->field_file_map[fidx] != (uint32_t)-1) {
mail_cache_set_corrupted(cache,
"Duplicated field in header: %s", names);
return -1;
}
- cache->fields[field.idx].used = TRUE;
-
- cache->field_file_map[field.idx] = i;
+ cache->fields[fidx].used = TRUE;
+
+ cache->field_file_map[fidx] = i;
cache->file_field_map[i] = field.idx;
/* update last_used if it's newer than ours */
- if (last_used[i] > cache->fields[field.idx].last_used)
- cache->fields[field.idx].last_used = last_used[i];
-
- if (cache->fields[field.idx].last_used < max_drop_time &&
- cache->fields[field.idx].last_used != 0) {
+ if (last_used[i] > cache->fields[fidx].last_used)
+ cache->fields[fidx].last_used = last_used[i];
+
+ if ((time_t)cache->fields[fidx].last_used < max_drop_time &&
+ cache->fields[fidx].last_used != 0) {
/* time to drop this field. don't bother dropping
fields that have never been used. */
cache->need_compress_file_seq = cache->hdr->file_seq;
diff -r dcbf6afdf931 -r 7708a8c166d6 src/lib-storage/index/dbox/dbox-sync.c
--- a/src/lib-storage/index/dbox/dbox-sync.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/lib-storage/index/dbox/dbox-sync.c Fri Dec 28 00:00:07 2007 +0200
@@ -257,11 +257,11 @@ static int dbox_sync_want_flush_dirty(st
hdr = data;
if (!close_flush_dirty_flags) {
- if (hdr->last_dirty_flush_stamp <
+ if ((time_t)hdr->last_dirty_flush_stamp <
ioloop_time - DBOX_FLUSH_SECS_IMMEDIATE)
return 1;
} else {
- if (hdr->last_dirty_flush_stamp <
+ if ((time_t)hdr->last_dirty_flush_stamp <
ioloop_time - DBOX_FLUSH_SECS_CLOSE)
return 1;
}
diff -r dcbf6afdf931 -r 7708a8c166d6 src/lib-storage/index/index-sort.c
--- a/src/lib-storage/index/index-sort.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/lib-storage/index/index-sort.c Fri Dec 28 00:00:07 2007 +0200
@@ -189,7 +189,7 @@ static uint32_t sort_get_arrival(struct
i_assert(t != (time_t)-1);
/* FIXME: truncation isn't good.. */
return t <= 0 ? 1 :
- (t >= (uint32_t)-1 ? (uint32_t)-1 : t + 1);
+ ((uint64_t)t >= (uint32_t)-1 ? (uint32_t)-1 : (uint32_t)t + 1);
}
static uint32_t sort_get_date(struct mail *mail)
@@ -205,7 +205,7 @@ static uint32_t sort_get_date(struct mai
i_assert(t != (time_t)-1);
/* FIXME: truncation isn't good.. */
return t <= 0 ? 1 :
- (t >= (uint32_t)-1 ? (uint32_t)-1 : t + 1);
+ ((uint64_t)t >= (uint32_t)-1 ? (uint32_t)-1 : (uint32_t)t + 1);
}
static uint32_t sort_get_size(struct mail *mail)
diff -r dcbf6afdf931 -r 7708a8c166d6 src/lib-storage/index/maildir/maildir-sync-index.c
--- a/src/lib-storage/index/maildir/maildir-sync-index.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/lib-storage/index/maildir/maildir-sync-index.c Fri Dec 28 00:00:07 2007 +0200
@@ -519,7 +519,7 @@ int maildir_list_index_has_changed(struc
"stat(%s) failed: %m", new_dir);
return -1;
}
- if (rec->new_mtime != st.st_mtime)
+ if ((time_t)rec->new_mtime != st.st_mtime)
return 1;
/* check if cur/ changed */
@@ -529,7 +529,7 @@ int maildir_list_index_has_changed(struc
"stat(%s) failed: %m", cur_dir);
return -1;
}
- if (rec->cur_mtime != st.st_mtime)
+ if ((time_t)rec->cur_mtime != st.st_mtime)
return 1;
return 0;
}
diff -r dcbf6afdf931 -r 7708a8c166d6 src/lib/failures.c
--- a/src/lib/failures.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/lib/failures.c Fri Dec 28 00:00:07 2007 +0200
@@ -87,7 +87,7 @@ static int log_fd_write(int fd, const un
struct io *io;
ssize_t ret;
- while ((ret = write(fd, data, len)) != len) {
+ while ((ret = write(fd, data, len)) != (ssize_t)len) {
if (ret > 0) {
/* some was written, continue.. */
data += ret;
diff -r dcbf6afdf931 -r 7708a8c166d6 src/plugins/fts-squat/squat-trie.c
--- a/src/plugins/fts-squat/squat-trie.c Thu Dec 27 22:56:25 2007 +0200
+++ b/src/plugins/fts-squat/squat-trie.c Fri Dec 28 00:00:07 2007 +0200
@@ -492,7 +492,7 @@ node_read_children(struct squat_trie *tr
trie->data_size);
}
- if (end - data < len) {
+ if ((size_t)(end - data) < len) {
squat_trie_set_corrupted(trie);
return -1;
}
@@ -1094,7 +1094,8 @@ squat_trie_renumber_uidlists(struct squa
compress, &rebuild_ctx)) <= 0)
return ret;
- ctx->trie->hdr.indexid = I_MAX(ioloop_time, ctx->trie->hdr.indexid + 1);
+ ctx->trie->hdr.indexid =
+ I_MAX((unsigned int)ioloop_time, ctx->trie->hdr.indexid + 1);
i_array_init(&uids, 1024);
iter = squat_trie_iterate_uidlist_init(ctx->trie);
More information about the dovecot-cvs
mailing list