From 301a5c444d0b738f0340812267b372c52a8fa990 Mon Sep 17 00:00:00 2001 From: Josef 'Jeff' Sipek <jeff.sipek@open-xchange.com> Date: Tue, 17 Mar 2020 09:33:24 -0400 Subject: [PATCH] global: use %zu directly instead of PRIuSIZE_T --- src/lib-managesieve/managesieve-arg.c | 2 +- src/lib-managesieve/managesieve-quote.c | 2 +- src/lib-sieve/plugins/editheader/cmd-addheader.c | 4 ++-- src/lib-sieve/plugins/editheader/ext-editheader-common.c | 2 +- src/lib-sieve/plugins/variables/ext-variables-common.c | 2 +- src/lib-sieve/sieve-binary-dumper.c | 7 +++---- src/lib-sieve/sieve-binary-file.c | 2 +- src/lib-sieve/sieve-lexer.c | 2 +- src/lib-sieve/storage/ldap/sieve-ldap-db.c | 2 +- src/managesieve/cmd-havespace.c | 2 +- src/managesieve/managesieve-quota.c | 8 +++----- src/plugins/imap-filter-sieve/cmd-filter-sieve.c | 2 +- src/plugins/imap-filter-sieve/imap-filter.c | 4 ++-- 13 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/lib-managesieve/managesieve-arg.c b/src/lib-managesieve/managesieve-arg.c index b05e95180..178bf450e 100644 --- a/src/lib-managesieve/managesieve-arg.c +++ b/src/lib-managesieve/managesieve-arg.c @@ -167,7 +167,7 @@ void managesieve_write_arg(string_t *dest, const struct managesieve_arg *arg) break; case MANAGESIEVE_ARG_LITERAL: { const char *strarg = managesieve_arg_as_string(arg); - str_printfa(dest, "{%"PRIuSIZE_T"}\r\n", + str_printfa(dest, "{%zu}\r\n", strlen(strarg)); str_append(dest, strarg); break; diff --git a/src/lib-managesieve/managesieve-quote.c b/src/lib-managesieve/managesieve-quote.c index 4e60ce472..a86818cd8 100644 --- a/src/lib-managesieve/managesieve-quote.c +++ b/src/lib-managesieve/managesieve-quote.c @@ -60,7 +60,7 @@ void managesieve_quote_append(string_t *str, const unsigned char *value, str_append_c(str, '"'); } else { /* return as literal */ - str_printfa(str, "{%"PRIuSIZE_T"}\r\n", value_len - extra); + str_printfa(str, "{%zu}\r\n", value_len - extra); } tmp = t_str_new(value_len+escape+4); diff --git a/src/lib-sieve/plugins/editheader/cmd-addheader.c b/src/lib-sieve/plugins/editheader/cmd-addheader.c index 08f86b806..f39cbb730 100644 --- a/src/lib-sieve/plugins/editheader/cmd-addheader.c +++ b/src/lib-sieve/plugins/editheader/cmd-addheader.c @@ -170,7 +170,7 @@ static bool cmd_addheader_validate if ( ext_editheader_header_too_large(cmd->ext, str_len(fvalue)) ) { sieve_argument_validate_error(valdtr, arg, "addheader command: " - "specified header value `%s' is too large (%"PRIuSIZE_T" bytes)", + "specified header value `%s' is too large (%zu bytes)", str_sanitize(str_c(fvalue), 80), str_len(fvalue)); return SIEVE_EXEC_FAILURE; } @@ -317,7 +317,7 @@ static int cmd_addheader_operation_execute if ( ext_editheader_header_too_large(this_ext, str_len(value)) ) { sieve_runtime_error(renv, NULL, "addheader action: " - "specified header value `%s' is too large (%"PRIuSIZE_T" bytes)", + "specified header value `%s' is too large (%zu bytes)", str_sanitize(str_c(value), 80), str_len(value)); return SIEVE_EXEC_FAILURE; } diff --git a/src/lib-sieve/plugins/editheader/ext-editheader-common.c b/src/lib-sieve/plugins/editheader/ext-editheader-common.c index 3a19da653..2bfe67997 100644 --- a/src/lib-sieve/plugins/editheader/ext-editheader-common.c +++ b/src/lib-sieve/plugins/editheader/ext-editheader-common.c @@ -120,7 +120,7 @@ bool ext_editheader_load if ( max_header_size < EXT_EDITHEADER_MINIMUM_MAX_HEADER_SIZE ) { e_warning(svinst->event, "editheader: " "value of sieve_editheader_max_header_size setting " - "(=%"PRIuSIZE_T") is less than the minimum (=%"PRIuSIZE_T") " + "(=%zu) is less than the minimum (=%zu) " "(ignored)", max_header_size, (size_t) EXT_EDITHEADER_MINIMUM_MAX_HEADER_SIZE); } else { diff --git a/src/lib-sieve/plugins/variables/ext-variables-common.c b/src/lib-sieve/plugins/variables/ext-variables-common.c index 99ca79e3c..be9f677a7 100644 --- a/src/lib-sieve/plugins/variables/ext-variables-common.c +++ b/src/lib-sieve/plugins/variables/ext-variables-common.c @@ -88,7 +88,7 @@ ext_variables_load(const struct sieve_extension *ext, void **context) e_warning(svinst->event, "variables: " "setting sieve_variables_max_variable_size " "is lower than required by standards " - "(>= %"PRIuSIZE_T" bytes)", + "(>= %zu bytes)", (size_t)EXT_VARIABLES_REQUIRED_MAX_VARIABLE_SIZE); } else { config->max_variable_size = size_setting; diff --git a/src/lib-sieve/sieve-binary-dumper.c b/src/lib-sieve/sieve-binary-dumper.c index 499763ea8..dfd475b5f 100644 --- a/src/lib-sieve/sieve-binary-dumper.c +++ b/src/lib-sieve/sieve-binary-dumper.c @@ -119,7 +119,7 @@ bool sieve_binary_dumper_run(struct sieve_binary_dumper *dumper, sieve_binary_block_get(sbin, i); sieve_binary_dumpf( - denv, "%3d: size: %"PRIuSIZE_T" bytes\n", + denv, "%3d: size: %zu bytes\n", i, sieve_binary_block_get_size(sblock)); } } @@ -234,7 +234,7 @@ void sieve_binary_dumper_hexdump(struct sieve_binary_dumper *dumper, struct sieve_binary_block *sblock = sieve_binary_block_get(sbin, i); - sieve_binary_dumpf(denv, "%3d: size: %"PRIuSIZE_T" bytes\n", + sieve_binary_dumpf(denv, "%3d: size: %zu bytes\n", i, sieve_binary_block_get_size(sblock)); } @@ -253,8 +253,7 @@ void sieve_binary_dumper_hexdump(struct sieve_binary_dumper *dumper, // FIXME: calculate offset more nicely. sieve_binary_dump_sectionf( - denv, "Block %d (%"PRIuSIZE_T" bytes, " - "file offset %08llx)", i, data_size, + denv, "Block %d (%zu bytes, file offset %08llx)", i, data_size, (unsigned long long int)sblock->offset + 8); line = t_str_new(128); diff --git a/src/lib-sieve/sieve-binary-file.c b/src/lib-sieve/sieve-binary-file.c index 602bf3951..832177eca 100644 --- a/src/lib-sieve/sieve-binary-file.c +++ b/src/lib-sieve/sieve-binary-file.c @@ -110,7 +110,7 @@ _save_full(struct sieve_binary *sbin, struct ostream *stream, if ((ret = o_stream_send(stream, pdata, bytes_left)) <= 0) { e_error(sbin->event, "save: " - "failed to write %"PRIuSIZE_T" bytes " + "failed to write %zu bytes " "to output stream: %s", bytes_left, strerror(stream->stream_errno)); return FALSE; diff --git a/src/lib-sieve/sieve-lexer.c b/src/lib-sieve/sieve-lexer.c index efc3d0644..a6968a990 100644 --- a/src/lib-sieve/sieve-lexer.c +++ b/src/lib-sieve/sieve-lexer.c @@ -69,7 +69,7 @@ sieve_lexer_create(struct sieve_script *script, svinst->max_script_size > 0 && (uoff_t)st->st_size > svinst->max_script_size) { sieve_error(ehandler, sieve_script_name(script), - "sieve script is too large (max %"PRIuSIZE_T" bytes)", + "sieve script is too large (max %zu bytes)", svinst->max_script_size); if (error_r != NULL) *error_r = SIEVE_ERROR_NOT_POSSIBLE; diff --git a/src/lib-sieve/storage/ldap/sieve-ldap-db.c b/src/lib-sieve/storage/ldap/sieve-ldap-db.c index 1ce67b879..0a7b44096 100644 --- a/src/lib-sieve/storage/ldap/sieve-ldap-db.c +++ b/src/lib-sieve/storage/ldap/sieve-ldap-db.c @@ -1150,7 +1150,7 @@ sieve_ldap_db_get_script(struct ldap_connection *conn, data = i_malloc(size); e_debug(storage->event, "db: " - "Found script with length %"PRIuSIZE_T, size); + "Found script with length %zu", size); memcpy(data, vals[0]->bv_val, size); diff --git a/src/managesieve/cmd-havespace.c b/src/managesieve/cmd-havespace.c index 468a92345..825c4f034 100644 --- a/src/managesieve/cmd-havespace.c +++ b/src/managesieve/cmd-havespace.c @@ -53,7 +53,7 @@ bool cmd_havespace(struct client_command_context *cmd) struct event_passthrough *e = client_command_create_finish_event(cmd); e_debug(e->event(), "Quota is within limits for script `%s' " - "with size %"PRIuSIZE_T, scriptname, size); + "with size %zu", scriptname, size); client_send_ok(client, "Putscript would succeed."); return TRUE; diff --git a/src/managesieve/managesieve-quota.c b/src/managesieve/managesieve-quota.c index 1ac3afbc6..07b58caf3 100644 --- a/src/managesieve/managesieve-quota.c +++ b/src/managesieve/managesieve-quota.c @@ -31,8 +31,7 @@ bool managesieve_quota_check_validsize(struct client_command_context *cmd, struct event_passthrough *e = client_command_create_finish_event(cmd); e_debug(e->event(), - "Script size check failed " - "(size %"PRIuSIZE_T" bytes): %s", + "Script size check failed (size %zu bytes): %s", size, error_msg); client_send_noresp(client, "QUOTA/MAXSIZE", error_msg); @@ -57,7 +56,7 @@ bool managesieve_quota_check_all(struct client_command_context *cmd, if (ret < 0) { client_command_storage_error( cmd, "Failed to check quota for script `%s' " - "(size %"PRIuSIZE_T" bytes)", scriptname, size); + "(size %zu bytes)", scriptname, size); return FALSE; } @@ -89,8 +88,7 @@ bool managesieve_quota_check_all(struct client_command_context *cmd, client_command_create_finish_event(cmd)-> add_str("error", error_msg); e_debug(e->event(), - "Quota check failed for script `%s' " - "(size %"PRIuSIZE_T" bytes): %s", + "Quota check failed for script `%s' (size %zu bytes): %s", scriptname, size, error_msg); client_send_noresp(client, resp_code, error_msg); diff --git a/src/plugins/imap-filter-sieve/cmd-filter-sieve.c b/src/plugins/imap-filter-sieve/cmd-filter-sieve.c index 4b2b5a6a6..79ed591f2 100644 --- a/src/plugins/imap-filter-sieve/cmd-filter-sieve.c +++ b/src/plugins/imap-filter-sieve/cmd-filter-sieve.c @@ -28,7 +28,7 @@ cmd_filter_sieve_compile_script(struct imap_filter_context *ctx) o_stream_nsend_str(client->output, t_strdup_printf("* FILTER (TAG %s) " - "%s {%"PRIuSIZE_T"}\r\n", + "%s {%zu}\r\n", cmd->tag, (ret < 0 ? "ERRORS" : "WARNINGS"), str_len(errors))); o_stream_nsend(client->output, diff --git a/src/plugins/imap-filter-sieve/imap-filter.c b/src/plugins/imap-filter-sieve/imap-filter.c index a21ac86ef..2255839d6 100644 --- a/src/plugins/imap-filter-sieve/imap-filter.c +++ b/src/plugins/imap-filter-sieve/imap-filter.c @@ -50,7 +50,7 @@ imap_filter_mail(struct client_command_context *cmd, struct mail *mail) str_printfa(reply, "* %u FILTERED (TAG %s) UID %u ", mail->seq, cmd->tag, mail->uid); if (ret < 0 || have_warnings) { - str_printfa(reply, "%s {%"PRIuSIZE_T"}\r\n", + str_printfa(reply, "%s {%zu}\r\n", (ret < 0 ? "ERRORS" : "WARNINGS"), str_len(errors)); str_append_str(reply, errors); @@ -159,7 +159,7 @@ imap_filter_start(struct imap_filter_context *ctx, o_stream_nsend_str(cmd->client->output, t_strdup_printf("* FILTER (TAG %s) " - "ERRORS {%"PRIuSIZE_T"}\r\n%s\r\n", + "ERRORS {%zu}\r\n%s\r\n", cmd->tag, strlen(error), error)); client_send_tagline(cmd, "NO Failed to initialize script execution"); -- GitLab