From: Thomas Glanzmann Date: Tue, 22 Mar 2005 03:40:54 +0000 (+0000) Subject: Thomas graces us with this patch that resolves a type-size inconsistency X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4fd543742e60d0f187ad6d154c0d64c7c42525c6;p=neomutt Thomas graces us with this patch that resolves a type-size inconsistency in the UIDVALIDITY parser. Edited for correctness. --- diff --git a/hcache.c b/hcache.c index 38f44aa99..85cdc700c 100644 --- a/hcache.c +++ b/hcache.c @@ -63,7 +63,7 @@ static struct header_cache typedef union { struct timeval timeval; - uint64_t uid_validity; + unsigned long uid_validity; } validate; static void * @@ -550,7 +550,7 @@ mutt_hcache_per_folder(const char *path, const char *folder) * db_store */ static void * mutt_hcache_dump(void *_db, HEADER * h, int *off, - uint64_t uid_validity) + unsigned long uid_validity) { struct header_cache *db = _db; unsigned char *d = NULL; @@ -559,7 +559,7 @@ mutt_hcache_dump(void *_db, HEADER * h, int *off, d = lazy_malloc(sizeof (validate)); if (uid_validity) - memcpy(d, &uid_validity, sizeof (uint64_t)); + memcpy(d, &uid_validity, sizeof (unsigned long)); else { struct timeval now; @@ -696,7 +696,7 @@ mutt_hcache_fetch(void *db, const char *filename, int mutt_hcache_store(void *db, const char *filename, HEADER * header, - uint64_t uid_validity, + unsigned long uid_validity, size_t(*keylen) (const char *fn)) { struct header_cache *h = db; @@ -886,7 +886,7 @@ mutt_hcache_fetch(void *db, const char *filename, int mutt_hcache_store(void *db, const char *filename, HEADER * header, - uint64_t uid_validity, + unsigned long uid_validity, size_t(*keylen) (const char *fn)) { DBT key; diff --git a/imap/imap.c b/imap/imap.c index fde8b9a6c..38409514e 100644 --- a/imap/imap.c +++ b/imap/imap.c @@ -635,7 +635,7 @@ int imap_open_mailbox (CONTEXT* ctx) dprint(2, (debugfile, "Getting mailbox UIDVALIDITY\n")); pc += 3; pc = imap_next_word(pc); - sscanf(pc, "%u", &(idata->uid_validity)); + sscanf(pc, "%lu", &(idata->uid_validity)); } #endif else diff --git a/imap/imap_private.h b/imap/imap_private.h index 848326bc6..a9bf6c98e 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -180,7 +180,7 @@ typedef struct IMAP_CACHE cache[IMAP_CACHE_LEN]; unsigned int noclose : 1; #ifdef USE_HCACHE - uint64_t uid_validity; + unsigned long uid_validity; #endif /* all folder flags - system flags AND keywords */ diff --git a/imap/message.c b/imap/message.c index acab54596..cc43c1935 100644 --- a/imap/message.c +++ b/imap/message.c @@ -69,7 +69,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) #if USE_HCACHE void *hc = NULL; - uint64_t *uid_validity = NULL; + unsigned long *uid_validity = NULL; char uid_buf[64]; #endif /* USE_HCACHE */ @@ -154,7 +154,7 @@ int imap_read_headers (IMAP_DATA* idata, int msgbegin, int msgend) fputs ("\n\n", fp); sprintf(uid_buf, "/%u", h.data->uid); /* XXX --tg 21:41 04-07-11 */ - uid_validity = (uint64_t *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen); + uid_validity = (unsigned long *) mutt_hcache_fetch (hc, uid_buf, &imap_hcache_keylen); if (uid_validity != NULL && *uid_validity == idata->uid_validity) { diff --git a/protos.h b/protos.h index 395f5089b..3cda50538 100644 --- a/protos.h +++ b/protos.h @@ -111,7 +111,7 @@ void *mutt_hcache_open(const char *path, const char *folder); void mutt_hcache_close(void *db); HEADER *mutt_hcache_restore(const unsigned char *d, HEADER **oh); void *mutt_hcache_fetch(void *db, const char *filename, size_t (*keylen)(const char *fn)); -int mutt_hcache_store(void *db, const char *filename, HEADER *h, uint64_t uid_validity, size_t (*keylen)(const char *fn)); +int mutt_hcache_store(void *db, const char *filename, HEADER *h, unsigned long uid_validity, size_t (*keylen)(const char *fn)); int mutt_hcache_delete(void *db, const char *filename, size_t (*keylen)(const char *fn)); #endif /* USE_HCACHE */