]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Use PRI* macros and %zu instead of casting
authorMartti Rannanjärvi <martti.rannanjarvi@dovecot.fi>
Tue, 19 Sep 2017 08:57:18 +0000 (11:57 +0300)
committerTimo Sirainen <tss@dovecot.fi>
Fri, 6 Oct 2017 13:04:28 +0000 (16:04 +0300)
36 files changed:
src/auth/passdb-cache.c
src/config/config-request.c
src/dict/main.c
src/director/main.c
src/doveadm/doveadm-dump-index.c
src/doveadm/doveadm-dump-log.c
src/doveadm/doveadm-stats.c
src/doveadm/dsync/dsync-brain-mailbox.c
src/doveadm/dsync/dsync-brain.c
src/doveadm/dsync/dsync-ibc-stream.c
src/doveadm/dsync/dsync-mailbox-import.c
src/imap/cmd-select.c
src/imap/imap-client.c
src/imap/imap-fetch.c
src/imap/imap-search.c
src/imap/imap-state.c
src/imap/imap-status.c
src/imap/imap-sync.c
src/lib-dict-backend/dict-sql.c
src/lib-dict/dict-client.c
src/lib-index/mail-index-sync-ext.c
src/lib-index/mail-transaction-log-file.c
src/lib-sql/driver-cassandra.c
src/lib-stats/stats-parser.c
src/lib-storage/index/imapc/imapc-mail.c
src/lib-storage/mail-search-args-imap.c
src/lib-storage/mail-search-mime.c
src/lib/data-stack.c
src/master/service-process.c
src/plugins/imap-quota/imap-quota-plugin.c
src/plugins/quota-clone/quota-clone-plugin.c
src/plugins/quota/quota-fs.c
src/plugins/quota/quota-maildir.c
src/plugins/quota/quota-util.c
src/plugins/quota/quota.c
src/plugins/trash/trash-plugin.c

index c8815807eae9d93b66b0c15859ce5f1ba6b36720..881916e17c85a8e37338e826d09c4a5fbadff11a 100644 (file)
@@ -153,9 +153,9 @@ void passdb_cache_init(const struct auth_settings *set)
 
        if (restrict_get_process_size(&limit) == 0 &&
            set->cache_size > limit) {
-               i_warning("auth_cache_size (%luM) is higher than "
+               i_warning("auth_cache_size (%"PRIuUOFF_T"M) is higher than "
                          "process VSZ limit (%luM)",
-                         (unsigned long)(set->cache_size/1024/1024),
+                         set->cache_size/1024/1024,
                          (unsigned long)(limit/1024/1024));
        }
        passdb_cache = auth_cache_new(set->cache_size, set->cache_ttl,
index 9b713b44214250b390487c00f15067088123fe36..fe1f63ef3fcd97a4be315b83955f5565acb20967 100644 (file)
@@ -45,7 +45,7 @@ static void config_export_size(string_t *str, uoff_t size)
                suffix = suffixes[i];
                size /= 1024;
        }
-       str_printfa(str, "%llu %c", (unsigned long long)size, suffix);
+       str_printfa(str, "%"PRIuUOFF_T" %c", size, suffix);
 }
 
 static void config_export_time(string_t *str, unsigned int stamp)
index 9df0a97c1d3337174c05e11bf8c7e56341c1ef52..997ea07b498927a2d63739ccf3e9ef8a031cdafd 100644 (file)
@@ -27,12 +27,10 @@ static bool proctitle_updated;
 static void
 add_timing_string(string_t *str, struct timing *timing, const char *name)
 {
-       str_printfa(str, ", %u %s:%llu/%llu/%llu/%llu",
+       str_printfa(str, ", %u %s:%"PRIu64"/%"PRIu64"/%"PRIu64"/%"PRIu64,
                    timing_get_count(timing), name,
-                   (unsigned long long)timing_get_min(timing)/1000,
-                   (unsigned long long)timing_get_avg(timing)/1000,
-                   (unsigned long long)timing_get_95th(timing)/1000,
-                   (unsigned long long)timing_get_max(timing)/1000);
+                   timing_get_min(timing)/1000, timing_get_avg(timing)/1000,
+                   timing_get_95th(timing)/1000, timing_get_max(timing)/1000);
        timing_reset(timing);
 }
 
index 853668bebf097596a300dde30895f3b3ebf3f704..ff0a857480ea69c7e38d9eec28c5486f360de78b 100644 (file)
@@ -59,11 +59,11 @@ static void director_refresh_proctitle_timeout(void *context ATTR_UNUSED)
        str_printfa(str, "[%u users", director_total_users_count());
        if (director->users_moving_count > 0)
                str_printfa(str, ", %u moving", director->users_moving_count);
-       str_printfa(str, ", %lu req/s",
-                   (unsigned long)(director->num_requests - prev_requests));
-       str_printfa(str, ", %llu+%llu kB/s",
-                   (unsigned long long)(director->ring_traffic_input - prev_input)/1024,
-                   (unsigned long long)(director->ring_traffic_output - prev_output)/1024);
+       str_printfa(str, ", %"PRIu64" req/s",
+                   director->num_requests - prev_requests);
+       str_printfa(str, ", %"PRIu64"+%"PRIu64" kB/s",
+                   (director->ring_traffic_input - prev_input)/1024,
+                   (director->ring_traffic_output - prev_output)/1024);
        str_append_c(str, ']');
 
        prev_requests = director->num_requests;
index 8d52140d0c5830f662bf5a4bcec5702c7c5a81a5..4a1833aa933187f7a70d0d7ecc41c8da4ec4752e 100644 (file)
@@ -227,7 +227,7 @@ static void dump_extension_header(struct mail_index *index,
                printf("header\n");
                printf(" - highest uid . = %u\n", hdr->highest_uid);
                printf(" - message count = %u\n", hdr->message_count);
-               printf(" - vsize ....... = %llu\n", (unsigned long long)hdr->vsize);
+               printf(" - vsize ....... = %"PRIu64"\n", hdr->vsize);
        } else if (strcmp(ext->name, "maildir") == 0) {
                const struct maildir_index_header *hdr = data;
 
@@ -246,8 +246,7 @@ static void dump_extension_header(struct mail_index *index,
 
                printf("header\n");
                printf(" - sync_mtime . = %s\n", unixdate2str(hdr->sync_mtime));
-               printf(" - sync_size .. = %llu\n",
-                      (unsigned long long)hdr->sync_size);
+               printf(" - sync_size .. = %"PRIu64"\n", hdr->sync_size);
                printf(" - dirty_flag . = %d\n", hdr->dirty_flag);
                printf(" - mailbox_guid = %s\n",
                       guid_128_to_string(hdr->mailbox_guid));
@@ -284,8 +283,7 @@ static void dump_extension_header(struct mail_index *index,
                const struct mail_index_modseq_header *hdr = data;
 
                printf("header\n");
-               printf(" - highest_modseq = %llu\n",
-                      (unsigned long long)hdr->highest_modseq);
+               printf(" - highest_modseq = %"PRIu64"\n", hdr->highest_modseq);
                printf(" - log_seq ...... = %u\n", hdr->log_seq);
                printf(" - log_offset ... = %u\n", hdr->log_offset);
        } else if (strcmp(ext->name, "fts") == 0) {
@@ -315,8 +313,8 @@ static void dump_extension_header(struct mail_index *index,
                        printf(" - id ........... = %u\n", rec->id);
                        printf(" - uid_validity . = %u\n", rec->uid_validity);
                        printf(" - next_uid ..... = %u\n", rec->next_uid);
-                       printf(" - highest_modseq = %llu\n",
-                              (unsigned long long)rec->highest_modseq);
+                       printf(" - highest_modseq = %"PRIu64"\n",
+                              rec->highest_modseq);
 
                        name += rec->name_len;
                }
@@ -547,7 +545,7 @@ static void dump_cache(struct mail_cache_view *cache_view, unsigned int seq)
                        } else if (size == sizeof(uint64_t)) {
                                uint64_t value;
                                memcpy(&value, data, sizeof(value));
-                               str_printfa(str, "%llu ", (unsigned long long)value);
+                               str_printfa(str, "%"PRIu64, value);
                        }
                        /* fall through */
                case MAIL_CACHE_FIELD_VARIABLE_SIZE:
@@ -660,7 +658,7 @@ static void dump_record(struct mail_index_view *view, unsigned int seq)
                else if (ext[i].record_size == sizeof(uint64_t) &&
                         ext[i].record_align == sizeof(uint64_t)) {
                        uint64_t value = *((const uint64_t *)data);
-                       str_printfa(str, "%10llu", (unsigned long long)value);
+                       str_printfa(str, "%10"PRIu64, value);
                } else {
                        str_append(str, "          ");
                }
@@ -707,8 +705,7 @@ static void dump_record(struct mail_index_view *view, unsigned int seq)
                        printf("                   : uidnext  = %u\n", lrec->uidnext);
                } else if (strcmp(ext[i].name, "vsize") == 0) {
                        const struct mailbox_index_vsize *vrec = data;
-                       printf("                   : vsize         = %llu\n",
-                              (unsigned long long)vrec->vsize);
+                       printf("                   : vsize         = %"PRIu64"\n", vrec->vsize);
                        printf("                   : highest_uid   = %u\n", vrec->highest_uid);
                        printf("                   : message_count = %u\n", vrec->message_count);
                }
index b2a6e15dea23d8572e2ed2d6f682ad5b6d502e4b..5cb81a8d0bb50c52668f50565f7020698096441e 100644 (file)
@@ -39,8 +39,7 @@ static void dump_hdr(struct istream *input, uint64_t *modseq_r,
        printf("file seq = %u\n", hdr.file_seq);
        printf("prev file = %u/%u\n", hdr.prev_file_seq, hdr.prev_file_offset);
        printf("create stamp = %u\n", hdr.create_stamp);
-       printf("initial modseq = %llu\n",
-              (unsigned long long)hdr.initial_modseq);
+       printf("initial modseq = %"PRIu64"\n", hdr.initial_modseq);
        printf("compat flags = %x\n", hdr.compat_flags);
        *modseq_r = hdr.initial_modseq;
        *version_r = MAIL_TRANSACTION_LOG_HDR_VERSION(&hdr);
@@ -161,7 +160,7 @@ static void print_try_uint(const void *data, size_t size)
                uint64_t n64;
 
                memcpy(&n64, n, sizeof(n64));
-               printf("%llu", (unsigned long long)n64);
+               printf("%"PRIu64, n64);
                break;
        }
        default:
@@ -411,8 +410,8 @@ static void log_record_print(const struct mail_transaction_header *hdr,
 
                end = CONST_PTR_OFFSET(data, size);
                for (rec = data; rec < end; rec++) {
-                       printf(" - uid=%u modseq=%llu\n", rec->uid,
-                              ((unsigned long long)rec->modseq_high32 << 32) |
+                       printf(" - uid=%u modseq=%"PRIu64"\n", rec->uid,
+                              ((uint64_t)rec->modseq_high32 << 32) |
                               rec->modseq_low32);
                }
                break;
@@ -510,7 +509,7 @@ static int dump_record(struct istream *input, uint64_t *modseq,
        uint64_t prev_modseq = *modseq;
        mail_transaction_update_modseq(&hdr, data, modseq, version);
        if (*modseq > prev_modseq)
-               printf(", modseq=%llu", (unsigned long long)*modseq);
+               printf(", modseq=%"PRIu64, *modseq);
        printf("\n");
 
        log_record_print(&hdr, data, data_size, modseq);
index 984d28885aadd2c8f6219f8c02575b08a3e7fa8a..d2d1faa4ef43b1081945ed8a4693c780fb8aa2a2 100644 (file)
@@ -384,8 +384,8 @@ stats_top_output_diff(struct top_context *ctx,
 
        if (str_to_uint64(line->prev_values[i], &prev_num) == 0 &&
            str_to_uint64(line->cur_values[i], &cur_num) == 0) {
-               if (i_snprintf(numstr, sizeof(numstr), "%llu",
-                              (unsigned long long)(cur_num - prev_num)) < 0)
+               if (i_snprintf(numstr, sizeof(numstr), "%"PRIu64,
+                              (cur_num - prev_num)) < 0)
                        i_unreached();
                doveadm_print(numstr);
        } else if (get_double(line->prev_values[i], &prev_double) == 0 &&
index b6eee57276d0af2d7262bed86329dd93974cb8cc..ef67d435cbc4fb7fe123db2d7d55977726dbb3ae 100644 (file)
@@ -277,16 +277,16 @@ int dsync_brain_sync_mailbox_open(struct dsync_brain *brain,
        if (ret == 0) {
                if (pvt_too_old) {
                        desync_reason = t_strdup_printf(
-                               "Private modseq %llu no longer in transaction log "
+                               "Private modseq %"PRIu64" no longer in transaction log "
                                "(highest=%"PRIu64", last_common_uid=%u, nextuid=%u)",
-                               (unsigned long long)last_common_pvt_modseq,
+                               last_common_pvt_modseq,
                                status.highest_pvt_modseq, last_common_uid,
                                status.uidnext);
                } else {
                        desync_reason = t_strdup_printf(
-                               "Modseq %llu no longer in transaction log "
+                               "Modseq %"PRIu64" no longer in transaction log "
                                "(highest=%"PRIu64", last_common_uid=%u, nextuid=%u)",
-                               (unsigned long long)last_common_modseq,
+                               last_common_modseq,
                                status.highest_modseq, last_common_uid,
                                status.uidnext);
                }
@@ -301,14 +301,12 @@ int dsync_brain_sync_mailbox_open(struct dsync_brain *brain,
                                status.uidnext, last_common_uid);
                        ret = 0;
                } else if (status.highest_modseq < last_common_modseq) {
-                       desync_reason = t_strdup_printf("highest_modseq %llu < %llu",
-                               (unsigned long long)status.highest_modseq,
-                               (unsigned long long)last_common_modseq);
+                       desync_reason = t_strdup_printf("highest_modseq %"PRIu64" < %"PRIu64,
+                               status.highest_modseq, last_common_modseq);
                        ret = 0;
                } else if (status.highest_pvt_modseq < last_common_pvt_modseq) {
-                       desync_reason = t_strdup_printf("highest_pvt_modseq %llu < %llu",
-                               (unsigned long long)status.highest_pvt_modseq,
-                               (unsigned long long)last_common_pvt_modseq);
+                       desync_reason = t_strdup_printf("highest_pvt_modseq %"PRIu64" < %"PRIu64,
+                               status.highest_pvt_modseq, last_common_pvt_modseq);
                        ret = 0;
                }
        }
@@ -511,13 +509,13 @@ dsync_brain_try_next_mailbox(struct dsync_brain *brain, struct mailbox **box_r,
                if (!dsync_brain_has_mailbox_state_changed(brain, &dsync_box)) {
                        if (brain->debug) {
                                i_debug("brain %c: Skipping mailbox %s with unchanged state "
-                                       "uidvalidity=%u uidnext=%u highestmodseq=%llu highestpvtmodseq=%llu messages=%u",
+                                       "uidvalidity=%u uidnext=%u highestmodseq=%"PRIu64" highestpvtmodseq=%"PRIu64" messages=%u",
                                        brain->master_brain ? 'M' : 'S',
                                        guid_128_to_string(dsync_box.mailbox_guid),
                                        dsync_box.uid_validity,
                                        dsync_box.uid_next,
-                                       (unsigned long long)dsync_box.highest_modseq,
-                                       (unsigned long long)dsync_box.highest_pvt_modseq,
+                                       dsync_box.highest_modseq,
+                                       dsync_box.highest_pvt_modseq,
                                        dsync_box.messages_count);
                        }
                        mailbox_free(&box);
index 06106ab3e945f807f4bc7195738a31a5d5461f5c..cb4a41158eff4d9d9f74629f9708d8595985daba 100644 (file)
@@ -714,13 +714,13 @@ static void dsync_brain_mailbox_states_dump(struct dsync_brain *brain)
 
        iter = hash_table_iterate_init(brain->mailbox_states);
        while (hash_table_iterate(iter, brain->mailbox_states, &guid, &state)) {
-               i_debug("brain %c: Mailbox %s state: uidvalidity=%u uid=%u modseq=%llu pvt_modseq=%llu messages=%u changes_during_sync=%d",
+               i_debug("brain %c: Mailbox %s state: uidvalidity=%u uid=%u modseq=%"PRIu64" pvt_modseq=%"PRIu64" messages=%u changes_during_sync=%d",
                        brain->master_brain ? 'M' : 'S',
                        guid_128_to_string(guid),
                        state->last_uidvalidity,
                        state->last_common_uid,
-                       (unsigned long long)state->last_common_modseq,
-                       (unsigned long long)state->last_common_pvt_modseq,
+                       state->last_common_modseq,
+                       state->last_common_pvt_modseq,
                        state->last_messages_count,
                        state->changes_during_sync ? 1 : 0);
        }
index ad7631f3127f5e1e6c439978a518f48f05cfceea..a04beb404a6430d019937d939d3987bda2185970 100644 (file)
@@ -719,7 +719,7 @@ dsync_ibc_stream_send_handshake(struct dsync_ibc *_ibc,
        }
        if (set->sync_max_size > 0) {
                dsync_serializer_encode_add(encoder, "sync_max_size",
-                       t_strdup_printf("%llu", (unsigned long long)set->sync_max_size));
+                       t_strdup_printf("%"PRIu64, set->sync_max_size));
        }
        if (set->sync_flags != NULL) {
                dsync_serializer_encode_add(encoder, "sync_flags",
index ca07eb9b90b116b9a5e2c4ed9fb7f7e1e43ad2ae..b74a3e22e9644b6777a6ed84594714981d2db3e0 100644 (file)
@@ -317,14 +317,14 @@ dsync_mailbox_import_init(struct mailbox *box,
                        importer->local_uid_next, last_common_uid));
        } else if (importer->local_initial_highestmodseq < last_common_modseq) {
                dsync_import_unexpected_state(importer, t_strdup_printf(
-                       "local HIGHESTMODSEQ %llu < last common HIGHESTMODSEQ %llu",
-                       (unsigned long long)importer->local_initial_highestmodseq,
-                       (unsigned long long)last_common_modseq));
+                       "local HIGHESTMODSEQ %"PRIu64" < last common HIGHESTMODSEQ %"PRIu64,
+                       importer->local_initial_highestmodseq,
+                       last_common_modseq));
        } else if (importer->local_initial_highestpvtmodseq < last_common_pvt_modseq) {
                dsync_import_unexpected_state(importer, t_strdup_printf(
-                       "local HIGHESTMODSEQ %llu < last common HIGHESTMODSEQ %llu",
-                       (unsigned long long)importer->local_initial_highestpvtmodseq,
-                       (unsigned long long)last_common_pvt_modseq));
+                       "local HIGHESTMODSEQ %"PRIu64" < last common HIGHESTMODSEQ %"PRIu64,
+                       importer->local_initial_highestpvtmodseq,
+                       last_common_pvt_modseq));
        }
 
        importer->local_changes = dsync_transaction_log_scan_get_hash(log_scan);
@@ -2789,11 +2789,11 @@ static int dsync_mailbox_import_finish(struct dsync_mailbox_importer *importer,
                update.min_highest_pvt_modseq = importer->remote_highest_pvt_modseq;
 
                imp_debug(importer, "Finish update: min_next_uid=%u "
-                         "min_first_recent_uid=%u min_highest_modseq=%llu "
-                         "min_highest_pvt_modseq=%llu",
+                         "min_first_recent_uid=%u min_highest_modseq=%"PRIu64" "
+                         "min_highest_pvt_modseq=%"PRIu64,
                          update.min_next_uid, update.min_first_recent_uid,
-                         (unsigned long long)update.min_highest_modseq,
-                         (unsigned long long)update.min_highest_pvt_modseq);
+                         update.min_highest_modseq,
+                         update.min_highest_pvt_modseq);
 
                if (mailbox_update(importer->box, &update) < 0) {
                        i_error("Mailbox %s: Update failed: %s",
index 69ffeb050b4264018145a74192a3f40ef87ee0ab..adbe29d9a4d3a9b28e96846296f498010c0dd827 100644 (file)
@@ -346,8 +346,8 @@ select_open(struct imap_select_context *ctx, const char *mailbox, bool readonly)
                                 "* OK [NOMODSEQ] No permanent modsequences");
        } else if (!status.no_modseq_tracking) {
                client_send_line(client,
-                       t_strdup_printf("* OK [HIGHESTMODSEQ %llu] Highest",
-                               (unsigned long long)status.highest_modseq));
+                       t_strdup_printf("* OK [HIGHESTMODSEQ %"PRIu64"] Highest",
+                                       status.highest_modseq));
                client->sync_last_full_modseq = status.highest_modseq;
        }
 
index 1759858ac28d35ab0db05cd23f1b2441fe797c46..d4c8f65981c564e88303271b73fa6a9dc44132b5 100644 (file)
@@ -292,9 +292,8 @@ client_command_stats_append(string_t *str,
                str_printfa(str, ", %d.%03d in locks",
                            lock_wait_msecs/1000, lock_wait_msecs%1000);
        }
-       str_printfa(str, ", %llu B in + %llu",
-                   (unsigned long long)stats->bytes_in,
-                   (unsigned long long)stats->bytes_out);
+       str_printfa(str, ", %"PRIu64" B in + %"PRIu64,
+                   stats->bytes_in, stats->bytes_out);
        if (buffered_size > 0)
                str_printfa(str, "+%"PRIuSIZE_T, buffered_size);
        str_append(str, " B out");
@@ -1384,8 +1383,8 @@ int client_enable(struct client *client, enum mailbox_feature features)
                                         STATUS_HIGHESTMODSEQ, &status);
                if (ret == 0) {
                        client_send_line(client, t_strdup_printf(
-                               "* OK [HIGHESTMODSEQ %llu] Highest",
-                               (unsigned long long)status.highest_modseq));
+                               "* OK [HIGHESTMODSEQ %"PRIu64"] Highest",
+                               status.highest_modseq));
                }
        }
        if (ret < 0) {
index df870cd1ff72924ac248818125fef148776a8911..f7edbfab86a06fda472c4170438860507571ce68 100644 (file)
@@ -862,8 +862,7 @@ static int fetch_modseq(struct imap_fetch_context *ctx, struct mail *mail,
        modseq = mail_get_modseq(mail);
        if (ctx->client->highest_fetch_modseq < modseq)
                ctx->client->highest_fetch_modseq = modseq;
-       str_printfa(ctx->state.cur_str, "MODSEQ (%llu) ",
-                   (unsigned long long)modseq);
+       str_printfa(ctx->state.cur_str, "MODSEQ (%"PRIu64") ", modseq);
        return 1;
 }
 
index 7885b13777e7611f51a08eec89a7d60d60dd1000..7aa4e642e3bd989981921bf58a094a34f0c9bacc 100644 (file)
@@ -217,8 +217,8 @@ static void imap_search_send_result_standard(struct imap_search_context *ctx)
        }
 
        if (ctx->highest_seen_modseq != 0) {
-               str_printfa(str, " (MODSEQ %llu)",
-                           (unsigned long long)ctx->highest_seen_modseq);
+               str_printfa(str, " (MODSEQ %"PRIu64")",
+                           ctx->highest_seen_modseq);
        }
        str_append(str, "\r\n");
        o_stream_nsend(ctx->cmd->client->output, str_data(str), str_len(str));
@@ -354,8 +354,8 @@ static void imap_search_send_result(struct imap_search_context *ctx)
        if ((ctx->return_options & SEARCH_RETURN_COUNT) != 0)
                str_printfa(str, " COUNT %u", ctx->result_count);
        if (ctx->highest_seen_modseq != 0) {
-               str_printfa(str, " MODSEQ %llu",
-                           (unsigned long long)ctx->highest_seen_modseq);
+               str_printfa(str, " MODSEQ %"PRIu64,
+                           ctx->highest_seen_modseq);
        }
        str_append(str, "\r\n");
        o_stream_nsend(client->output, str_data(str), str_len(str));
index db687a8c7ec05afb364f63c1dfb4de6b45bc5f09..488bde31cae8fd59077a878a498450e8bd70a32d 100644 (file)
@@ -362,8 +362,8 @@ import_send_expunges(struct client *client,
                                       &uids_filter, &expunged_uids)) {
                *error_r = t_strdup_printf(
                        "Couldn't get recently expunged UIDs "
-                       "(uidnext=%u highest_modseq=%llu)", state->uidnext,
-                       (unsigned long long)state->highest_modseq);
+                       "(uidnext=%u highest_modseq=%"PRIu64")",
+                       state->uidnext, state->highest_modseq);
                return -1;
        }
        seq_range_array_iter_init(&iter, &expunged_uids);
@@ -623,9 +623,9 @@ import_state_mailbox_open(struct client *client,
                return -1;
        }
        if (status.highest_modseq < state->highest_modseq) {
-               *error_r = t_strdup_printf("Mailbox HIGHESTMODSEQ shrank %llu -> %llu",
-                                          (unsigned long long)state->highest_modseq,
-                                          (unsigned long long)status.highest_modseq);
+               *error_r = t_strdup_printf("Mailbox HIGHESTMODSEQ shrank %"PRIu64" -> %"PRIu64,
+                                          state->highest_modseq,
+                                          status.highest_modseq);
                mailbox_free(&box);
                return -1;
        }
@@ -682,8 +682,8 @@ import_state_mailbox_open(struct client *client,
            !client->nonpermanent_modseqs &&
            status.highest_modseq != state->highest_modseq) {
                client_send_line(client, t_strdup_printf(
-                       "* OK [HIGHESTMODSEQ %llu] Highest",
-                       (unsigned long long)status.highest_modseq));
+                       "* OK [HIGHESTMODSEQ %"PRIu64"] Highest",
+                       status.highest_modseq));
                client->sync_last_full_modseq = status.highest_modseq;
        }
        i_debug("Unhibernation sync: %u expunges, %u new messages, %u flag changes, %"PRIu64" modseq changes",
index 13e4512e85872acb95ffae2bbbcae0436192a804..c96467779fb9cae0b759025de6a99d1c08a02c8b 100644 (file)
@@ -123,12 +123,12 @@ int imap_status_send(struct client *client, const char *mailbox_mutf7,
        if ((items->status & STATUS_UNSEEN) != 0)
                str_printfa(str, "UNSEEN %u ", status->unseen);
        if ((items->status & STATUS_HIGHESTMODSEQ) != 0) {
-               str_printfa(str, "HIGHESTMODSEQ %llu ",
-                           (unsigned long long)status->highest_modseq);
+               str_printfa(str, "HIGHESTMODSEQ %"PRIu64" ",
+                           status->highest_modseq);
        }
        if ((items->metadata & MAILBOX_METADATA_VIRTUAL_SIZE) != 0) {
-               str_printfa(str, "X-SIZE %llu ",
-                           (unsigned long long)result->metadata.virtual_size);
+               str_printfa(str, "X-SIZE %"PRIu64" ",
+                           result->metadata.virtual_size);
        }
        if ((items->metadata & MAILBOX_METADATA_GUID) != 0) {
                str_printfa(str, "X-GUID %s ",
index d345ddf44b2916916c4555f4734ca6134b67a0ee..1c1912ee0f9b936b647a4b7a3a830f5fcb04c179 100644 (file)
@@ -241,14 +241,13 @@ imap_sync_send_highestmodseq(struct imap_sync_context *ctx,
                   sync_cmd->sync->tagline[3] != '[') {
                /* modify the tagged reply directly */
                sync_cmd->sync->tagline = p_strdup_printf(sync_cmd->pool,
-                       "OK [HIGHESTMODSEQ %llu] %s",
-                       (unsigned long long)send_modseq,
-                       sync_cmd->sync->tagline + 3);
+                       "OK [HIGHESTMODSEQ %"PRIu64"] %s",
+                       send_modseq, sync_cmd->sync->tagline + 3);
        } else {
                /* send an untagged OK reply */
                client_send_line(client, t_strdup_printf(
-                       "* OK [HIGHESTMODSEQ %llu] Highest",
-                       (unsigned long long)send_modseq));
+                       "* OK [HIGHESTMODSEQ %"PRIu64"] Highest",
+                       send_modseq));
        }
 
        if (!ctx->sync_status.sync_delayed_expunges) {
@@ -368,7 +367,7 @@ static void imap_sync_add_modseq(struct imap_sync_context *ctx, string_t *str)
        modseq = mail_get_modseq(ctx->mail);
        if (ctx->client->highest_fetch_modseq < modseq)
                ctx->client->highest_fetch_modseq = modseq;
-       str_printfa(str, "MODSEQ (%llu)", (unsigned long long)modseq);
+       str_printfa(str, "MODSEQ (%"PRIu64")", modseq);
 }
 
 static int imap_sync_send_flags(struct imap_sync_context *ctx, string_t *str)
index f36e46d47b1022dae8fb372524fc16280c2ace48..a49c07b93b444b44ea3924f9383d663e3ef94741 100644 (file)
@@ -716,8 +716,8 @@ sql_dict_iterate_build_next_query(struct sql_dict_iterate_context *ctx,
 
        if (ctx->ctx.max_rows > 0) {
                i_assert(ctx->ctx.row_count < ctx->ctx.max_rows);
-               str_printfa(query, " LIMIT %llu",
-                       (unsigned long long)(ctx->ctx.max_rows - ctx->ctx.row_count));
+               str_printfa(query, " LIMIT %"PRIu64,
+                           ctx->ctx.max_rows - ctx->ctx.row_count);
        }
 
        *stmt_r = sql_dict_statement_init(dict, str_c(query), &params);
index e425d0406cbe7423443b373191bf659e331264a8..93455fd7031520f76171a75ecca7f5145015e479 100644 (file)
@@ -1176,8 +1176,8 @@ client_dict_iterate_cmd_send(struct client_dict_iterate_context *ctx)
 
        /* we can't do this query in _iterate_init(), because
           _set_limit() hasn't been called yet at that point. */
-       str_printfa(query, "%c%d\t%llu", DICT_PROTOCOL_CMD_ITERATE, ctx->flags,
-                   (unsigned long long)ctx->ctx.max_rows);
+       str_printfa(query, "%c%d\t%"PRIu64, DICT_PROTOCOL_CMD_ITERATE,
+                   ctx->flags, ctx->ctx.max_rows);
        for (i = 0; ctx->paths[i] != NULL; i++) {
                str_append_c(query, '\t');
                str_append(query, str_tabescape(ctx->paths[i]));
index d1352fd9939bd74e39c658ef323b7365784de8ec..e7d14e259b732e25d5120259b535b211c86720bc 100644 (file)
@@ -791,14 +791,14 @@ mail_index_sync_ext_atomic_inc(struct mail_index_sync_map_ctx *ctx,
        if (orig_num < min_value) {
                mail_index_sync_set_corrupted(ctx,
                        "Extension record inc drops number below zero "
-                       "(uid=%u, diff=%d, orig=%llu)",
-                       u->uid, u->diff, (unsigned long long)orig_num);
+                       "(uid=%u, diff=%d, orig=%"PRIu64")",
+                       u->uid, u->diff, orig_num);
                return -1;
        } else if (orig_num > max_value) {
                mail_index_sync_set_corrupted(ctx,
                        "Extension record inc overflows number "
-                       "(uid=%u, diff=%d, orig=%llu)",
-                       u->uid, u->diff, (unsigned long long)orig_num);
+                       "(uid=%u, diff=%d, orig=%"PRIu64")",
+                       u->uid, u->diff, orig_num);
                return -1;
        }
        return 1;
index 4fef9dc745e10531c2c2a40ebfb716d229ab6437..16f799ed874435c4ecf6e9fe0a67003328e0f8eb 100644 (file)
@@ -1271,9 +1271,8 @@ get_modseq_next_offset_at(struct mail_transaction_log_file *file,
        if (ret <= 0) {
                mail_index_set_error(file->log->index,
                        "Failed to map transaction log %s for getting offset "
-                       "for modseq=%llu with start_offset=%"PRIuUOFF_T": %s",
-                       file->filepath, (unsigned long long)modseq,
-                       *cur_offset, reason);
+                       "for modseq=%"PRIu64" with start_offset=%"PRIuUOFF_T": %s",
+                       file->filepath, modseq, *cur_offset, reason);
                return -1;
        }
 
index 84e1035d31609ebca45221e8e0bb86b4f9220d27..301f9b580f2c709f8ccde999f50a3754ea46058f 100644 (file)
@@ -631,8 +631,8 @@ driver_cassandra_get_metrics_json(struct cassandra_db *db, string_t *dest)
 
        str_append(dest, "}, \"queries\": {");
        for (unsigned int i = 0; i < CASSANDRA_COUNTER_COUNT; i++) {
-               str_printfa(dest, "\"%s\": %llu,", counter_names[i],
-                           (unsigned long long)db->counters[i]);
+               str_printfa(dest, "\"%s\": %"PRIu64",", counter_names[i],
+                           db->counters[i]);
        }
        str_truncate(dest, str_len(dest)-1);
        str_append(dest, "}}");
index 602bb915219ce32f25965e3cd4097bc9acbbabd7..bf36a870e29e1e4525b12357b389dea1f3a4294d 100644 (file)
@@ -68,10 +68,8 @@ bool stats_parser_diff(const struct stats_parser_field *fields,
                                if (!stats_diff_uint64(dest, src1, src2)) {
                                        const uint64_t *n1 = src1, *n2 = src2;
 
-                                       *error_r = t_strdup_printf("%s %llu < %llu",
-                                               fields[i].name,
-                                               (unsigned long long)*n2,
-                                               (unsigned long long)*n1);
+                                       *error_r = t_strdup_printf("%s %"PRIu64" < %"PRIu64,
+                                               fields[i].name, *n2, *n1);
                                        return FALSE;
                                }
                                break;
@@ -162,7 +160,7 @@ void stats_parser_value(string_t *str,
                case sizeof(uint64_t): {
                        const uint64_t *n = ptr;
 
-                       str_printfa(str, "%llu", (unsigned long long)*n);
+                       str_printfa(str, "%"PRIu64, *n);
                        break;
                }
                default:
index d422eda014751f6f6fbb0cd1e2163188ba635e66..87645dd64be73f30b159049e7ce798f331c1b05f 100644 (file)
@@ -571,8 +571,8 @@ imapc_mail_get_special(struct mail *_mail, enum mail_fetch_field field,
                        return -1;
                }
 
-               *value_r = p_strdup_printf(imail->mail.data_pool, "GmailId%llx",
-                                          (unsigned long long)num);
+               *value_r = p_strdup_printf(imail->mail.data_pool,
+                                          "GmailId%"PRIx64, num);
                return 0;
        case MAIL_FETCH_IMAP_BODY:
                if (!IMAPC_BOX_HAS_FEATURE(mbox, IMAPC_FEATURE_FETCH_BODYSTRUCTURE))
index 793e6b70ce14c0010bef372d2731c8d179fc3ccc..7199d9ca2ad3a4296cb5a9b7655f93c43dbd0c76 100644 (file)
@@ -210,10 +210,10 @@ bool mail_search_arg_to_imap(string_t *dest, const struct mail_search_arg *arg,
                }
                break;
        case SEARCH_SMALLER:
-               str_printfa(dest, "SMALLER %llu", (unsigned long long)arg->value.size);
+               str_printfa(dest, "SMALLER %"PRIuUOFF_T, arg->value.size);
                break;
        case SEARCH_LARGER:
-               str_printfa(dest, "LARGER %llu", (unsigned long long)arg->value.size);
+               str_printfa(dest, "LARGER %"PRIuUOFF_T, arg->value.size);
                break;
        case SEARCH_HEADER:
        case SEARCH_HEADER_ADDRESS:
@@ -269,7 +269,7 @@ bool mail_search_arg_to_imap(string_t *dest, const struct mail_search_arg *arg,
                        }
                        str_append_c(dest, ' ');
                }
-               str_printfa(dest, "%llu", (unsigned long long)arg->value.modseq->modseq);
+               str_printfa(dest, "%"PRIu64, arg->value.modseq->modseq);
                break;
        }
        case SEARCH_INTHREAD:
index efd1cad58407618fe444217dd358e14b34ae50af..f8c73a86abcf7eb4da7e35bfec07c3d0d17793f8 100644 (file)
@@ -404,16 +404,13 @@ bool mail_search_mime_arg_to_imap(string_t *dest,
                        return FALSE;
                break;
        case SEARCH_MIME_SIZE_EQUAL:
-               str_printfa(dest, "SIZE %llu",
-                       (unsigned long long)arg->value.size);
+               str_printfa(dest, "SIZE %"PRIuUOFF_T, arg->value.size);
                break;
        case SEARCH_MIME_SIZE_LARGER:
-               str_printfa(dest, "SIZE LARGER %llu",
-                       (unsigned long long)arg->value.size);
+               str_printfa(dest, "SIZE LARGER %"PRIuUOFF_T, arg->value.size);
                break;
        case SEARCH_MIME_SIZE_SMALLER:
-               str_printfa(dest, "SIZE SMALLER %llu",
-                       (unsigned long long)arg->value.size);
+               str_printfa(dest, "SIZE SMALLER %"PRIuUOFF_T, arg->value.size);
                break;
        case SEARCH_MIME_DESCRIPTION:
                str_append(dest, "DESCRIPTION ");
index c4c8e3be02dceefe567f31ce38e2983571b57297..ef9ca17b8acaffaeb7529508e7107cb70645a86e 100644 (file)
@@ -421,7 +421,7 @@ static void *t_malloc_real(size_t size, bool permanent)
        if (warn && getenv("DEBUG_SILENT") == NULL) {
                /* warn after allocation, so if i_debug() wants to
                   allocate more memory we don't go to infinite loop */
-               i_debug("Growing data stack by %"PRIuSIZE_T" as "
+               i_debug("Growing data stack by %zu as "
                          "'%s' reaches %llu bytes from %u allocations.",
                          current_block->size,
                          current_frame_block->marker[frame_pos],
index 5a72247f230a5bd5efe4f706ab668f8cfaf7c1eb..5dcac81238ae71ad42d2c677bf19052b60a2052f 100644 (file)
@@ -422,10 +422,10 @@ get_exit_status_message(struct service *service, enum fatal_exit_status status)
                str = t_str_new(128);
                str_append(str, "Out of memory");
                if (service->vsz_limit != 0) {
-                       str_printfa(str, " (service %s { vsz_limit=%u MB }, "
+                       str_printfa(str, " (service %s { vsz_limit=%"PRIuUOFF_T" MB }, "
                                    "you may need to increase it)",
                                    service->set->name,
-                                   (unsigned int)(service->vsz_limit/1024/1024));
+                                   service->vsz_limit/1024/1024);
                }
                if (getenv("CORE_OUTOFMEM") == NULL)
                        str_append(str, " - set CORE_OUTOFMEM=1 environment to get core dump");
index 8ac283c268360912381c6dba364755f512cee40c..33cec6afa8b0fc9b97ce42a9912e34d55e07db5d 100644 (file)
@@ -55,9 +55,8 @@ quota_reply_write(string_t *str, struct mail_user *user,
                if (ret == QUOTA_GET_RESULT_LIMITED) {
                        if (i > 0)
                                str_append_c(str, ' ');
-                       str_printfa(str, "%s %llu %llu", *list,
-                                   (unsigned long long)value,
-                                   (unsigned long long)limit);
+                       str_printfa(str, "%s %"PRIu64" %"PRIu64, *list,
+                                   value, limit);
                        i++;
                }
        }
index 4ec1cb750c37d1527436ae79de93a73e204bc8b5..3f666e8ef8b92fb5bde1a50a282d92e5a51fd3cb 100644 (file)
@@ -87,12 +87,12 @@ static void quota_clone_flush_real(struct mailbox *box)
        if (ret_bytes == QUOTA_GET_RESULT_LIMITED ||
            ret_bytes == QUOTA_GET_RESULT_UNLIMITED) {
                dict_set(trans, DICT_QUOTA_CLONE_BYTES_PATH,
-                        t_strdup_printf("%llu", (unsigned long long)bytes_value));
+                        t_strdup_printf("%"PRIu64, bytes_value));
        }
        if (ret_count == QUOTA_GET_RESULT_LIMITED ||
            ret_count == QUOTA_GET_RESULT_UNLIMITED) {
                dict_set(trans, DICT_QUOTA_CLONE_COUNT_PATH,
-                        t_strdup_printf("%llu", (unsigned long long)count_value));
+                        t_strdup_printf("%"PRIu64, count_value));
        }
        if (dict_transaction_commit(&trans, &error) < 0)
                i_error("quota_clone_plugin: Failed to commit dict update: %s", error);
index ce9a46237d13afdaf69b16d5ca4848bf43336723..fdd7d45ce9595b322450e030826ad6fd742fc05f 100644 (file)
@@ -431,12 +431,11 @@ do_rquota_user(struct fs_quota_root *root,
                                  bytes_value_r, bytes_limit_r,
                                  count_value_r, count_limit_r);
                if (root->root.quota->set->debug) {
-                       i_debug("quota-fs: uid=%s, bytes=%llu/%llu files=%llu/%llu",
+                       i_debug("quota-fs: uid=%s, bytes=%"PRIu64"/%"PRIu64" "
+                               "files=%"PRIu64"/%"PRIu64,
                                dec2str(root->uid),
-                               (unsigned long long)*bytes_value_r,
-                               (unsigned long long)*bytes_limit_r,
-                               (unsigned long long)*count_value_r,
-                               (unsigned long long)*count_limit_r);
+                               *bytes_value_r, *bytes_limit_r,
+                               *count_value_r, *count_limit_r);
                }
                return 1;
        }
@@ -527,12 +526,11 @@ do_rquota_group(struct fs_quota_root *root ATTR_UNUSED,
                                  bytes_value_r, bytes_limit_r,
                                  count_value_r, count_limit_r);
                if (root->root.quota->set->debug) {
-                       i_debug("quota-fs: gid=%s, bytes=%llu/%llu files=%llu/%llu",
+                       i_debug("quota-fs: gid=%s, bytes=%"PRIu64"/%"PRIu64" "
+                               "files=%"PRIu64"/%"PRIu64,
                                dec2str(root->gid),
-                               (unsigned long long)*bytes_value_r,
-                               (unsigned long long)*bytes_limit_r,
-                               (unsigned long long)*count_value_r,
-                               (unsigned long long)*count_limit_r);
+                               *bytes_value_r, *bytes_limit_r,
+                               *count_value_r, *count_limit_r);
                }
                return 1;
        }
index a971be0566b14908a7f2189bd599160d0d51fcaf..f92cf6873a5a94ef75c01c8deadd3177ef32d08e 100644 (file)
@@ -288,18 +288,15 @@ static int maildirsize_write(struct maildir_quota_root *root, const char *path)
        str = t_str_new(128);
        /* if we have no limits, write 0S instead of an empty line */
        if (_root->bytes_limit != 0 || _root->count_limit == 0) {
-               str_printfa(str, "%lluS",
-                           (unsigned long long)_root->bytes_limit);
+               str_printfa(str, "%"PRId64"S", _root->bytes_limit);
        }
        if (_root->count_limit != 0) {
                if (str_len(str) > 0)
                        str_append_c(str, ',');
-               str_printfa(str, "%lluC",
-                           (unsigned long long)_root->count_limit);
+               str_printfa(str, "%"PRIu64"C", _root->count_limit);
        }
-       str_printfa(str, "\n%llu %llu\n",
-                   (unsigned long long)root->total_bytes,
-                   (unsigned long long)root->total_count);
+       str_printfa(str, "\n%"PRIu64" %"PRIu64"\n",
+                   root->total_bytes, root->total_count);
        if (write_full(fd, str_data(str), str_len(str)) < 0) {
                i_error("write_full(%s) failed: %m", str_c(temp_path));
                i_close_fd(&fd);
index 2758684b17084c7c2add268ace0090945820ad5a..88ea13ad9caf9b4344602955f873e7a19f6c9641 100644 (file)
@@ -132,9 +132,9 @@ void quota_root_recalculate_relative_rules(struct quota_root_settings *root_set,
 
        if (root_set->set->debug && root_set->set->initialized) {
                i_debug("Quota root %s: Recalculated relative rules with "
-                       "bytes=%lld count=%lld. Now grace=%llu", root_set->name,
+                       "bytes=%lld count=%lld. Now grace=%"PRIu64, root_set->name,
                        (long long)bytes_limit, (long long)count_limit,
-                       (unsigned long long)root_set->last_mail_max_extra_bytes);
+                       root_set->last_mail_max_extra_bytes);
        }
 }
 
@@ -343,12 +343,12 @@ int quota_root_add_warning_rule(struct quota_root_settings *root_set,
                                              root_set->default_rule.bytes_limit,
                                              root_set->default_rule.count_limit);
        if (root_set->set->debug) {
-               i_debug("Quota warning: bytes=%llu%s "
-                       "messages=%llu%s reverse=%s command=%s",
-                       (unsigned long long)warning->rule.bytes_limit,
+               i_debug("Quota warning: bytes=%"PRId64"%s "
+                       "messages=%"PRId64"%s reverse=%s command=%s",
+                       warning->rule.bytes_limit,
                        warning->rule.bytes_percent == 0 ? "" :
                        t_strdup_printf(" (%u%%)", warning->rule.bytes_percent),
-                       (unsigned long long)warning->rule.count_limit,
+                       warning->rule.count_limit,
                        warning->rule.count_percent == 0 ? "" :
                        t_strdup_printf(" (%u%%)", warning->rule.count_percent),
                        warning->reverse ? "yes" : "no",
@@ -394,32 +394,24 @@ bool quota_warning_match(const struct quota_warning_rule *w,
        if (!w->reverse) {
                /* over quota (default) */
                if (QUOTA_EXCEEDED(bytes_before, bytes_current, w->rule.bytes_limit)) {
-                       *reason_r = t_strdup_printf("bytes=%llu -> %llu over limit %llu",
-                               (unsigned long long)bytes_before,
-                               (unsigned long long)bytes_current,
-                               (unsigned long long)w->rule.bytes_limit);
+                       *reason_r = t_strdup_printf("bytes=%"PRIu64" -> %"PRIu64" over limit %"PRId64,
+                               bytes_before, bytes_current, w->rule.bytes_limit);
                        return TRUE;
                }
                if (QUOTA_EXCEEDED(count_before, count_current, w->rule.count_limit)) {
-                       *reason_r = t_strdup_printf("count=%llu -> %llu over limit %llu",
-                               (unsigned long long)count_before,
-                               (unsigned long long)count_current,
-                               (unsigned long long)w->rule.count_limit);
+                       *reason_r = t_strdup_printf("count=%"PRIu64" -> %"PRIu64" over limit %"PRId64,
+                               count_before, count_current, w->rule.count_limit);
                        return TRUE;
                }
        } else {
                if (QUOTA_EXCEEDED(bytes_current, bytes_before, w->rule.bytes_limit)) {
-                       *reason_r = t_strdup_printf("bytes=%llu -> %llu below limit %llu",
-                               (unsigned long long)bytes_before,
-                               (unsigned long long)bytes_current,
-                               (unsigned long long)w->rule.bytes_limit);
+                       *reason_r = t_strdup_printf("bytes=%"PRIu64" -> %"PRIu64" below limit %"PRId64,
+                               bytes_before, bytes_current, w->rule.bytes_limit);
                        return TRUE;
                }
                if (QUOTA_EXCEEDED(count_current, count_before, w->rule.count_limit)) {
-                       *reason_r = t_strdup_printf("count=%llu -> %llu below limit %llu",
-                               (unsigned long long)count_before,
-                               (unsigned long long)count_current,
-                               (unsigned long long)w->rule.count_limit);
+                       *reason_r = t_strdup_printf("count=%"PRIu64" -> %"PRIu64" below limit %"PRId64,
+                               count_before, count_current, w->rule.count_limit);
                        return TRUE;
                }
        }
index c5343772d3f7e71a91f216ea20bacccbbb68bb7b..316a86aab69022bf977c770708eafa020eb33511 100644 (file)
@@ -1207,10 +1207,8 @@ static void quota_over_flag_check_root(struct quota_root *root)
                        return;
                }
                if (root->quota->set->debug) {
-                       i_debug("quota: quota_over_flag check: %s ret=%d value=%llu limit=%llu",
-                               resources[i], ret,
-                               (unsigned long long)value,
-                               (unsigned long long)limit);
+                       i_debug("quota: quota_over_flag check: %s ret=%d value=%"PRIu64" limit=%"PRIu64,
+                               resources[i], ret, value, limit);
                }
                if (ret == QUOTA_GET_RESULT_LIMITED && value >= limit)
                        cur_overquota = TRUE;
index 996fe97b67315c47a8e13cc39e6f29a988fbd66b..699f7553d43f56b8cc445e0468655d2c3c0e3203 100644 (file)
@@ -177,9 +177,8 @@ err:
        if (size_expunged < size_needed) {
                if (ctx->quota->user->mail_debug) {
                        i_debug("trash plugin: Failed to remove enough messages "
-                               "(needed %llu bytes, expunged only %llu bytes)",
-                               (unsigned long long)size_needed,
-                               (unsigned long long)size_expunged);
+                               "(needed %"PRIu64" bytes, expunged only %"PRIu64" bytes)",
+                               size_needed, size_expunged);
                }
                return 0;
        }