diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-07-26 10:25:23 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-07-26 10:25:23 +0300 |
commit | aca77e84106c52c9cbb046b85a35fd806685ca84 (patch) | |
tree | 69ef60b8532ee382f5e031e10f9e844ff0223b82 | |
parent | 62e1cba691fa101e94d23728022bfd8353947c50 (diff) | |
download | apk-tools-aca77e84106c52c9cbb046b85a35fd806685ca84.tar.gz apk-tools-aca77e84106c52c9cbb046b85a35fd806685ca84.tar.bz2 apk-tools-aca77e84106c52c9cbb046b85a35fd806685ca84.tar.xz apk-tools-aca77e84106c52c9cbb046b85a35fd806685ca84.zip |
Use __attribute__ ((format)) where possible and fix issues found by it
-rw-r--r-- | src/apk_print.h | 8 | ||||
-rw-r--r-- | src/app_add.c | 2 | ||||
-rw-r--r-- | src/app_mkpkg.c | 3 | ||||
-rw-r--r-- | src/package.c | 4 |
4 files changed, 9 insertions, 8 deletions
diff --git a/src/apk_print.h b/src/apk_print.h index a8e734a..e97247b 100644 --- a/src/apk_print.h +++ b/src/apk_print.h @@ -26,7 +26,7 @@ struct apk_url_print { void apk_url_parse(struct apk_url_print *, const char *); #define URL_FMT "%.*s%s%s" -#define URL_PRINTF(u) u.len_before_pw, u.url, u.pwmask, u.url_or_host +#define URL_PRINTF(u) (int)u.len_before_pw, u.url, u.pwmask, u.url_or_host struct apk_out { int verbosity; @@ -48,7 +48,8 @@ static inline int apk_out_verbosity(struct apk_out *out) { return out->verbosity #define apk_dbg2(out, args...) do { if (apk_out_verbosity(out) >= 3) { apk_out_fmt(out, NULL, args); } } while (0) void apk_out_reset(struct apk_out *); -void apk_out_fmt(struct apk_out *, const char *prefix, const char *format, ...); +void apk_out_fmt(struct apk_out *, const char *prefix, const char *format, ...) + __attribute__ ((format (printf, 3, 4))); void apk_out_log_argv(struct apk_out *, char **argv); struct apk_progress { @@ -68,6 +69,7 @@ struct apk_indent { int apk_print_indented(struct apk_indent *i, apk_blob_t blob); void apk_print_indented_words(struct apk_indent *i, const char *text); -void apk_print_indented_fmt(struct apk_indent *i, const char *fmt, ...); +void apk_print_indented_fmt(struct apk_indent *i, const char *fmt, ...) + __attribute__ ((format (printf, 2, 3))); #endif diff --git a/src/app_add.c b/src/app_add.c index 559475e..b4fb356 100644 --- a/src/app_add.c +++ b/src/app_add.c @@ -132,7 +132,7 @@ static int add_main(void *ctx, struct apk_ctx *ac, struct apk_string_array *args if (APK_BLOB_IS_NULL(b) || virtdep.conflict || virtdep.result_mask != APK_DEPMASK_ANY || virtdep.version != &apk_atom_null) { - apk_err(out, "%s: bad package specifier"); + apk_err(out, "%s: bad package specifier", actx->virtpkg); return -1; } if (virtdep.name->name[0] != '.' && non_repository_check(db)) diff --git a/src/app_mkpkg.c b/src/app_mkpkg.c index 00f467c..e68a426 100644 --- a/src/app_mkpkg.c +++ b/src/app_mkpkg.c @@ -161,8 +161,7 @@ static int mkpkg_process_dirent(void *pctx, int dirfd, const char *entry) return r; default: apk_pathbuilder_push(&ctx->pb, entry); - apk_out(out, "%s: special file ignored", - apk_pathbuilder_cstr(&ctx->pb), entry); + apk_out(out, "%s: special file ignored", apk_pathbuilder_cstr(&ctx->pb)); apk_pathbuilder_pop(&ctx->pb); return 0; } diff --git a/src/package.c b/src/package.c index fd0104a..9686286 100644 --- a/src/package.c +++ b/src/package.c @@ -904,8 +904,8 @@ static int read_info_entry(void *ctx, const struct apk_file_info *ae, read_info_line(ctx, l); } else if (strcmp(ae->name, ".INSTALL") == 0) { apk_warn(&ri->db->ctx->out, - "Package '%s-%s' contains deprecated .INSTALL", - pkg->name->name, pkg->version); + "Package '%s-" BLOB_FMT "' contains deprecated .INSTALL", + pkg->name->name, BLOB_PRINTF(*pkg->version)); } return 0; |