038f33c
From c2b5c8e1853cd38b902f204061535d6fc3d6e0dc Mon Sep 17 00:00:00 2001
038f33c
From: Robert Stepanek <rsto@fastmail.com>
038f33c
Date: Fri, 30 Jun 2017 15:41:02 +0200
038f33c
Subject: [PATCH] jmap*.c: use 'I' format string to unpack into json_int_t
038f33c
 variables
038f33c
038f33c
---
038f33c
 imap/jmap_calendar.c |  6 +++---
038f33c
 imap/jmap_contact.c  |  8 ++++----
038f33c
 imap/jmap_ical.c     |  2 +-
038f33c
 imap/jmap_mail.c     | 14 +++++++-------
038f33c
 4 files changed, 15 insertions(+), 15 deletions(-)
038f33c
038f33c
diff --git a/imap/jmap_calendar.c b/imap/jmap_calendar.c
038f33c
index 3fea52507..ecb9ef729 100644
038f33c
--- a/imap/jmap_calendar.c
038f33c
+++ b/imap/jmap_calendar.c
038f33c
@@ -2029,7 +2029,7 @@ static int getCalendarEventUpdates(struct jmap_req *req)
038f33c
             json_array_append_new(invalid, json_string("sinceState"));
038f33c
         }
038f33c
     }
038f33c
-    pe = readprop(req->args, "maxChanges", 0 /*mandatory*/, invalid, "i", &maxChanges);
038f33c
+    pe = readprop(req->args, "maxChanges", 0 /*mandatory*/, invalid, "I", &maxChanges);
038f33c
     if (pe > 0) {
038f33c
         if (maxChanges <= 0) {
038f33c
             json_array_append_new(invalid, json_string("maxChanges"));
038f33c
@@ -2562,7 +2562,7 @@ static int getCalendarEventList(struct jmap_req *req)
038f33c
     /* position */
038f33c
     json_int_t pos = 0;
038f33c
     if (JNOTNULL(json_object_get(req->args, "position"))) {
038f33c
-        pe = readprop(req->args, "position", 0 /*mandatory*/, invalid, "i", &pos;;
038f33c
+        pe = readprop(req->args, "position", 0 /*mandatory*/, invalid, "I", &pos;;
038f33c
         if (pe > 0 && pos < 0) {
038f33c
             json_array_append_new(invalid, json_string("position"));
038f33c
         }
038f33c
@@ -2571,7 +2571,7 @@ static int getCalendarEventList(struct jmap_req *req)
038f33c
     /* limit */
038f33c
     json_int_t limit = 0;
038f33c
     if (JNOTNULL(json_object_get(req->args, "limit"))) {
038f33c
-        pe = readprop(req->args, "limit", 0 /*mandatory*/, invalid, "i", &limit);
038f33c
+        pe = readprop(req->args, "limit", 0 /*mandatory*/, invalid, "I", &limit);
038f33c
         if (pe > 0 && limit < 0) {
038f33c
             json_array_append_new(invalid, json_string("limit"));
038f33c
         }
038f33c
diff --git a/imap/jmap_contact.c b/imap/jmap_contact.c
038f33c
index 59142b560..499f9140b 100644
038f33c
--- a/imap/jmap_contact.c
038f33c
+++ b/imap/jmap_contact.c
038f33c
@@ -602,7 +602,7 @@ static int getContactGroupUpdates(struct jmap_req *req)
038f33c
     json_t *invalid = json_pack("[]");
038f33c
 
038f33c
     json_int_t max_records = 0;
038f33c
-    pe = readprop(req->args, "maxChanges", 0 /*mandatory*/, invalid, "i", &max_records);
038f33c
+    pe = readprop(req->args, "maxChanges", 0 /*mandatory*/, invalid, "I", &max_records);
038f33c
     if (pe > 0) {
038f33c
         if (max_records <= 0) {
038f33c
             json_array_append_new(invalid, json_string("maxChanges"));
038f33c
@@ -1676,7 +1676,7 @@ static int getContactUpdates(struct jmap_req *req)
038f33c
     invalid = json_pack("[]");
038f33c
 
038f33c
     json_int_t max_records = 0;
038f33c
-    pe = readprop(req->args, "maxChanges", 0 /*mandatory*/, invalid, "i", &max_records);
038f33c
+    pe = readprop(req->args, "maxChanges", 0 /*mandatory*/, invalid, "I", &max_records);
038f33c
     if (pe > 0) {
038f33c
         if (max_records <= 0) {
038f33c
             json_array_append_new(invalid, json_string("maxChanges"));
038f33c
@@ -2137,7 +2137,7 @@ static int getContactList(struct jmap_req *req)
038f33c
     /* position */
038f33c
     json_int_t pos = 0;
038f33c
     if (JNOTNULL(json_object_get(req->args, "position"))) {
038f33c
-        pe = readprop(req->args, "position", 0 /*mandatory*/, invalid, "i", &pos;;
038f33c
+        pe = readprop(req->args, "position", 0 /*mandatory*/, invalid, "I", &pos;;
038f33c
         if (pe > 0 && pos < 0) {
038f33c
             json_array_append_new(invalid, json_string("position"));
038f33c
         }
038f33c
@@ -2147,7 +2147,7 @@ static int getContactList(struct jmap_req *req)
038f33c
     /* limit */
038f33c
     json_int_t limit = 0;
038f33c
     if (JNOTNULL(json_object_get(req->args, "limit"))) {
038f33c
-        pe = readprop(req->args, "limit", 0 /*mandatory*/, invalid, "i", &limit);
038f33c
+        pe = readprop(req->args, "limit", 0 /*mandatory*/, invalid, "I", &limit);
038f33c
         if (pe > 0 && limit < 0) {
038f33c
             json_array_append_new(invalid, json_string("limit"));
038f33c
         }
038f33c
diff --git a/imap/jmap_ical.c b/imap/jmap_ical.c
038f33c
index 968b3c37c..c0d4910f5 100644
038f33c
--- a/imap/jmap_ical.c
038f33c
+++ b/imap/jmap_ical.c
038f33c
@@ -3428,7 +3428,7 @@ recurrence_to_ical(context_t *ctx, icalcomponent *comp, json_t *recur)
038f33c
 
038f33c
             /* nthOfPeriod */
038f33c
             nth = 0;
038f33c
-            pe = readprop(ctx, bd, "nthOfPeriod", 0, "i", &nth;;
038f33c
+            pe = readprop(ctx, bd, "nthOfPeriod", 0, "I", &nth;;
038f33c
             if (pe > 0 && !nth) {
038f33c
                 invalidprop(ctx, "nthOfPeriod");
038f33c
             }
038f33c
diff --git a/imap/jmap_mail.c b/imap/jmap_mail.c
038f33c
index 4a5592119..aad827fc7 100644
038f33c
--- a/imap/jmap_mail.c
038f33c
+++ b/imap/jmap_mail.c
038f33c
@@ -1664,7 +1664,7 @@ static int getMailboxUpdates(jmap_req_t *req)
038f33c
         json_array_append_new(invalid, json_string("sinceState"));
038f33c
     }
038f33c
     /* maxChanges */
038f33c
-    pe = readprop(req->args, "maxChanges", 0, invalid, "i", &max_changes);
038f33c
+    pe = readprop(req->args, "maxChanges", 0, invalid, "I", &max_changes);
038f33c
     if (pe > 0 && max_changes < 0) {
038f33c
         json_array_append_new(invalid, json_string("maxChanges"));
038f33c
     }
038f33c
@@ -3143,8 +3143,8 @@ static void validatefilter(json_t *filter, const char *prefix, json_t *invalid)
038f33c
 
038f33c
         readprop_full(filter, prefix, "inMailbox", 0, invalid, "s", &s);
038f33c
         readprop_full(filter, prefix, "inMailboxOtherThan", 0, invalid, "s", &s);
038f33c
-        readprop_full(filter, prefix, "minSize", 0, invalid, "i", &num);
038f33c
-        readprop_full(filter, prefix, "maxSize", 0, invalid, "i", &num);
038f33c
+        readprop_full(filter, prefix, "minSize", 0, invalid, "I", &num);
038f33c
+        readprop_full(filter, prefix, "maxSize", 0, invalid, "I", &num);
038f33c
         readprop_full(filter, prefix, "threadIsFlagged", 0, invalid, "b", &b);
038f33c
         readprop_full(filter, prefix, "threadIsUnread", 0, invalid, "b", &b);
038f33c
         readprop_full(filter, prefix, "isFlagged", 0, invalid, "b", &b);
038f33c
@@ -3575,12 +3575,12 @@ static int getMessageList(jmap_req_t *req)
038f33c
     readprop(req->args, "anchor", 0, invalid, "s", &window.anchor);
038f33c
     readprop(req->args, "anchorOffset", 0, invalid, "i", &window.anchor_off);
038f33c
 
038f33c
-    if (readprop(req->args, "position", 0, invalid, "i", &i) > 0) {
038f33c
+    if (readprop(req->args, "position", 0, invalid, "I", &i) > 0) {
038f33c
         if (i < 0) json_array_append_new(invalid, json_string("position"));
038f33c
         window.position = i;
038f33c
     }
038f33c
 
038f33c
-    if (readprop(req->args, "limit", 0, invalid, "i", &i) > 0) {
038f33c
+    if (readprop(req->args, "limit", 0, invalid, "I", &i) > 0) {
038f33c
         if (i < 0) json_array_append_new(invalid, json_string("limit"));
038f33c
         window.limit = i;
038f33c
     }
038f33c
@@ -3708,7 +3708,7 @@ static int getMessageUpdates(jmap_req_t *req)
038f33c
     }
038f33c
     /* maxChanges */
038f33c
     memset(&window, 0, sizeof(struct getmsglist_window));
038f33c
-    readprop(req->args, "maxChanges", 0, invalid, "i", &max;;
038f33c
+    readprop(req->args, "maxChanges", 0, invalid, "I", &max;;
038f33c
     if (max < 0) json_array_append_new(invalid, json_string("maxChanges"));
038f33c
     window.limit = max;
038f33c
     /* fetch */
038f33c
@@ -3803,7 +3803,7 @@ static int getThreadUpdates(jmap_req_t *req)
038f33c
     }
038f33c
     /* maxChanges */
038f33c
     memset(&window, 0, sizeof(struct getmsglist_window));
038f33c
-    readprop(req->args, "maxChanges", 0, invalid, "i", &max;;
038f33c
+    readprop(req->args, "maxChanges", 0, invalid, "I", &max;;
038f33c
     if (max < 0) json_array_append_new(invalid, json_string("maxChanges"));
038f33c
     window.limit = max;
038f33c