Skip to content

Commit

Permalink
global: use %zu directly instead of PRIuSIZE_T
Browse files Browse the repository at this point in the history
  • Loading branch information
Josef 'Jeff' Sipek committed Mar 19, 2020
1 parent 659d51c commit 0360044
Show file tree
Hide file tree
Showing 60 changed files with 107 additions and 110 deletions.
2 changes: 1 addition & 1 deletion src/auth/auth-cache.c
Expand Up @@ -214,7 +214,7 @@ static void sig_auth_cache_stats(const siginfo_t *si ATTR_UNUSED, void *context)

cache_used = cache->max_size - cache->size_left;
i_info("Authentication cache current size: "
"%"PRIuSIZE_T" bytes used of %"PRIuSIZE_T" bytes (%u%%)",
"%zu bytes used of %zu bytes (%u%%)",
cache_used, cache->max_size,
(unsigned int)(cache_used * 100ULL / cache->max_size));

Expand Down
2 changes: 1 addition & 1 deletion src/auth/db-checkpassword.c
Expand Up @@ -468,7 +468,7 @@ void db_checkpassword_call(struct db_checkpassword *db,
output_len += strlen(auth_password);
if (output_len > CHECKPASSWORD_MAX_REQUEST_LEN) {
e_info(authdb_event(request),
"Username+password combination too long (%"PRIuSIZE_T" bytes)",
"Username+password combination too long (%zu bytes)",
output_len);
callback(request, DB_CHECKPASSWORD_STATUS_FAILURE,
NULL, request_callback);
Expand Down
2 changes: 1 addition & 1 deletion src/director/director-connection.c
Expand Up @@ -202,7 +202,7 @@ director_connection_append_stats(struct director_connection *conn, string_t *str
connected_msecs/1000, connected_msecs%1000);
}
if (o_stream_get_buffer_used_size(conn->output) > 0) {
str_printfa(str, ", %"PRIuSIZE_T" bytes in output buffer",
str_printfa(str, ", %zu bytes in output buffer",
o_stream_get_buffer_used_size(conn->output));
}
str_printfa(str, ", %zu peak output buffer size",
Expand Down
4 changes: 2 additions & 2 deletions src/doveadm/doveadm-dump-dbox.c
Expand Up @@ -97,8 +97,8 @@ dump_msg_hdr(struct istream *input, unsigned int hdr_size, uoff_t *msg_size_r)
if (i_stream_read_bytes(input, &data, &size, hdr_size) <= 0) {
if (size == 0)
return FALSE;
i_fatal("Partial message header read at %"PRIuUOFF_T": "
"%"PRIuSIZE_T" bytes", input->v_offset, size);
i_fatal("Partial message header read at %"PRIuUOFF_T": %zu bytes",
input->v_offset, size);
}
printf("offset %"PRIuUOFF_T":\n", input->v_offset);

Expand Down
6 changes: 3 additions & 3 deletions src/doveadm/doveadm-dump-log.c
Expand Up @@ -23,7 +23,7 @@ static void dump_hdr(struct istream *input, uint64_t *modseq_r,
if (ret < 0 && input->stream_errno != 0)
i_fatal("read() failed: %s", i_stream_get_error(input));
if (ret <= 0) {
i_fatal("file hdr read() %"PRIuSIZE_T" != %"PRIuSIZE_T,
i_fatal("file hdr read() %zu != %zu",
size, sizeof(hdr));
}
memcpy(&hdr, data, sizeof(hdr));
Expand Down Expand Up @@ -480,7 +480,7 @@ static int dump_record(struct istream *input, uint64_t *modseq,
if (ret <= 0) {
if (size == 0)
return 0;
i_fatal("rec hdr read() %"PRIuSIZE_T" != %"PRIuSIZE_T,
i_fatal("rec hdr read() %zu != %zu",
size, sizeof(hdr));
}
memcpy(&hdr, data, sizeof(hdr));
Expand All @@ -502,7 +502,7 @@ static int dump_record(struct istream *input, uint64_t *modseq,
if (ret < 0 && input->stream_errno != 0)
i_fatal("read() failed: %s", i_stream_get_error(input));
if (ret <= 0) {
i_fatal("rec data read() %"PRIuSIZE_T" != %"PRIuSIZE_T,
i_fatal("rec data read() %zu != %zu",
size, data_size);
}

Expand Down
2 changes: 1 addition & 1 deletion src/doveadm/doveadm-dump-mailboxlog.c
Expand Up @@ -24,7 +24,7 @@ static int dump_record(int fd)
return 0;

if (ret != sizeof(rec)) {
i_fatal("rec read() %"PRIuSIZE_T" != %"PRIuSIZE_T,
i_fatal("rec read() %zu != %zu",
ret, sizeof(rec));
}

Expand Down
2 changes: 1 addition & 1 deletion src/imap/imap-client.c
Expand Up @@ -339,7 +339,7 @@ client_command_stats_append(string_t *str,
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_printfa(str, "+%zu", buffered_size);
str_append(str, " B out");
}

Expand Down
3 changes: 1 addition & 2 deletions src/imap/imap-master-client.c
Expand Up @@ -248,8 +248,7 @@ imap_master_client_input_args(struct connection *conn, const char *const *args,
!i_stream_add_data(imap_client->input,
master_input.client_input->data,
master_input.client_input->used)) {
i_error("imap-master: Couldn't add %"PRIuSIZE_T
" bytes to client's input stream",
i_error("imap-master: Couldn't add %zu bytes to client's input stream",
master_input.client_input->used);
client_destroy(imap_client, "Client initialization failed");
return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/imap/main.c
Expand Up @@ -89,7 +89,7 @@ void imap_refresh_proctitle(void)
wait_output = TRUE;
}
if (wait_output) {
str_printfa(title, " - %"PRIuSIZE_T" bytes waiting",
str_printfa(title, " - %zu bytes waiting",
o_stream_get_buffer_used_size(client->output));
if (o_stream_is_corked(client->output))
str_append(title, " corked");
Expand Down
2 changes: 1 addition & 1 deletion src/lib-compression/test-compression.c
Expand Up @@ -512,7 +512,7 @@ test_compression_handler_random_io(const struct compression_handler *handler)
}

if (test_has_failed()) {
i_info("Test parameters: size=%"PRIuSIZE_T,
i_info("Test parameters: size=%zu",
in_buf_size);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib-dcrypt/istream-decrypt.c
Expand Up @@ -867,7 +867,7 @@ i_stream_decrypt_read(struct istream_private *stream)
stream->istream.stream_errno = EINVAL;
io_stream_set_error(&stream->iostream,
"Header too large "
"(more than %"PRIuSIZE_T" bytes)",
"(more than %zu bytes)",
size);
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib-dict/dict-memcached-ascii.c
Expand Up @@ -566,7 +566,7 @@ memcached_send_change(struct dict_memcached_ascii_commit_ctx *ctx,
switch (change->type) {
case DICT_CHANGE_TYPE_SET:
state = MEMCACHED_INPUT_STATE_STORED;
str_printfa(ctx->str, "set %s 0 0 %"PRIuSIZE_T"\r\n%s\r\n",
str_printfa(ctx->str, "set %s 0 0 %zu\r\n%s\r\n",
key, strlen(change->value.str), change->value.str);
break;
case DICT_CHANGE_TYPE_UNSET:
Expand Down
2 changes: 1 addition & 1 deletion src/lib-dict/dict-memcached.c
Expand Up @@ -291,7 +291,7 @@ memcached_dict_lookup(struct dict *_dict, pool_t pool, const char *key,
key_len = strlen(key);
if (key_len > 0xffff) {
*error_r = t_strdup_printf(
"memcached: Key is too long (%"PRIuSIZE_T" bytes): %s", key_len, key);
"memcached: Key is too long (%zu bytes): %s", key_len, key);
return -1;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib-fs/fs-posix.c
Expand Up @@ -624,7 +624,7 @@ static int fs_posix_write(struct fs_file *_file, const void *data, size_t size)
}
if ((size_t)ret != size) {
fs_set_error(_file->event, ENOSPC,
"write(%s) returned %"PRIuSIZE_T"/%"PRIuSIZE_T,
"write(%s) returned %zu/%zu",
file->full_path, (size_t)ret, size);
return -1;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib-fts/fts-filter-stemmer-snowball.c
Expand Up @@ -84,8 +84,8 @@ fts_filter_stemmer_snowball_filter(struct fts_filter *filter,
/* the only reason why this could fail is because of
out of memory. */
i_fatal_status(FATAL_OUTOFMEM,
"sb_stemmer_stem(len=%"PRIuSIZE_T") failed: "
"Out of memory", strlen(*token));
"sb_stemmer_stem(len=%zu) failed: Out of memory",
strlen(*token));
}
*token = t_strndup(base, sb_stemmer_length(sp->stemmer));
return 1;
Expand Down
4 changes: 2 additions & 2 deletions src/lib-http/http-client-connection.c
Expand Up @@ -1532,13 +1532,13 @@ http_client_connection_connected(struct connection *_conn, bool success)
if (set->socket_send_buffer_size > 0) {
if (net_set_send_buffer_size(_conn->fd_out,
set->socket_send_buffer_size) < 0)
i_error("net_set_send_buffer_size(%"PRIuSIZE_T") failed: %m",
i_error("net_set_send_buffer_size(%zu) failed: %m",
set->socket_send_buffer_size);
}
if (set->socket_recv_buffer_size > 0) {
if (net_set_recv_buffer_size(_conn->fd_in,
set->socket_recv_buffer_size) < 0)
i_error("net_set_recv_buffer_size(%"PRIuSIZE_T") failed: %m",
i_error("net_set_recv_buffer_size(%zu) failed: %m",
set->socket_recv_buffer_size);
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib-http/http-client-request.c
Expand Up @@ -1195,7 +1195,7 @@ int http_client_request_send_more(struct http_client_request *req,
o_stream_set_max_buffer_size(output, (size_t)-1);

i_assert(req->payload_input->v_offset >= offset);
e_debug(req->event, "Send more (sent %"PRIuUOFF_T", buffered=%"PRIuSIZE_T")",
e_debug(req->event, "Send more (sent %"PRIuUOFF_T", buffered=%zu)",
(uoff_t)(req->payload_input->v_offset - offset),
o_stream_get_buffer_used_size(output));

Expand Down
4 changes: 2 additions & 2 deletions src/lib-http/http-server-connection.c
Expand Up @@ -1096,13 +1096,13 @@ http_server_connection_create(struct http_server *server,
if (set->socket_send_buffer_size > 0) {
if (net_set_send_buffer_size(fd_out,
set->socket_send_buffer_size) < 0)
i_error("net_set_send_buffer_size(%"PRIuSIZE_T") failed: %m",
i_error("net_set_send_buffer_size(%zu) failed: %m",
set->socket_send_buffer_size);
}
if (set->socket_recv_buffer_size > 0) {
if (net_set_recv_buffer_size(fd_in,
set->socket_recv_buffer_size) < 0)
i_error("net_set_recv_buffer_size(%"PRIuSIZE_T") failed: %m",
i_error("net_set_recv_buffer_size(%zu) failed: %m",
set->socket_recv_buffer_size);
}

Expand Down
4 changes: 2 additions & 2 deletions src/lib-http/test-http-payload.c
Expand Up @@ -801,7 +801,7 @@ test_client_download_payload_input(struct test_client_request *tcreq)
fsize = 0;
i_fatal("test client: download: "
"payload ended prematurely "
"(at least %"PRIuSIZE_T" bytes left)", fsize);
"(at least %zu bytes left)", fsize);
} else if (debug) {
i_debug("test client: download: "
"finished request for [%u]",
Expand Down Expand Up @@ -1039,7 +1039,7 @@ test_client_echo_payload_input(struct test_client_request *tcreq)
fsize = 0;
i_fatal("test client: echo: "
"payload ended prematurely "
"(at least %"PRIuSIZE_T" bytes left)", fsize);
"(at least %zu bytes left)", fsize);
} else if (debug) {
i_debug("test client: echo: "
"finished request for [%u]",
Expand Down
6 changes: 3 additions & 3 deletions src/lib-imap-client/imapc-connection.c
Expand Up @@ -1591,7 +1591,7 @@ static void imapc_connection_input(struct imapc_connection *conn)
conn->disconnect_reason);
} else if (ret == -2) {
str_printfa(str, "Server sent too large input "
"(buffer full at %"PRIuSIZE_T")",
"(buffer full at %zu)",
i_stream_get_data_size(conn->input));
} else if (conn->ssl_iostream == NULL) {
errstr = conn->input->stream_errno == 0 ? "EOF" :
Expand Down Expand Up @@ -2421,10 +2421,10 @@ void imapc_command_sendvf(struct imapc_command *cmd,
imap_append_quoted(cmd->data, arg);
else if ((cmd->conn->capabilities &
IMAPC_CAPABILITY_LITERALPLUS) != 0) {
str_printfa(cmd->data, "{%"PRIuSIZE_T"+}\r\n%s",
str_printfa(cmd->data, "{%zu+}\r\n%s",
strlen(arg), arg);
} else {
str_printfa(cmd->data, "{%"PRIuSIZE_T"}\r\n%s",
str_printfa(cmd->data, "{%zu}\r\n%s",
strlen(arg), arg);
}
break;
Expand Down
2 changes: 1 addition & 1 deletion src/lib-imap/imap-bodystructure.c
Expand Up @@ -697,7 +697,7 @@ static bool str_append_nstring(string_t *str, const struct imap_arg *arg)
str_append_c(str, '"');
break;
case IMAP_ARG_LITERAL: {
str_printfa(str, "{%"PRIuSIZE_T"}\r\n", strlen(cstr));
str_printfa(str, "{%zu}\r\n", strlen(cstr));
str_append(str, cstr);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib-imap/imap-quote.c
Expand Up @@ -46,7 +46,7 @@ imap_append_literal(string_t *dest, const char *src, unsigned int pos)
{
size_t full_len = pos + strlen(src+pos);

str_printfa(dest, "{%"PRIuSIZE_T"}\r\n", full_len);
str_printfa(dest, "{%zu}\r\n", full_len);
buffer_append(dest, src, full_len);
}

Expand Down Expand Up @@ -207,7 +207,7 @@ void imap_append_string_for_humans(string_t *dest,
return;
}

str_printfa(dest, "{%"PRIuSIZE_T"}\r\n", size - remove_count);
str_printfa(dest, "{%zu}\r\n", size - remove_count);
pos = str_len(dest);

last_lwsp = TRUE; whitespace_prefix = TRUE;
Expand Down
4 changes: 2 additions & 2 deletions src/lib-imap/imap-util.c
Expand Up @@ -92,7 +92,7 @@ void imap_write_arg(string_t *dest, const struct imap_arg *arg)
}
case IMAP_ARG_LITERAL: {
const char *strarg = imap_arg_as_astring(arg);
str_printfa(dest, "{%"PRIuSIZE_T"}\r\n",
str_printfa(dest, "{%zu}\r\n",
strlen(strarg));
str_append(dest, strarg);
break;
Expand Down Expand Up @@ -158,7 +158,7 @@ void imap_write_args_for_human(string_t *dest, const struct imap_arg *args)
const char *strarg = imap_arg_as_astring(args);

if (strpbrk(strarg, "\r\n") != NULL) {
str_printfa(dest, "<%"PRIuSIZE_T" byte multi-line literal>",
str_printfa(dest, "<%zu byte multi-line literal>",
strlen(strarg));
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib-imap/test-imap-url.c
Expand Up @@ -743,7 +743,7 @@ static void test_imap_url_valid(void)
bool equal = urlp->uauth_token_size == urlt->uauth_token_size;
size_t i;
test_out_quiet(t_strdup_printf(
"url->uauth_token_size = %"PRIuSIZE_T, urlp->uauth_token_size),
"url->uauth_token_size = %zu", urlp->uauth_token_size),
equal);

if (equal) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib-index/mail-cache.c
Expand Up @@ -509,7 +509,7 @@ int mail_cache_map(struct mail_cache *cache, size_t offset, size_t size,
if (ioloop_time != cache->last_mmap_error_time) {
cache->last_mmap_error_time = ioloop_time;
mail_cache_set_syscall_error(cache, t_strdup_printf(
"mmap(size=%"PRIuSIZE_T")", cache->mmap_length));
"mmap(size=%zu)", cache->mmap_length));
}
cache->mmap_length = 0;
return -1;
Expand Down
2 changes: 1 addition & 1 deletion src/lib-index/mail-index-map-hdr.c
Expand Up @@ -243,7 +243,7 @@ int mail_index_map_check_header(struct mail_index_map *map,
/* following some extra checks that only take a bit of CPU */
if (hdr->record_size < sizeof(struct mail_index_record)) {
*error_r = t_strdup_printf(
"record_size too small (%u < %"PRIuSIZE_T")",
"record_size too small (%u < %zu)",
hdr->record_size, sizeof(struct mail_index_record));
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib-index/mail-index-map-read.c
Expand Up @@ -67,7 +67,7 @@ static int mail_index_mmap(struct mail_index_map *map, uoff_t file_size)

if (rec_map->mmap_size < MAIL_INDEX_HEADER_MIN_SIZE) {
mail_index_set_error(index, "Corrupted index file %s: "
"File too small (%"PRIuSIZE_T")",
"File too small (%zu)",
index->filepath, rec_map->mmap_size);
return 0;
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib-index/mail-transaction-log-file.c
Expand Up @@ -1741,9 +1741,9 @@ mail_transaction_log_file_mmap(struct mail_transaction_log_file *file,
if (ioloop_time != file->last_mmap_error_time) {
file->last_mmap_error_time = ioloop_time;
log_file_set_syscall_error(file, t_strdup_printf(
"mmap(size=%"PRIuSIZE_T")", file->mmap_size));
"mmap(size=%zu)", file->mmap_size));
}
*reason_r = t_strdup_printf("mmap(size=%"PRIuSIZE_T") failed: %m",
*reason_r = t_strdup_printf("mmap(size=%zu) failed: %m",
file->mmap_size);
file->mmap_size = 0;
return -1;
Expand Down
4 changes: 2 additions & 2 deletions src/lib-index/mail-transaction-log-view.c
Expand Up @@ -778,7 +778,7 @@ log_view_get_next(struct mail_transaction_log_view *view,
if (view->cur_offset + sizeof(*hdr) > file_size) {
mail_transaction_log_file_set_corrupted(file,
"offset points outside file "
"(%"PRIuUOFF_T" + %"PRIuSIZE_T" > %"PRIuSIZE_T")",
"(%"PRIuUOFF_T" + %zu > %zu)",
view->cur_offset, sizeof(*hdr), file_size);
return -1;
}
Expand All @@ -800,7 +800,7 @@ log_view_get_next(struct mail_transaction_log_view *view,
if (file_size - view->cur_offset < full_size) {
mail_transaction_log_file_set_corrupted(file,
"record size too large (type=0x%x, "
"offset=%"PRIuUOFF_T", size=%u, end=%"PRIuSIZE_T")",
"offset=%"PRIuUOFF_T", size=%u, end=%zu)",
rec_type, view->cur_offset, full_size, file_size);
return -1;
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib-master/master-service-haproxy.c
Expand Up @@ -213,7 +213,7 @@ master_service_haproxy_parse_ssl_tlv(struct master_service_haproxy_conn *hpconn,
for(size_t i = 0; i < ssl_kv->len;) {
struct haproxy_pp2_tlv kv;
if (get_tlv(ssl_kv->data + i, ssl_kv->len - i, &kv) < 0) {
*error_r = t_strdup_printf("get_tlv(%"PRIuSIZE_T") failed:"
*error_r = t_strdup_printf("get_tlv(%zu) failed: "
"Truncated data", i);
return -1;
}
Expand Down Expand Up @@ -243,7 +243,7 @@ master_service_haproxy_parse_tlv(struct master_service_haproxy_conn *hpconn,
struct haproxy_pp2_tlv_ssl ssl_kv;

if (get_tlv(buf + i, blen - i, &kv) < 0) {
*error_r = t_strdup_printf("get_tlv(%"PRIuSIZE_T") failed:"
*error_r = t_strdup_printf("get_tlv(%zu) failed: "
"Truncated data", i);
return -1;
}
Expand All @@ -262,7 +262,7 @@ master_service_haproxy_parse_tlv(struct master_service_haproxy_conn *hpconn,
break;
case PP2_TYPE_SSL:
if (get_ssl_tlv(kv.data, kv.len, &ssl_kv) < 0) {
*error_r = t_strdup_printf("get_ssl_tlv(%"PRIuSIZE_T") failed:"
*error_r = t_strdup_printf("get_ssl_tlv(%zu) failed: "
"Truncated data", i);
return -1;
}
Expand Down Expand Up @@ -375,7 +375,7 @@ master_service_haproxy_read(struct master_service_haproxy_conn *hpconn)
if (ret < (ssize_t)size) {
i_error("haproxy(v2): Client disconnected: "
"Protocol payload length does not match header "
"(got=%"PRIuSIZE_T", expect=%"PRIuSIZE_T", rip=%s)",
"(got=%zu, expect=%zu, rip=%s)",
(size_t)ret, size, net_ip2addr(real_remote_ip));
return -1;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib-old-stats/stats-connection.c
Expand Up @@ -85,7 +85,7 @@ int stats_connection_send(struct stats_connection *conn, const string_t *str)

if (str_len(str) > PIPE_BUF && !pipe_warned) {
i_warning("stats update sent more bytes that PIPE_BUF "
"(%"PRIuSIZE_T" > %u), this may break statistics",
"(%zu > %u), this may break statistics",
str_len(str), (unsigned int)PIPE_BUF);
pipe_warned = TRUE;
}
Expand Down

0 comments on commit 0360044

Please sign in to comment.