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