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:32:05 +0300 |
commit | 0eac0ed5f5575e4e115cc6a002b05e59d7f98f55 (patch) | |
tree | 98dd4462056b357d5aeae1b81010866f0dbe30df /src | |
parent | 9e54fcf4be0d62e13e5a6fed481a1c08cd59c871 (diff) | |
download | apk-tools-0eac0ed5f5575e4e115cc6a002b05e59d7f98f55.tar.gz apk-tools-0eac0ed5f5575e4e115cc6a002b05e59d7f98f55.tar.bz2 apk-tools-0eac0ed5f5575e4e115cc6a002b05e59d7f98f55.tar.xz apk-tools-0eac0ed5f5575e4e115cc6a002b05e59d7f98f55.zip |
Use __attribute__ ((format)) where possible and fix issues found by it
Diffstat (limited to 'src')
-rw-r--r-- | src/apk_print.h | 11 | ||||
-rw-r--r-- | src/app_add.c | 2 | ||||
-rw-r--r-- | src/package.c | 4 |
3 files changed, 10 insertions, 7 deletions
diff --git a/src/apk_print.h b/src/apk_print.h index 8e4dd46..1d5dfd6 100644 --- a/src/apk_print.h +++ b/src/apk_print.h @@ -22,7 +22,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 #define apk_error(args...) do { apk_log_err("ERROR: ", args); } while (0) #define apk_warning(args...) do { if (apk_verbosity > 0) { apk_log_err("WARNING: ", args); } } while (0) @@ -30,8 +30,10 @@ void apk_url_parse(struct apk_url_print *, const char *); extern int apk_progress_fd; -void apk_log(const char *prefix, const char *format, ...); -void apk_log_err(const char *prefix, const char *format, ...); +void apk_log(const char *prefix, const char *format, ...) + __attribute__ ((format (printf, 2, 3))); +void apk_log_err(const char *prefix, const char *format, ...) + __attribute__ ((format (printf, 2, 3))); const char *apk_error_str(int error); void apk_reset_screen_width(void); @@ -46,6 +48,7 @@ struct apk_indent { void apk_print_progress(size_t done, size_t total); 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 f4acd22..4bc9894 100644 --- a/src/app_add.c +++ b/src/app_add.c @@ -129,7 +129,7 @@ static int add_main(void *ctx, struct apk_database *db, struct apk_string_array if (APK_BLOB_IS_NULL(b) || virtdep.conflict || virtdep.result_mask != APK_DEPMASK_ANY || virtdep.version != &apk_atom_null) { - apk_error("%s: bad package specifier"); + apk_error("%s: bad package specifier", actx->virtpkg); return -1; } if (virtdep.name->name[0] != '.' && non_repository_check(db)) diff --git a/src/package.c b/src/package.c index 6e7a062..c068b8d 100644 --- a/src/package.c +++ b/src/package.c @@ -907,8 +907,8 @@ static int read_info_entry(void *ctx, const struct apk_file_info *ae, while (!APK_BLOB_IS_NULL(l = apk_istream_get_delim(is, token))) read_info_line(ctx, l); } else if (strcmp(ae->name, ".INSTALL") == 0) { - apk_warning("Package '%s-%s' contains deprecated .INSTALL", - pkg->name->name, pkg->version); + apk_warning("Package '%s-" BLOB_FMT "' contains deprecated .INSTALL", + pkg->name->name, BLOB_PRINTF(*pkg->version)); } return 0; |