commit 2f3cb5f4815d0024042bfb8387163b210acf3a6f
Author: Oswald Buddenhagen <o...@users.sf.net>
Date:   Wed Jul 8 13:45:06 2020 +0200

    fix signedness issues surrounding UIDs
    
    amends bb632d1c.

 src/driver.h      |  4 ++--
 src/drv_imap.c    | 10 +++++-----
 src/drv_maildir.c |  6 +++---
 src/drv_proxy.c   |  2 +-
 src/sync.c        | 20 ++++++++++----------
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/driver.h b/src/driver.h
index 238819d..48093af 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -176,10 +176,10 @@ struct driver {
        /* Open the selected mailbox.
         * Note that this should not directly complain about failure to open. */
        void (*open_box)( store_t *ctx,
-                         void (*cb)( int sts, int uidvalidity, void *aux ), 
void *aux );
+                         void (*cb)( int sts, uint uidvalidity, void *aux ), 
void *aux );
 
        /* Return the minimal UID the next stored message will have. */
-       int (*get_uidnext)( store_t *ctx );
+       uint (*get_uidnext)( store_t *ctx );
 
        /* Return the flags that can be stored in the selected mailbox. */
        xint (*get_supported_flags)( store_t *ctx );
diff --git a/src/drv_imap.c b/src/drv_imap.c
index e49d040..c3b83f2 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -2392,7 +2392,7 @@ imap_get_box_path( store_t *gctx ATTR_UNUSED )
 
 typedef struct {
        imap_cmd_t gen;
-       void (*callback)( int sts, int uidvalidity, void *aux );
+       void (*callback)( int sts, uint uidvalidity, void *aux );
        void *callback_aux;
 } imap_cmd_open_box_t;
 
@@ -2402,7 +2402,7 @@ static void imap_open_box_p4( imap_store_t *, 
imap_cmd_open_box_t *, int );
 
 static void
 imap_open_box( store_t *gctx,
-               void (*cb)( int sts, int uidvalidity, void *aux ), void *aux )
+               void (*cb)( int sts, uint uidvalidity, void *aux ), void *aux )
 {
        imap_store_t *ctx = (imap_store_t *)gctx;
        imap_cmd_open_box_t *cmd;
@@ -2465,7 +2465,7 @@ imap_open_box_p4( imap_store_t *ctx, imap_cmd_open_box_t 
*cmdp, int response )
        cmdp->callback( response, ctx->uidvalidity, cmdp->callback_aux );
 }
 
-static int
+static uint
 imap_get_uidnext( store_t *gctx )
 {
        imap_store_t *ctx = (imap_store_t *)gctx;
@@ -2954,12 +2954,12 @@ imap_store_msg( store_t *gctx, msg_data_t *data, int 
to_trash,
                cmd->gen.param.create = 1;
                cmd->gen.param.to_trash = 1;
                if (prepare_trash( &buf, ctx ) < 0) {
-                       cb( DRV_BOX_BAD, -1, aux );
+                       cb( DRV_BOX_BAD, 0, aux );
                        return;
                }
        } else {
                if (prepare_box( &buf, ctx ) < 0) {
-                       cb( DRV_BOX_BAD, -1, aux );
+                       cb( DRV_BOX_BAD, 0, aux );
                        return;
                }
        }
diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 9b42efc..984e36c 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -697,7 +697,7 @@ maildir_store_uidval( maildir_store_t *ctx )
 static int
 maildir_init_uidval( maildir_store_t *ctx )
 {
-       ctx->uidvalidity = time( 0 );
+       ctx->uidvalidity = (uint)time( 0 );
        ctx->nuid = 0;
        ctx->uvok = 0;
 #ifdef USE_DB
@@ -1279,7 +1279,7 @@ maildir_get_box_path( store_t *gctx )
 
 static void
 maildir_open_box( store_t *gctx,
-                  void (*cb)( int sts, int uidvalidity, void *aux ), void *aux 
)
+                  void (*cb)( int sts, uint uidvalidity, void *aux ), void 
*aux )
 {
        maildir_store_t *ctx = (maildir_store_t *)gctx;
        int ret;
@@ -1324,7 +1324,7 @@ maildir_open_box( store_t *gctx,
        cb( ret, ctx->uidvalidity, aux );
 }
 
-static int
+static uint
 maildir_get_uidnext( store_t *gctx )
 {
        maildir_store_t *ctx = (maildir_store_t *)gctx;
diff --git a/src/drv_proxy.c b/src/drv_proxy.c
index 7250293..36463c6 100644
--- a/src/drv_proxy.c
+++ b/src/drv_proxy.c
@@ -204,7 +204,7 @@ proxy_@name@( store_t *gctx@decl_args@, void (*cb)( 
@decl_cb_args@void *aux ), v
        if (excs.size) {
                debugn( "  excs:" );
                for (int t = 0; t < excs.size; t++)
-                       debugn( " %d", excs.data[t] );
+                       debugn( " %u", excs.data[t] );
                debug( "\n" );
        }
 //# END
diff --git a/src/sync.c b/src/sync.c
index 7438745..9aacfa5 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -1005,11 +1005,11 @@ delete_state( sync_vars_t *svars )
        }
 }
 
-static void box_confirmed( int sts, int uidvalidity, void *aux );
+static void box_confirmed( int sts, uint uidvalidity, void *aux );
 static void box_confirmed2( sync_vars_t *svars, int t );
 static void box_deleted( int sts, void *aux );
 static void box_created( int sts, void *aux );
-static void box_opened( int sts, int uidvalidity, void *aux );
+static void box_opened( int sts, uint uidvalidity, void *aux );
 static void box_opened2( sync_vars_t *svars, int t );
 static void load_box( sync_vars_t *svars, int t, uint minwuid, uint_array_t 
mexcs );
 
@@ -1085,7 +1085,7 @@ sync_boxes( store_t *ctx[], const char *names[], int 
present[], channel_conf_t *
 }
 
 static void
-box_confirmed( int sts, int uidvalidity, void *aux )
+box_confirmed( int sts, uint uidvalidity, void *aux )
 {
        DECL_SVARS;
 
@@ -1186,7 +1186,7 @@ box_created( int sts, void *aux )
 }
 
 static void
-box_opened( int sts, int uidvalidity, void *aux )
+box_opened( int sts, uint uidvalidity, void *aux )
 {
        DECL_SVARS;
 
@@ -1301,7 +1301,7 @@ box_opened2( sync_vars_t *svars, int t )
                                else if (!srec->uid[S])
                                        opts[S] |= OPEN_NEW|OPEN_FIND, 
svars->state[S] |= ST_FIND_OLD;
                                else
-                                       warn( "Warning: sync record (%d,%d) has 
stray TUID. Ignoring.\n", srec->uid[M], srec->uid[S] );
+                                       warn( "Warning: sync record (%u,%u) has 
stray TUID. Ignoring.\n", srec->uid[M], srec->uid[S] );
                        }
                }
        svars->opts[M] = svars->drv[M]->prepare_load_box( ctx[M], opts[M] );
@@ -1343,7 +1343,7 @@ box_opened2( sync_vars_t *svars, int t )
        sync_deref( svars );
 }
 
-static int
+static uint
 get_seenuid( sync_vars_t *svars, int t )
 {
        uint seenuid = 0;
@@ -1646,7 +1646,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int 
recent_msgs, void *aux
                                                if (srec->status != S_PENDING) {
                                                        debug( "  -> not too 
big any more\n" );
                                                        srec->status = 
S_PENDING;
-                                                       jFprintf( svars, "~ %d 
%d %u\n", srec->uid[M], srec->uid[S], srec->status );
+                                                       jFprintf( svars, "~ %u 
%u %u\n", srec->uid[M], srec->uid[S], srec->status );
                                                }
                                        } else {
                                                if (srec->status == S_SKIPPED) {
@@ -1654,7 +1654,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int 
recent_msgs, void *aux
                                                } else {
                                                        debug( "  -> not %sing 
- too big\n", str_hl[t] );
                                                        srec->status = 
S_SKIPPED;
-                                                       jFprintf( svars, "~ %d 
%d %u\n", srec->uid[M], srec->uid[S], srec->status );
+                                                       jFprintf( svars, "~ %u 
%u %u\n", srec->uid[M], srec->uid[S], srec->status );
                                                }
                                        }
                                }
@@ -2209,8 +2209,8 @@ box_closed_p2( sync_vars_t *svars, int t )
        // This is just an optimization, so it needs no journaling of 
intermediate states.
        // However, doing it before the entry purge would require ensuring that 
the
        // exception list includes all relevant messages.
-       debug( "max expired uid on master is now %d\n", svars->mmaxxuid );
-       jFprintf( svars, "! %d\n", svars->mmaxxuid );
+       debug( "max expired uid on master is now %u\n", svars->mmaxxuid );
+       jFprintf( svars, "! %u\n", svars->mmaxxuid );
 
        save_state( svars );
 


_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to