<<< Date Index >>>     <<< Thread Index >>>

Re: sscanf (x, "%u", &(uint64_t))



Hello,

> I misread the documenation. UIDVALIDITY is 32bit not 64bit. I will send
> a patch shortly.

here is the patch. Some people should test it before it is reported
upstream. For me it works.

        Thomas
diff -Nru a/hcache.c b/hcache.c
--- a/hcache.c  2005-03-20 14:30:10 +01:00
+++ b/hcache.c  2005-03-20 14:30:10 +01:00
@@ -63,7 +63,7 @@
 typedef union
 {
   struct timeval timeval;
-  uint64_t uid_validity;
+  uint32_t uid_validity;
 } validate;
 
 static void *
@@ -550,7 +550,7 @@
  * db_store */
 static void *
 mutt_hcache_dump(void *_db, HEADER * h, int *off,
-                uint64_t uid_validity)
+                uint32_t uid_validity)
 {
   struct header_cache *db = _db;
   unsigned char *d = NULL;
@@ -559,7 +559,7 @@
   d = lazy_malloc(sizeof (validate));
 
   if (uid_validity)
-    memcpy(d, &uid_validity, sizeof (uint64_t));
+    memcpy(d, &uid_validity, sizeof (uint32_t));
   else
   {
     struct timeval now;
@@ -696,7 +696,7 @@
 
 int
 mutt_hcache_store(void *db, const char *filename, HEADER * header,
-                 uint64_t uid_validity,
+                 uint32_t uid_validity,
                  size_t(*keylen) (const char *fn))
 {
   struct header_cache *h = db;
@@ -886,7 +886,7 @@
 
 int
 mutt_hcache_store(void *db, const char *filename, HEADER * header,
-                 uint64_t uid_validity,
+                 uint32_t uid_validity,
                  size_t(*keylen) (const char *fn))
 {
   DBT key;
diff -Nru a/imap/imap_private.h b/imap/imap_private.h
--- a/imap/imap_private.h       2005-03-20 14:30:10 +01:00
+++ b/imap/imap_private.h       2005-03-20 14:30:10 +01:00
@@ -180,7 +180,7 @@
   IMAP_CACHE cache[IMAP_CACHE_LEN];
   unsigned int noclose : 1;
 #ifdef USE_HCACHE
-  uint64_t uid_validity;
+  uint32_t uid_validity;
 #endif
   
   /* all folder flags - system flags AND keywords */
diff -Nru a/imap/message.c b/imap/message.c
--- a/imap/message.c    2005-03-20 14:30:10 +01:00
+++ b/imap/message.c    2005-03-20 14:30:10 +01:00
@@ -69,7 +69,7 @@
 
 #if USE_HCACHE
   void *hc   = NULL;
-  uint64_t *uid_validity = NULL;
+  uint32_t *uid_validity = NULL;
   char uid_buf[64];
 #endif /* USE_HCACHE */
 
@@ -154,7 +154,7 @@
       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 = (uint32_t *) mutt_hcache_fetch (hc, uid_buf, 
&imap_hcache_keylen);
 
       if (uid_validity != NULL
       && *uid_validity == idata->uid_validity) {
diff -Nru a/protos.h b/protos.h
--- a/protos.h  2005-03-20 14:30:10 +01:00
+++ b/protos.h  2005-03-20 14:30:10 +01:00
@@ -111,7 +111,7 @@
 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, uint32_t 
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 */