commit 9a5ec8157486ceaa84705c485b365894bae090dc Author: Jacob Welsh AuthorDate: Sat Nov 12 22:33:41 2022 +0000 Commit: Jacob Welsh CommitDate: Sat Nov 12 22:33:41 2022 +0000 Type: option removal replace all PRIdTIME_T and PRIxTIME_T uses by casting the argument to explicit 64-bit type diff --git a/config.h b/config.h index 677c8f4b3f..4a21d7f865 100644 --- a/config.h +++ b/config.h @@ -603,15 +603,9 @@ /* Define if pread/pwrite needs _XOPEN_SOURCE 500 (glibc) */ /* #undef PREAD_WRAPPERS */ -/* printf() fmt for dec time_t */ -#define PRIdTIME_T PRId64 /* FIXME */ - /* printf() format for uoff_t */ #define PRIuUOFF_T PRIu64 /* off_t is always 64-bit on musl */ -/* printf() fmt for hex time_t */ -#define PRIxTIME_T PRIx64 /* FIXME */ - /* Define if process title can be changed by modifying argv */ #define PROCTITLE_HACK /**/ diff --git a/src/auth/test-mech.c b/src/auth/test-mech.c index e842289bd8..265ed37cf3 100644 --- a/src/auth/test-mech.c +++ b/src/auth/test-mech.c @@ -189,8 +189,8 @@ test_mech_construct_apop_challenge(unsigned int connect_uid, size_t *len_r) { string_t *apop_challenge = t_str_new(128); - str_printfa(apop_challenge,"<%lx.%lx.%"PRIxTIME_T".", (unsigned long)getpid(), - (unsigned long)connect_uid, process_start_time+10); + str_printfa(apop_challenge,"<%lx.%lx.%"PRIx64".", (unsigned long)getpid(), + (unsigned long)connect_uid, (uint64_t)process_start_time+10); str_append_data(apop_challenge, "\0testuser\0responseoflen16-", 26); *len_r = apop_challenge->used; return apop_challenge->data; diff --git a/src/director/director-connection.c b/src/director/director-connection.c index a89cc2e4f2..98973af684 100644 --- a/src/director/director-connection.c +++ b/src/director/director-connection.c @@ -634,8 +634,8 @@ director_user_refresh(struct director_connection *conn, /* Ignore this refresh entirely, regardless of whether the user already exists or not. */ e_debug(conn->event, - "user refresh: %u has expired timestamp %"PRIdTIME_T, - username_hash, timestamp); + "user refresh: %u has expired timestamp %"PRId64, + username_hash, (int64_t)timestamp); return -1; } @@ -750,14 +750,15 @@ director_user_refresh(struct director_connection *conn, It's not a big problem - most likely it's only a few seconds difference. The worst that can happen is that some users take up memory that should have been freed already. */ - e_debug(conn->event, "user refresh: %u refreshed timestamp from %u to %"PRIdTIME_T, - username_hash, user->timestamp, timestamp); + e_debug(conn->event, "user refresh: %u refreshed timestamp from %u to %"PRId64, + username_hash, user->timestamp, (int64_t)timestamp); + /* XXX why is user->timestamp a different type? is it y2038 safe? */ user_directory_refresh(users, user); user->timestamp = timestamp; ret = TRUE; } else { - e_debug(conn->event, "user refresh: %u ignored timestamp %"PRIdTIME_T" (we have %u)", - username_hash, timestamp, user->timestamp); + e_debug(conn->event, "user refresh: %u ignored timestamp %"PRId64" (we have %u)", + username_hash, (int64_t)timestamp, user->timestamp); } if (unset_weak_user) { @@ -1870,8 +1871,8 @@ static bool director_cmd_ping(struct director_connection *conn, } } director_connection_send(conn, - t_strdup_printf("PONG\t%"PRIdTIME_T"\t%zu\n", - ioloop_time, o_stream_get_buffer_used_size(conn->output))); + t_strdup_printf("PONG\t%"PRId64"\t%zu\n", + (int64_t)ioloop_time, o_stream_get_buffer_used_size(conn->output))); return TRUE; } @@ -1884,8 +1885,8 @@ director_ping_append_extra(struct director_connection *conn, string_t *str, str_printfa(str, "buffer size at PING was %zu bytes", conn->ping_sent_buffer_size); if (pong_sent_time != 0) { - str_printfa(str, ", remote sent it %"PRIdTIME_T" secs ago", - ioloop_time - pong_sent_time); + str_printfa(str, ", remote sent it %"PRId64" secs ago", + (int64_t)(ioloop_time - pong_sent_time)); } if (pong_send_buffer_size != (uintmax_t)-1) { str_printfa(str, ", remote buffer size at PONG was %ju bytes", @@ -2636,7 +2637,7 @@ void director_connection_ping(struct director_connection *conn) conn->ping_sent_user_cpu.tv_sec = (time_t)-1; /* send it after getting the buffer size */ director_connection_send(conn, t_strdup_printf( - "PING\t%"PRIdTIME_T"\t%zu\n", ioloop_time, + "PING\t%"PRId64"\t%zu\n", (int64_t)ioloop_time, conn->ping_sent_buffer_size)); } diff --git a/src/director/doveadm-connection.c b/src/director/doveadm-connection.c index c840536bed..7831ed7180 100644 --- a/src/director/doveadm-connection.c +++ b/src/director/doveadm-connection.c @@ -165,9 +165,9 @@ doveadm_director_host_append_status(const struct director_host *host, { time_t last_failed = I_MAX(host->last_network_failure, host->last_protocol_failure); - str_printfa(str, "%s\t%u\t%s\t%"PRIdTIME_T"\t", - host->ip_str, host->port, type, - last_failed); + str_printfa(str, "%s\t%u\t%s\t%"PRId64"\t", + host->ip_str, host->port, type, + (int64_t)last_failed); } static void doveadm_director_append_status(struct director *dir, string_t *str) @@ -202,10 +202,11 @@ doveadm_director_connection_append_status(struct director_connection *conn, str_append(str, "syncing"); str_printfa(str, "\t%u\t%"PRIuUOFF_T"\t%"PRIuUOFF_T"\t%zu\t%zu\t" - "%"PRIdTIME_T"\t%"PRIdTIME_T, status.last_ping_msecs, - status.bytes_read, status.bytes_sent, - status.bytes_buffered, status.peak_bytes_buffered, - status.last_input.tv_sec, status.last_output.tv_sec); + "%"PRId64"\t%"PRId64, status.last_ping_msecs, + status.bytes_read, status.bytes_sent, + status.bytes_buffered, status.peak_bytes_buffered, + (int64_t)status.last_input.tv_sec, + (int64_t)status.last_output.tv_sec); } static void diff --git a/src/doveadm/dsync/dsync-ibc-stream.c b/src/doveadm/dsync/dsync-ibc-stream.c index 17115b0833..be28abc014 100644 --- a/src/doveadm/dsync/dsync-ibc-stream.c +++ b/src/doveadm/dsync/dsync-ibc-stream.c @@ -1703,7 +1703,7 @@ dsync_ibc_stream_send_change(struct dsync_ibc *_ibc, } if (change->received_timestamp > 0) { dsync_serializer_encode_add(encoder, "received_timestamp", - t_strdup_printf("%"PRIxTIME_T, change->received_timestamp)); + t_strdup_printf("%"PRIx64, (uint64_t)change->received_timestamp)); } if (change->virtual_size > 0) { dsync_serializer_encode_add(encoder, "virtual_size", diff --git a/src/imap-hibernate/imap-client.c b/src/imap-hibernate/imap-client.c index 8e0f93381b..50ae507586 100644 --- a/src/imap-hibernate/imap-client.c +++ b/src/imap-hibernate/imap-client.c @@ -159,8 +159,8 @@ imap_client_move_back_send_callback(void *context, struct ostream *output) str_append_tabescaped(str, state->username); event_get_create_time(client->event, &created); - str_printfa(str, "\thibernation_started=%"PRIdTIME_T".%06u", - created.tv_sec, (unsigned int)created.tv_usec); + str_printfa(str, "\thibernation_started=%"PRId64".%06u", + (int64_t)created.tv_sec, (unsigned int)created.tv_usec); if (state->session_id != NULL) { str_append(str, "\tsession="); diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index b5418f6179..3d9002bcf6 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -58,8 +58,8 @@ static void client_idle_timeout(struct client *client) if (client->output_cmd_lock == NULL) client_send_line(client, "* BYE Disconnected for inactivity."); client_destroy(client, t_strdup_printf( - "Inactivity - no input for %"PRIdTIME_T" secs", - ioloop_time - client->last_input)); + "Inactivity - no input for %"PRId64" secs", + (int64_t)(ioloop_time - client->last_input))); } static void client_init_urlauth(struct client *client) @@ -1174,8 +1174,8 @@ static bool client_skip_line(struct client *client) static void client_idle_output_timeout(struct client *client) { client_destroy(client, t_strdup_printf( - "Client has not read server output for for %"PRIdTIME_T" secs", - ioloop_time - client->last_output)); + "Client has not read server output for for %"PRId64" secs", + (int64_t)(ioloop_time - client->last_output))); } bool client_handle_unfinished_cmd(struct client_command_context *cmd) diff --git a/src/lib-dict/dict.c b/src/lib-dict/dict.c index cdaec09ee0..186744152c 100644 --- a/src/lib-dict/dict.c +++ b/src/lib-dict/dict.c @@ -522,8 +522,8 @@ void dict_transaction_set_timestamp(struct dict_transaction_context *ctx, struct event_passthrough *e = event_create_passthrough(ctx->event)-> set_name("dict_set_timestamp"); - e_debug(e->event(), "Setting timestamp on transaction to (%"PRIdTIME_T", %ld)", - ts->tv_sec, ts->tv_nsec); + e_debug(e->event(), "Setting timestamp on transaction to (%"PRId64", %ld)", + (int64_t)ts->tv_sec, ts->tv_nsec); if (ctx->dict->v.set_timestamp != NULL) ctx->dict->v.set_timestamp(ctx, ts); } diff --git a/src/lib-index/mail-cache-fields.c b/src/lib-index/mail-cache-fields.c index 429e0d234c..9a1a1f3530 100644 --- a/src/lib-index/mail-cache-fields.c +++ b/src/lib-index/mail-cache-fields.c @@ -453,18 +453,18 @@ int mail_cache_header_fields_read(struct mail_cache *cache) break; case MAIL_CACHE_PURGE_DROP_DECISION_DROP: mail_cache_purge_later(cache, t_strdup_printf( - "Drop old field %s (last_used=%"PRIdTIME_T")", + "Drop old field %s (last_used=%"PRId64")", cache->fields[fidx].field.name, - cache->fields[fidx].field.last_used)); + (int64_t)cache->fields[fidx].field.last_used)); break; case MAIL_CACHE_PURGE_DROP_DECISION_TO_TEMP: /* This cache decision change can cause the field to be dropped for old mails, so do it via purging. */ mail_cache_purge_later(cache, t_strdup_printf( "Change cache decision to temp for old field %s " - "(last_used=%"PRIdTIME_T")", + "(last_used=%"PRId64")", cache->fields[fidx].field.name, - cache->fields[fidx].field.last_used)); + (int64_t)cache->fields[fidx].field.last_used)); break; } diff --git a/src/lib-index/mail-cache-purge.c b/src/lib-index/mail-cache-purge.c index bc86bf1839..1f51f48eb1 100644 --- a/src/lib-index/mail-cache-purge.c +++ b/src/lib-index/mail-cache-purge.c @@ -169,8 +169,8 @@ mail_cache_purge_check_field(struct mail_cache_copy_context *ctx, add_str("decision", dec_str)-> add_int("last_used", priv->field.last_used); e_debug(e->event(), "Purge dropped field %s " - "(decision=%s, last_used=%"PRIdTIME_T")", - priv->field.name, dec_str, priv->field.last_used); + "(decision=%s, last_used=%"PRId64")", + priv->field.name, dec_str, (int64_t)priv->field.last_used); dec = MAIL_CACHE_DECISION_NO; break; } @@ -182,8 +182,8 @@ mail_cache_purge_check_field(struct mail_cache_copy_context *ctx, add_str("new_decision", "temp"); e_debug(e->event(), "Purge changes field %s " "cache decision yes -> temp " - "(last_used=%"PRIdTIME_T")", - priv->field.name, priv->field.last_used); + "(last_used=%"PRId64")", + priv->field.name, (int64_t)priv->field.last_used); dec = MAIL_CACHE_DECISION_TEMP; break; } diff --git a/src/lib-old-stats/stats-parser.c b/src/lib-old-stats/stats-parser.c index da009e9750..ce0506635e 100644 --- a/src/lib-old-stats/stats-parser.c +++ b/src/lib-old-stats/stats-parser.c @@ -170,8 +170,8 @@ void stats_parser_value(string_t *str, case STATS_PARSER_TYPE_TIMEVAL: { const struct timeval *tv = ptr; - str_printfa(str, "%"PRIdTIME_T".%u", - tv->tv_sec, (unsigned int)tv->tv_usec); + str_printfa(str, "%"PRId64".%u", + (int64_t)tv->tv_sec, (unsigned int)tv->tv_usec); break; } } diff --git a/src/lib-storage/index/dbox-common/dbox-file.c b/src/lib-storage/index/dbox-common/dbox-file.c index 16810b0c34..b97ebcc0c8 100644 --- a/src/lib-storage/index/dbox-common/dbox-file.c +++ b/src/lib-storage/index/dbox-common/dbox-file.c @@ -34,11 +34,11 @@ const char *dbox_generate_tmp_filename(void) { static unsigned int create_count = 0; - return t_strdup_printf(DBOX_TEMP_FILE_PREFIX"%"PRIdTIME_T".P%sQ%uM%u.%s", - ioloop_timeval.tv_sec, my_pid, - create_count++, - (unsigned int)ioloop_timeval.tv_usec, - my_hostname); + return t_strdup_printf(DBOX_TEMP_FILE_PREFIX"%"PRId64".P%sQ%uM%u.%s", + (int64_t)ioloop_timeval.tv_sec, my_pid, + create_count++, + (unsigned int)ioloop_timeval.tv_usec, + my_hostname); } void dbox_file_set_syscall_error(struct dbox_file *file, const char *function) diff --git a/src/lib-storage/index/dbox-common/dbox-save.c b/src/lib-storage/index/dbox-common/dbox-save.c index c5af8cc66d..e51190da07 100644 --- a/src/lib-storage/index/dbox-common/dbox-save.c +++ b/src/lib-storage/index/dbox-common/dbox-save.c @@ -149,8 +149,8 @@ void dbox_save_write_metadata(struct mail_save_context *_ctx, str_printfa(str, "%c%llx\n", DBOX_METADATA_PHYSICAL_SIZE, (unsigned long long)ctx->input->v_offset); } - str_printfa(str, "%c%"PRIxTIME_T"\n", DBOX_METADATA_RECEIVED_TIME, - mdata->received_date); + str_printfa(str, "%c%"PRIx64"\n", DBOX_METADATA_RECEIVED_TIME, + (uint64_t)mdata->received_date); if (mail_get_virtual_size(_ctx->dest_mail, &vsize) < 0) i_unreached(); str_printfa(str, "%c%llx\n", DBOX_METADATA_VIRTUAL_SIZE, diff --git a/src/lib-storage/index/maildir/maildir-sync-index.c b/src/lib-storage/index/maildir/maildir-sync-index.c index da0e40c262..3d619f7e33 100644 --- a/src/lib-storage/index/maildir/maildir-sync-index.c +++ b/src/lib-storage/index/maildir/maildir-sync-index.c @@ -748,8 +748,9 @@ int maildir_list_index_has_changed(struct mailbox *box, } if ((time_t)rec->new_mtime != st.st_mtime) { *reason_r = t_strdup_printf( - "Maildir new_mtime changed %u != %"PRIdTIME_T, - rec->new_mtime, st.st_mtime); + "Maildir new_mtime changed %u != %"PRId64, + rec->new_mtime, (int64_t)st.st_mtime); + /* XXX why is rec->new_mtime a different type? is it y2038 safe? */ return 1; } @@ -761,8 +762,9 @@ int maildir_list_index_has_changed(struct mailbox *box, } if ((time_t)rec->cur_mtime != st.st_mtime) { *reason_r = t_strdup_printf( - "Maildir cur_mtime changed %u != %"PRIdTIME_T, - rec->cur_mtime, st.st_mtime); + "Maildir cur_mtime changed %u != %"PRId64, + rec->cur_mtime, (int64_t)st.st_mtime); + /* XXX why is rec->cur_mtime a different type? is it y2038 safe? */ return 1; } return 0; diff --git a/src/lib-storage/index/mbox/mbox-sync-list-index.c b/src/lib-storage/index/mbox/mbox-sync-list-index.c index 934b7ea5d4..b13f16de12 100644 --- a/src/lib-storage/index/mbox/mbox-sync-list-index.c +++ b/src/lib-storage/index/mbox/mbox-sync-list-index.c @@ -62,9 +62,10 @@ int mbox_list_index_has_changed(struct mailbox *box, return -1; } if ((time_t)rec->mtime != st.st_mtime) { + /* XXX why is rec->mtime a different type? is it y2038 safe? */ *reason_r = t_strdup_printf( - "mbox record mtime changed %u != %"PRIdTIME_T, - rec->mtime, st.st_mtime); + "mbox record mtime changed %u != %"PRId64, + rec->mtime, (int64_t)st.st_mtime); return 1; } uint32_t new_size = (uint32_t)(st.st_size & 0xffffffffU); diff --git a/src/lib-storage/mail-search-mime.c b/src/lib-storage/mail-search-mime.c index 39b1f41fe8..568285276c 100644 --- a/src/lib-storage/mail-search-mime.c +++ b/src/lib-storage/mail-search-mime.c @@ -507,7 +507,7 @@ bool mail_search_mime_arg_to_imap(string_t *dest, if (!mail_search_mime_arg_to_imap_date(dest, arg)) { *error_r = t_strdup_printf( "SENTBEFORE can't be written as IMAP MIMEPART key " - "for timestamp %"PRIdTIME_T, arg->value.time); + "for timestamp %"PRId64, (int64_t)arg->value.time); return FALSE; } break; @@ -516,7 +516,7 @@ bool mail_search_mime_arg_to_imap(string_t *dest, if (!mail_search_mime_arg_to_imap_date(dest, arg)) { *error_r = t_strdup_printf( "SENTON can't be written as IMAP MIMEPART key " - "for timestamp %"PRIdTIME_T, arg->value.time); + "for timestamp %"PRId64, (int64_t)arg->value.time); return FALSE; } break; @@ -525,7 +525,7 @@ bool mail_search_mime_arg_to_imap(string_t *dest, if (!mail_search_mime_arg_to_imap_date(dest, arg)) { *error_r = t_strdup_printf( "SENTSINCE can't be written as IMAP MIMEPART key " - "for timestamp %"PRIdTIME_T, arg->value.time); + "for timestamp %"PRId64, (int64_t)arg->value.time); return FALSE; } break; diff --git a/src/lib/iostream-rawlog.c b/src/lib/iostream-rawlog.c index 5805c9b30d..7cbe21d171 100644 --- a/src/lib/iostream-rawlog.c +++ b/src/lib/iostream-rawlog.c @@ -31,9 +31,9 @@ rawlog_write_timestamp(struct rawlog_iostream *rstream, bool line_ends) return; buffer_create_from_data(&buf, data, sizeof(data)); - str_printfa(&buf, "%"PRIdTIME_T".%06u ", - ioloop_timeval.tv_sec, - (unsigned int)ioloop_timeval.tv_usec); + str_printfa(&buf, "%"PRId64".%06u ", + (int64_t)ioloop_timeval.tv_sec, + (unsigned int)ioloop_timeval.tv_usec); if ((rstream->flags & IOSTREAM_RAWLOG_FLAG_BUFFERED) != 0) { str_append_c(&buf, rstream->input ? 'I' : 'O'); str_append_c(&buf, line_ends ? ':' : '>'); diff --git a/src/lib/lib-event.c b/src/lib/lib-event.c index 87db436c84..fecae53355 100644 --- a/src/lib/lib-event.c +++ b/src/lib/lib-event.c @@ -990,9 +990,9 @@ event_find_field_recursive_str(const struct event *event, const char *key) case EVENT_FIELD_VALUE_TYPE_INTMAX: return dec2str(field->value.intmax); case EVENT_FIELD_VALUE_TYPE_TIMEVAL: - return t_strdup_printf("%"PRIdTIME_T".%u", - field->value.timeval.tv_sec, - (unsigned int)field->value.timeval.tv_usec); + return t_strdup_printf("%"PRId64".%u", + (int64_t)field->value.timeval.tv_sec, + (unsigned int)field->value.timeval.tv_usec); case EVENT_FIELD_VALUE_TYPE_STRLIST: { ARRAY_TYPE(const_string) list; t_array_init(&list, 8); @@ -1264,9 +1264,9 @@ event_export_field_value(string_t *dest, const struct event_field *field) case EVENT_FIELD_VALUE_TYPE_TIMEVAL: str_append_c(dest, EVENT_CODE_FIELD_TIMEVAL); str_append_tabescaped(dest, field->key); - str_printfa(dest, "\t%"PRIdTIME_T"\t%u", - field->value.timeval.tv_sec, - (unsigned int)field->value.timeval.tv_usec); + str_printfa(dest, "\t%"PRId64"\t%u", + (int64_t)field->value.timeval.tv_sec, + (unsigned int)field->value.timeval.tv_usec); break; case EVENT_FIELD_VALUE_TYPE_STRLIST: { unsigned int count; @@ -1286,9 +1286,9 @@ event_export_field_value(string_t *dest, const struct event_field *field) void event_export(const struct event *event, string_t *dest) { /* required fields: */ - str_printfa(dest, "%"PRIdTIME_T"\t%u", - event->tv_created.tv_sec, - (unsigned int)event->tv_created.tv_usec); + str_printfa(dest, "%"PRId64"\t%u", + (int64_t)event->tv_created.tv_sec, + (unsigned int)event->tv_created.tv_usec); /* optional fields: */ if (event->source_filename != NULL) { @@ -1302,10 +1302,10 @@ void event_export(const struct event *event, string_t *dest) str_append_c(dest, EVENT_CODE_ALWAYS_LOG_SOURCE); } if (event->tv_last_sent.tv_sec != 0) { - str_printfa(dest, "\t%c%"PRIdTIME_T"\t%u", - EVENT_CODE_TV_LAST_SENT, - event->tv_last_sent.tv_sec, - (unsigned int)event->tv_last_sent.tv_usec); + str_printfa(dest, "\t%c%"PRId64"\t%u", + EVENT_CODE_TV_LAST_SENT, + (int64_t)event->tv_last_sent.tv_sec, + (unsigned int)event->tv_last_sent.tv_usec); } if (event->sending_name != NULL) { str_append_c(dest, '\t'); diff --git a/src/lib/test-event-flatten.c b/src/lib/test-event-flatten.c index 526366c4ae..2276b2c468 100644 --- a/src/lib/test-event-flatten.c +++ b/src/lib/test-event-flatten.c @@ -354,10 +354,10 @@ static void test_event_strlist_flatten(void) event_export(event, dest); /* see if it matches .. */ - const char *reference = t_strdup_printf("%"PRIdTIME_T"\t%u" + const char *reference = t_strdup_printf("%"PRId64"\t%u" "\ts"__FILE__ "\t%u\tLtest\t3\tl3\tl1\tl2", - event->tv_created.tv_sec, + (int64_t)event->tv_created.tv_sec, (unsigned int)event->tv_created.tv_usec, line); test_assert_strcmp(str_c(dest), reference); diff --git a/src/old-stats/mail-stats.c b/src/old-stats/mail-stats.c index 6ba325005c..d3ca705f79 100644 --- a/src/old-stats/mail-stats.c +++ b/src/old-stats/mail-stats.c @@ -19,27 +19,27 @@ mail_global_stats_sent(void *ctx) static void mail_global_stats_send(void *u0 ATTR_UNUSED) { - time_t ts = ioloop_time; + int64_t ts = ioloop_time; if (*stats_settings->carbon_name != '\0' && *stats_settings->carbon_server != '\0') { string_t *str = t_str_new(256); const char *prefix = t_strdup_printf("dovecot.%s.global", stats_settings->carbon_name); - str_printfa(str, "%s.logins %u %"PRIdTIME_T"\r\n", prefix, + str_printfa(str, "%s.logins %u %"PRId64"\r\n", prefix, mail_global_stats.num_logins, ts); - str_printfa(str, "%s.cmds %u %"PRIdTIME_T"\r\n", prefix, + str_printfa(str, "%s.cmds %u %"PRId64"\r\n", prefix, mail_global_stats.num_cmds, ts); - str_printfa(str, "%s.connected_sessions %u %"PRIdTIME_T"\r\n", + str_printfa(str, "%s.connected_sessions %u %"PRId64"\r\n", prefix, mail_global_stats.num_connected_sessions, ts); - str_printfa(str, "%s.last_reset %"PRIdTIME_T" %"PRIdTIME_T"\r\n", - prefix, mail_global_stats.reset_timestamp, ts); + str_printfa(str, "%s.last_reset %"PRId64" %"PRId64"\r\n", + prefix, (int64_t)mail_global_stats.reset_timestamp, ts); /* then export rest of the stats */ for(size_t i = 0; i < stats_field_count(); i++) { str_printfa(str, "%s.%s ", prefix, stats_field_name(i)); stats_field_value(str, mail_global_stats.stats, i); - str_printfa(str, " %"PRIdTIME_T"\r\n", ts); + str_printfa(str, " %"PRId64"\r\n", ts); } /* and send them along */ diff --git a/src/pop3/pop3-client.c b/src/pop3/pop3-client.c index 6a1b9be342..ef3e0deb45 100644 --- a/src/pop3/pop3-client.c +++ b/src/pop3/pop3-client.c @@ -76,13 +76,13 @@ static void client_idle_timeout(struct client *client) { if (client->cmd != NULL) { client_destroy(client, t_strdup_printf( - "Client has not read server output for for %"PRIdTIME_T" secs", - ioloop_time - client->last_output)); + "Client has not read server output for for %"PRId64" secs", + (int64_t)(ioloop_time - client->last_output))); } else { client_send_line(client, "-ERR Disconnected for inactivity."); client_destroy(client, t_strdup_printf( - "Inactivity - no input for %"PRIdTIME_T" secs", - ioloop_time - client->last_input)); + "Inactivity - no input for %"PRId64" secs", + (int64_t)(ioloop_time - client->last_input))); } } diff --git a/src/stats/event-exporter-fmt.c b/src/stats/event-exporter-fmt.c index a4ec5a83f9..3f7b7ea156 100644 --- a/src/stats/event-exporter-fmt.c +++ b/src/stats/event-exporter-fmt.c @@ -9,8 +9,8 @@ void event_export_helper_fmt_unix_time(string_t *dest, const struct timeval *time) { - str_printfa(dest, "%"PRIdTIME_T".%06u", time->tv_sec, - (unsigned int) time->tv_usec); + str_printfa(dest, "%"PRId64".%06u", (int64_t)time->tv_sec, + (unsigned int) time->tv_usec); } void event_export_helper_fmt_rfc3339_time(string_t *dest, diff --git a/src/stats/stats-service-openmetrics.c b/src/stats/stats-service-openmetrics.c index 9c50592e2e..a31b107558 100644 --- a/src/stats/stats-service-openmetrics.c +++ b/src/stats/stats-service-openmetrics.c @@ -100,8 +100,8 @@ static void openmetrics_export_dovecot(string_t *out) str_append(out, "# HELP process_start_time_seconds " "Timestamp of service start\n"); str_append(out, "# TYPE process_start_time_seconds gauge\n"); - str_printfa(out, "process_start_time_seconds %"PRIdTIME_T"\n", - stats_startup_time); + str_printfa(out, "process_start_time_seconds %"PRId64"\n", + (int64_t)stats_startup_time); str_append(out, "# HELP dovecot_build " "Dovecot build information\n");