Use __attribute__ ((format)) where possible and fix issues found by it

cute-signatures
Timo Teräs 2021-07-26 10:25:23 +03:00
parent 62e1cba691
commit aca77e8410
4 changed files with 9 additions and 8 deletions

View File

@ -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

View File

@ -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))

View File

@ -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;
}

View File

@ -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;