From: Martti Rannanjärvi Date: Tue, 19 Sep 2017 08:57:18 +0000 (+0300) Subject: global: Use PRI* macros and %zu instead of casting X-Git-Tag: 2.3.0.rc1~873 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=47a5a7e8296f3b8f2fac9a0659d4de3f2723ba4a;p=thirdparty%2Fdovecot%2Fcore.git global: Use PRI* macros and %zu instead of casting --- diff --git a/src/auth/passdb-cache.c b/src/auth/passdb-cache.c index c8815807ea..881916e17c 100644 --- a/src/auth/passdb-cache.c +++ b/src/auth/passdb-cache.c @@ -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, diff --git a/src/config/config-request.c b/src/config/config-request.c index 9b713b4421..fe1f63ef3f 100644 --- a/src/config/config-request.c +++ b/src/config/config-request.c @@ -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) diff --git a/src/dict/main.c b/src/dict/main.c index 9df0a97c1d..997ea07b49 100644 --- a/src/dict/main.c +++ b/src/dict/main.c @@ -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); } diff --git a/src/director/main.c b/src/director/main.c index 853668bebf..ff0a857480 100644 --- a/src/director/main.c +++ b/src/director/main.c @@ -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; diff --git a/src/doveadm/doveadm-dump-index.c b/src/doveadm/doveadm-dump-index.c index 8d52140d0c..4a1833aa93 100644 --- a/src/doveadm/doveadm-dump-index.c +++ b/src/doveadm/doveadm-dump-index.c @@ -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); } diff --git a/src/doveadm/doveadm-dump-log.c b/src/doveadm/doveadm-dump-log.c index b2a6e15dea..5cb81a8d0b 100644 --- a/src/doveadm/doveadm-dump-log.c +++ b/src/doveadm/doveadm-dump-log.c @@ -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); diff --git a/src/doveadm/doveadm-stats.c b/src/doveadm/doveadm-stats.c index 984d28885a..d2d1faa4ef 100644 --- a/src/doveadm/doveadm-stats.c +++ b/src/doveadm/doveadm-stats.c @@ -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 && diff --git a/src/doveadm/dsync/dsync-brain-mailbox.c b/src/doveadm/dsync/dsync-brain-mailbox.c index b6eee57276..ef67d435cb 100644 --- a/src/doveadm/dsync/dsync-brain-mailbox.c +++ b/src/doveadm/dsync/dsync-brain-mailbox.c @@ -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); diff --git a/src/doveadm/dsync/dsync-brain.c b/src/doveadm/dsync/dsync-brain.c index 06106ab3e9..cb4a41158e 100644 --- a/src/doveadm/dsync/dsync-brain.c +++ b/src/doveadm/dsync/dsync-brain.c @@ -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); } diff --git a/src/doveadm/dsync/dsync-ibc-stream.c b/src/doveadm/dsync/dsync-ibc-stream.c index ad7631f312..a04beb404a 100644 --- a/src/doveadm/dsync/dsync-ibc-stream.c +++ b/src/doveadm/dsync/dsync-ibc-stream.c @@ -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", diff --git a/src/doveadm/dsync/dsync-mailbox-import.c b/src/doveadm/dsync/dsync-mailbox-import.c index ca07eb9b90..b74a3e22e9 100644 --- a/src/doveadm/dsync/dsync-mailbox-import.c +++ b/src/doveadm/dsync/dsync-mailbox-import.c @@ -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", diff --git a/src/imap/cmd-select.c b/src/imap/cmd-select.c index 69ffeb050b..adbe29d9a4 100644 --- a/src/imap/cmd-select.c +++ b/src/imap/cmd-select.c @@ -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; } diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index 1759858ac2..d4c8f65981 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -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) { diff --git a/src/imap/imap-fetch.c b/src/imap/imap-fetch.c index df870cd1ff..f7edbfab86 100644 --- a/src/imap/imap-fetch.c +++ b/src/imap/imap-fetch.c @@ -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; } diff --git a/src/imap/imap-search.c b/src/imap/imap-search.c index 7885b13777..7aa4e642e3 100644 --- a/src/imap/imap-search.c +++ b/src/imap/imap-search.c @@ -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)); diff --git a/src/imap/imap-state.c b/src/imap/imap-state.c index db687a8c7e..488bde31ca 100644 --- a/src/imap/imap-state.c +++ b/src/imap/imap-state.c @@ -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", diff --git a/src/imap/imap-status.c b/src/imap/imap-status.c index 13e4512e85..c96467779f 100644 --- a/src/imap/imap-status.c +++ b/src/imap/imap-status.c @@ -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 ", diff --git a/src/imap/imap-sync.c b/src/imap/imap-sync.c index d345ddf44b..1c1912ee0f 100644 --- a/src/imap/imap-sync.c +++ b/src/imap/imap-sync.c @@ -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) diff --git a/src/lib-dict-backend/dict-sql.c b/src/lib-dict-backend/dict-sql.c index f36e46d47b..a49c07b93b 100644 --- a/src/lib-dict-backend/dict-sql.c +++ b/src/lib-dict-backend/dict-sql.c @@ -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), ¶ms); diff --git a/src/lib-dict/dict-client.c b/src/lib-dict/dict-client.c index e425d0406c..93455fd703 100644 --- a/src/lib-dict/dict-client.c +++ b/src/lib-dict/dict-client.c @@ -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])); diff --git a/src/lib-index/mail-index-sync-ext.c b/src/lib-index/mail-index-sync-ext.c index d1352fd993..e7d14e259b 100644 --- a/src/lib-index/mail-index-sync-ext.c +++ b/src/lib-index/mail-index-sync-ext.c @@ -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; diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index 4fef9dc745..16f799ed87 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -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; } diff --git a/src/lib-sql/driver-cassandra.c b/src/lib-sql/driver-cassandra.c index 84e1035d31..301f9b580f 100644 --- a/src/lib-sql/driver-cassandra.c +++ b/src/lib-sql/driver-cassandra.c @@ -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, "}}"); diff --git a/src/lib-stats/stats-parser.c b/src/lib-stats/stats-parser.c index 602bb91521..bf36a870e2 100644 --- a/src/lib-stats/stats-parser.c +++ b/src/lib-stats/stats-parser.c @@ -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: diff --git a/src/lib-storage/index/imapc/imapc-mail.c b/src/lib-storage/index/imapc/imapc-mail.c index d422eda014..87645dd64b 100644 --- a/src/lib-storage/index/imapc/imapc-mail.c +++ b/src/lib-storage/index/imapc/imapc-mail.c @@ -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)) diff --git a/src/lib-storage/mail-search-args-imap.c b/src/lib-storage/mail-search-args-imap.c index 793e6b70ce..7199d9ca2a 100644 --- a/src/lib-storage/mail-search-args-imap.c +++ b/src/lib-storage/mail-search-args-imap.c @@ -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: diff --git a/src/lib-storage/mail-search-mime.c b/src/lib-storage/mail-search-mime.c index efd1cad584..f8c73a86ab 100644 --- a/src/lib-storage/mail-search-mime.c +++ b/src/lib-storage/mail-search-mime.c @@ -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 "); diff --git a/src/lib/data-stack.c b/src/lib/data-stack.c index c4c8e3be02..ef9ca17b8a 100644 --- a/src/lib/data-stack.c +++ b/src/lib/data-stack.c @@ -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], diff --git a/src/master/service-process.c b/src/master/service-process.c index 5a72247f23..5dcac81238 100644 --- a/src/master/service-process.c +++ b/src/master/service-process.c @@ -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"); diff --git a/src/plugins/imap-quota/imap-quota-plugin.c b/src/plugins/imap-quota/imap-quota-plugin.c index 8ac283c268..33cec6afa8 100644 --- a/src/plugins/imap-quota/imap-quota-plugin.c +++ b/src/plugins/imap-quota/imap-quota-plugin.c @@ -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++; } } diff --git a/src/plugins/quota-clone/quota-clone-plugin.c b/src/plugins/quota-clone/quota-clone-plugin.c index 4ec1cb750c..3f666e8ef8 100644 --- a/src/plugins/quota-clone/quota-clone-plugin.c +++ b/src/plugins/quota-clone/quota-clone-plugin.c @@ -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); diff --git a/src/plugins/quota/quota-fs.c b/src/plugins/quota/quota-fs.c index ce9a46237d..fdd7d45ce9 100644 --- a/src/plugins/quota/quota-fs.c +++ b/src/plugins/quota/quota-fs.c @@ -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; } diff --git a/src/plugins/quota/quota-maildir.c b/src/plugins/quota/quota-maildir.c index a971be0566..f92cf6873a 100644 --- a/src/plugins/quota/quota-maildir.c +++ b/src/plugins/quota/quota-maildir.c @@ -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); diff --git a/src/plugins/quota/quota-util.c b/src/plugins/quota/quota-util.c index 2758684b17..88ea13ad9c 100644 --- a/src/plugins/quota/quota-util.c +++ b/src/plugins/quota/quota-util.c @@ -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; } } diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index c5343772d3..316a86aab6 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -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; diff --git a/src/plugins/trash/trash-plugin.c b/src/plugins/trash/trash-plugin.c index 996fe97b67..699f7553d4 100644 --- a/src/plugins/trash/trash-plugin.c +++ b/src/plugins/trash/trash-plugin.c @@ -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; }