init tail->last to (guint32) -1, so that index = tail->last + 1 will start
authorJeffrey Stedfast <fejj@ximian.com>
Fri, 18 Jun 2004 02:42:37 +0000 (02:42 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Fri, 18 Jun 2004 02:42:37 +0000 (02:42 +0000)
2004-06-17  Jeffrey Stedfast  <fejj@ximian.com>

* providers/imap4/camel-imap4-folder.c (uidset_init): init
tail->last to (guint32) -1, so that index = tail->last + 1 will
start at 0 :-)

camel/ChangeLog
camel/providers/imap4/camel-imap4-folder.c

index fcd2738..1a1a467 100644 (file)
@@ -1,3 +1,9 @@
+2004-06-17  Jeffrey Stedfast  <fejj@ximian.com>
+
+       * providers/imap4/camel-imap4-folder.c (uidset_init): init
+       tail->last to (guint32) -1, so that index = tail->last + 1 will
+       start at 0 :-)
+
 2004-06-17  Rodney Dawes  <dobey@novell.com>
 
        * camel-mime-filter-tohtml.c: Add support for the webcal, callto, and
index c5b94af..e06b5ab 100644 (file)
@@ -343,10 +343,10 @@ static void
 uidset_init (struct _uidset *uidset, CamelFolderSummary *summary, size_t maxlen)
 {
        uidset->ranges = g_new (struct _uidset_range, 1);
+       uidset->ranges->first = (guint32) -1;
+       uidset->ranges->last = (guint32) -1;
        uidset->ranges->next = NULL;
        uidset->ranges->buflen = 0;
-       uidset->ranges->first = 0;
-       uidset->ranges->last = 0;
        
        uidset->tail = uidset->ranges;
        uidset->summary = summary;
@@ -365,6 +365,7 @@ uidset_add (struct _uidset *uidset, CamelMessageInfo *info)
        guint32 index;
        char *colon;
        
+       /* Note: depends on integer overflow for initial tail->last value */
        for (index = tail->last + 1; index < messages->len; index++) {
                if (info == messages->pdata[index])
                        break;