Attached is a refreshed patch for mutt 1.8.3+neomutt20170609.
--
vvvvvvvvvvvvvvvvvv Email
    vvvvvv        Twitter
da...@darac.org.uk
     ^^^^^^^^^^^^ Website
^^^^^^^^^^^^^^^^^^ XMPP
diff -u mutt-1.8.3+neomutt20170609.orig/imap/command.c mutt-1.8.3+neomutt20170609/imap/command.c
--- mutt-1.8.3+neomutt20170609.orig/imap/command.c	2017-06-09 11:52:07.000000000 +0100
+++ mutt-1.8.3+neomutt20170609/imap/command.c	2017-07-05 16:07:38.131261224 +0100
@@ -241,7 +241,7 @@
     return;
   }
 
-  mutt_debug(2, "Message UID %d updated\n", HEADER_DATA(h)->uid);
+  mutt_debug(2, "Message UID %u updated\n", HEADER_DATA(h)->uid);
   /* skip FETCH */
   s = imap_next_word(s);
   s = imap_next_word(s);
@@ -491,7 +491,7 @@
 
   while ((s = imap_next_word((char *) s)) && *s != '\0')
   {
-    uid = (unsigned int) atoi(s);
+    uid = strtoul (s, NULL, 10);
     h = (struct Header *) int_hash_find(idata->uid_hash, uid);
     if (h)
       h->matched = true;
@@ -506,7 +506,7 @@
   char *value = NULL;
   struct Buffy *inc = NULL;
   struct ImapMbox mx;
-  int count;
+  unsigned int count;
   struct ImapStatus *status = NULL;
   unsigned int olduv, oldun;
   long litlen;
@@ -548,7 +548,7 @@
   while (*s && *s != ')')
   {
     value = imap_next_word(s);
-    count = strtol(value, &value, 10);
+    count = strtoul(value, &value, 10);
 
     if (ascii_strncmp("MESSAGES", s, 8) == 0)
     {
@@ -570,7 +570,7 @@
   }
   mutt_debug(
       3,
-      "%s (UIDVALIDITY: %d, UIDNEXT: %d) %d messages, %d recent, %d unseen\n",
+      "%s (UIDVALIDITY: %u, UIDNEXT: %u) %d messages, %d recent, %d unseen\n",
       status->name, status->uidvalidity, status->uidnext, status->messages,
       status->recent, status->unseen);
 
@@ -608,7 +608,7 @@
 
       if (value && (imap_mxcmp(mailbox, value) == 0))
       {
-        mutt_debug(3, "Found %s in buffy list (OV: %d ON: %d U: %d)\n", mailbox,
+        mutt_debug(3, "Found %s in buffy list (OV: %u ON: %u U: %d)\n", mailbox,
                    olduv, oldun, status->unseen);
 
         if (option(OPTMAILCHECKRECENT))
diff -u mutt-1.8.3+neomutt20170609.orig/imap/imap.c mutt-1.8.3+neomutt20170609/imap/imap.c
--- mutt-1.8.3+neomutt20170609.orig/imap/imap.c	2017-06-09 11:52:07.000000000 +0100
+++ mutt-1.8.3+neomutt20170609/imap/imap.c	2017-07-05 16:10:25.748352303 +0100
@@ -281,7 +281,7 @@
 
     if (h->index == INT_MAX)
     {
-      mutt_debug(2, "Expunging message UID %d.\n", HEADER_DATA(h)->uid);
+      mutt_debug(2, "Expunging message UID %u.\n", HEADER_DATA(h)->uid);
 
       h->active = false;
       idata->ctx->size -= h->content->length;
@@ -698,7 +698,7 @@
       mutt_debug(3, "Getting mailbox UIDVALIDITY\n");
       pc += 3;
       pc = imap_next_word(pc);
-      idata->uid_validity = strtol(pc, NULL, 10);
+      idata->uid_validity = strtoul(pc, NULL, 10);
       status->uidvalidity = idata->uid_validity;
     }
     else if (ascii_strncasecmp("OK [UIDNEXT", pc, 11) == 0)
@@ -706,7 +706,7 @@
       mutt_debug(3, "Getting mailbox UIDNEXT\n");
       pc += 3;
       pc = imap_next_word(pc);
-      idata->uidnext = strtol(pc, NULL, 10);
+      idata->uidnext = strtoul(pc, NULL, 10);
       status->uidnext = idata->uidnext;
     }
     else
@@ -1710,7 +1710,7 @@
   if (hc)
   {
     uidvalidity = mutt_hcache_fetch_raw(hc, "/UIDVALIDITY", 12);
-    uidnext = mutt_hcache_fetch_raw(hc, "/UIDNEXT", 8);
+    uidnext = mutt_hcache_fetch_raw(hc, "/UIDNEXT", 12);
     if (uidvalidity)
     {
       if (!status)
@@ -1722,7 +1722,7 @@
       }
       status->uidvalidity = *(unsigned int *) uidvalidity;
       status->uidnext = uidnext ? *(unsigned int *) uidnext : 0;
-      mutt_debug(3, "mboxcache: hcache uidvalidity %d, uidnext %d\n",
+      mutt_debug(3, "mboxcache: hcache uidvalidity %u, uidnext %u\n",
                  status->uidvalidity, status->uidnext);
     }
     mutt_hcache_free(hc, &uidvalidity);
diff -u mutt-1.8.3+neomutt20170609.orig/imap/message.c mutt-1.8.3+neomutt20170609/imap/message.c
--- mutt-1.8.3+neomutt20170609.orig/imap/message.c	2017-06-09 11:52:07.000000000 +0100
+++ mutt-1.8.3+neomutt20170609/imap/message.c	2017-07-05 16:13:25.521600142 +0100
@@ -243,7 +243,7 @@
     {
       s += 3;
       SKIPWS(s);
-      h->data->uid = (unsigned int) atoi(s);
+      h->data->uid = (unsigned int) strtoul (s, NULL, 10);
 
       s = imap_next_word(s);
     }
@@ -315,7 +315,7 @@
 
   /* skip to message number */
   buf = imap_next_word(buf);
-  h->data->msn = atoi(buf);
+  h->data->msn = strtoul (buf, NULL, 10);
 
   /* find FETCH tag */
   buf = imap_next_word(buf);
@@ -531,7 +531,7 @@
   if (idata->hcache && (msn_begin == 1))
   {
     uid_validity = mutt_hcache_fetch_raw(idata->hcache, "/UIDVALIDITY", 12);
-    puidnext = mutt_hcache_fetch_raw(idata->hcache, "/UIDNEXT", 8);
+    puidnext = mutt_hcache_fetch_raw(idata->hcache, "/UIDNEXT", 12);
     if (puidnext)
     {
       uidnext = *(unsigned int *) puidnext;
@@ -794,7 +794,7 @@
     idata->uidnext = maxuid + 1;
   }
   if (idata->uidnext > 1)
-    mutt_hcache_store_raw(idata->hcache, "/UIDNEXT", 8, &idata->uidnext,
+    mutt_hcache_store_raw(idata->hcache, "/UIDNEXT", 12, &idata->uidnext,
                           sizeof(idata->uidnext));
 
   imap_hcache_close(idata);
@@ -832,8 +832,8 @@
   char *pc = NULL;
   long bytes;
   struct Progress progressbar;
-  int uid;
-  int cacheno;
+  unsigned int uid;
+  unsigned int cacheno;
   struct ImapCache *cache = NULL;
   bool read;
   int rc;
@@ -919,7 +919,7 @@
         if (ascii_strncasecmp("UID", pc, 3) == 0)
         {
           pc = imap_next_word(pc);
-          uid = atoi(pc);
+          uid = strtoul (pc, NULL, 10);
           if (uid != HEADER_DATA(h)->uid)
             mutt_error(_(
                 "The message index is incorrect. Try reopening the mailbox."));

Attachment: signature.asc
Description: PGP signature



Reply via email to