Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
pkg: avoid a bunch of warnings
Pierre Pronchery committed 2 months ago
commit 3b9bfd75e64f24f9b5fa31cf59b595a3e8d97472
parent 11b9da5
20 files changed +55 -31
modified libpkg/lua_scripts.c
@@ -100,16 +100,16 @@ pkg_lua_script_run(struct pkg * const pkg, pkg_lua_script type, bool upgrade)

			/* parse and set arguments of the line is in the comments */
			if (STARTS_WITH(script, "-- args: ")) {
-
				char *walk, *begin, *line = NULL;
+
				char *walk, *begin, *cline = NULL;
				int spaces, argc = 0;
				char **args = NULL;

				walk = strchr(script, '\n');
				begin = script + strlen("-- args: ");
-
				line = xstrndup(begin, walk - begin);
-
				spaces = pkg_utils_count_spaces(line);
+
				cline = xstrndup(begin, walk - begin);
+
				spaces = pkg_utils_count_spaces(cline);
				args = xmalloc((spaces + 1)* sizeof(char *));
-
				walk = xstrdup(line);
+
				walk = xstrdup(cline);
				while (walk != NULL) {
					args[argc++] = pkg_utils_tokenize(&walk);
				}
modified libpkg/metalog.c
@@ -100,7 +100,7 @@ out:
}

void
-
metalog_close()
+
metalog_close(void)
{
	if (metalogfp != NULL) {
		fclose(metalogfp);
modified libpkg/pkg_abi.c
@@ -326,7 +326,8 @@ pkg_abi_from_file(struct pkg_abi *abi)
	char work_abi_file[PATH_MAX];
	char work_arch_hint[PATH_MAX];

-
	int i, fd;
+
	size_t i;
+
	int fd;

	/*
	 * Perhaps not yet needed, but it may be in the future that there's no
modified libpkg/pkg_abi_macho.c
@@ -103,6 +103,7 @@ pkg_arch_to_cputype(enum pkg_arch arch) {
		cpu.type_is64 = true;
		cpu.subtype_ppc = CPU_SUBTYPE_POWERPC_ALL;
		break;
+
	case PKG_ARCH_ANY:
	case PKG_ARCH_POWERPC64LE:
	case PKG_ARCH_RISCV32:
	case PKG_ARCH_RISCV64:
@@ -455,7 +456,7 @@ pkg_analyse_macho(const bool developer_mode, struct pkg *pkg,
}

int
-
pkg_analyse_close_macho()
+
pkg_analyse_close_macho(void)
{
	return EPKG_OK;
}
modified libpkg/pkg_attributes.c
@@ -375,6 +375,19 @@ pkg_get_element(struct pkg *p, pkg_attr a)
		e->stringlist->list = &p->licenses;
		e->type = PKG_STRINGLIST;
		break;
+
	case PKG_ATTR_COMMENT:
+
	case PKG_ATTR_MTREE:
+
	case PKG_ATTR_MESSAGE:
+
	case PKG_ATTR_OLD_VERSION:
+
	case PKG_ATTR_DIGEST:
+
	case PKG_ATTR_LICENSE_LOGIC:
+
	case PKG_ATTR_ROWID:
+
	case PKG_ATTR_TIME:
+
	case PKG_ATTR_OLD_DIGEST:
+
	case PKG_ATTR_DEP_FORMULA:
+
	case PKG_ATTR_CONFLICTS:
+
	case PKG_ATTR_NUM_FIELDS:
+
		break;
	}

	return (e);
modified libpkg/pkg_audit.c
@@ -549,6 +549,7 @@ pkg_audit_parse_vulnxml(struct pkg_audit *audit)
	while (walk < end) {
		r = yxml_parse(&x, *walk++);
		switch (r) {
+
		case YXML_EEOF:
		case YXML_EREF:
		case YXML_ESTACK:
			pkg_emit_error("Unexpected EOF while parsing vulnxml");
@@ -579,6 +580,11 @@ pkg_audit_parse_vulnxml(struct pkg_audit *audit)
			vulnxml_end_attribute(&ud, &x);
			/* ignore */
			break;
+
		case YXML_OK:
+
		case YXML_PISTART:
+
		case YXML_PICONTENT:
+
		case YXML_PIEND:
+
			break;
		}
	}

modified libpkg/pkg_checksum.c
@@ -49,7 +49,7 @@ struct kv {
	struct kv *next;
};

-
struct kv *
+
static struct kv *
kv_new(const char *k, const char *v)
{
	struct kv *kv = xcalloc(1, sizeof(*kv));
@@ -160,6 +160,7 @@ static const struct _pkg_cksum_type {
		-1,
		NULL,
		NULL,
+
		NULL,
		NULL
	}
};
modified libpkg/pkg_config.c
@@ -1022,7 +1022,7 @@ type_to_string(int type)
	return ("unknown");
}

-
const struct pkg_dbg_flags *
+
static const struct pkg_dbg_flags *
_find_flag(const char *str)
{
	for (size_t i = 0; i < NELEM(debug_flags); i++) {
@@ -1057,7 +1057,7 @@ config_validate_debug_flags(const ucl_object_t *o)
}

static bool
-
config_validate_shlib_provide_paths() {
+
config_validate_shlib_provide_paths(void) {
	const char *config_options[] = {
		"SHLIB_PROVIDE_PATHS_NATIVE",
		"SHLIB_PROVIDE_PATHS_COMPAT_32",
modified libpkg/pkg_cpe.c
@@ -31,8 +31,8 @@
#include "pkg/audit.h"
#include "private/pkg_cpe.h"

-
struct pkg_audit_cpe *
-
pkg_cpe_new()
+
static struct pkg_audit_cpe *
+
pkg_cpe_new(void)
{
	return (struct pkg_audit_cpe *)xcalloc(1, sizeof(struct pkg_audit_cpe));
}
modified libpkg/pkg_cudf.c
@@ -61,7 +61,7 @@ cudf_print_package_name(FILE *f, const char *name)
}

static inline int
-
cudf_print_element(FILE *f, const char *line, bool has_next, int *column)
+
cudf_print_element(FILE *f, const char *line, bool has_next, size_t *column)
{
	int ret = 0;
	if (*column > 80) {
@@ -83,7 +83,7 @@ cudf_print_element(FILE *f, const char *line, bool has_next, int *column)
}

static inline int
-
cudf_print_conflict(FILE *f, const char *uid, int ver, bool has_next, int *column)
+
cudf_print_conflict(FILE *f, const char *uid, int ver, bool has_next, size_t *column)
{
	int ret = 0;
	if (*column > 80) {
@@ -113,7 +113,8 @@ cudf_emit_pkg(struct pkg *pkg, int version, FILE *f,
	struct pkg_dep *dep;
	struct pkg_conflict *conflict;
	struct pkg_job_universe_item *u;
-
	int column = 0, ver;
+
	size_t column = 0;
+
	int ver;

	if (fprintf(f, "package: ") < 0)
		return (EPKG_FATAL);
@@ -182,7 +183,7 @@ static int
cudf_emit_request_packages(const char *op, struct pkg_jobs *j, FILE *f)
{
	struct pkg_job_request *req;
-
	int column = 0, cnt = 0, max;
+
	size_t column = 0, cnt = 0, max;
	bool printed = false;
	pkghash_it it;

modified libpkg/pkg_elf.c
@@ -685,6 +685,6 @@ int pkg_analyse_elf(const bool developer_mode, struct pkg *pkg,
	return ret;
}

-
int pkg_analyse_close_elf() {
+
int pkg_analyse_close_elf(void) {
	return EPKG_OK;
}
modified libpkg/pkg_jobs.c
@@ -459,7 +459,7 @@ append_to_del_request(struct pkg_jobs *j, pkgs_t *to_process, const char *uid, c
	return (true);
}

-
bool
+
static bool
delete_process_provides(struct pkg_jobs *j, struct pkg *lp, const char *provide,
    struct pkgdb_it *(*provideq)(struct pkgdb *db, const char *req),
    struct pkgdb_it *(*requireq)(struct pkgdb *db, const char *req),
modified libpkg/pkg_repo_create.c
@@ -1052,7 +1052,7 @@ pack_sign(struct packing *pack, struct pkgsign_ctx *sctx, const char *path,
	sigtype = pkgsign_impl_name(sctx);
	if (!STREQ(sigtype, "rsa")) {
		size = snprintf(buf, sizeof(buf), "%s%s$", PKGSIGN_HEAD, sigtype);
-
		if (size >= sizeof(buf)) {
+
		if (size >= (int)sizeof(buf)) {
			free(sigret);
			return (EPKG_FATAL);
		}
@@ -1104,7 +1104,7 @@ pack_command_sign(struct packing *pack, const char *path, char **argv, int argc,
			sigtype[--typelen] = '\0';
		size = snprintf(buf, sizeof(buf), "%s%s$", PKGSIGN_HEAD, sigtype);
		free(sigtype);
-
		if (size >= sizeof(buf)) {
+
		if (size >= (int)sizeof(buf)) {
			free(sig);
			free(pub);
			return (EPKG_FATAL);
modified libpkg/pkg_solve.c
@@ -856,7 +856,8 @@ pkg_solve_jobs_to_sat(struct pkg_jobs *j)
static int
pkg_solve_picosat_iter(struct pkg_solve_problem *problem, int iter __unused)
{
-
	int res, i;
+
	size_t i;
+
	int res;
	struct pkg_solve_variable *var, *cur;
	bool is_installed = false;

modified libpkg/pkgbase.c
@@ -98,7 +98,7 @@ int
scan_system_shlibs(charv_t *system_shlibs, const char *rootdir)
{
	int r = EPKG_OK;
-
	for (int i = 0; i < NELEM(system_shlib_table); i++) {
+
	for (size_t i = 0; i < NELEM(system_shlib_table); i++) {
		char *dir;
		if (rootdir != NULL) {
			xasprintf(&dir, "%s%s", rootdir, system_shlib_table[i].dir);
modified libpkg/private/binfmt.h
@@ -19,10 +19,10 @@ int pkg_elf_abi_from_fd(int fd, struct pkg_abi *abi);
int pkg_analyse_init_elf(const char* stage);
int pkg_analyse_elf(const bool developer_mode, struct pkg *pkg,
    const char *fpath, char **provided, enum pkg_shlib_flags *provided_flags);
-
int pkg_analyse_close_elf();
+
int pkg_analyse_close_elf(void);

int pkg_macho_abi_from_fd(int fd, struct pkg_abi *abi, enum pkg_arch arch_hint);
int pkg_analyse_init_macho(const char* stage);
int pkg_analyse_macho(const bool developer_mode, struct pkg *pkg,
    const char *fpath, char **provided, enum pkg_shlib_flags *provided_flags);
-
int pkg_analyse_close_macho();
+
int pkg_analyse_close_macho(void);
modified libpkg/private/pkg.h
@@ -891,7 +891,7 @@ char* pkg_message_to_str(struct pkg *pkg);
int metalog_open(const char *metalog);
int metalog_add(int type, const char *path, const char *uname,
    const char *gname, int mode, unsigned long fflags, const char *link);
-
void metalog_close();
+
void metalog_close(void);
enum pkg_metalog_type {
	PKG_METALOG_FILE = 0,
	PKG_METALOG_DIR,
modified libpkg/repo/binary/init.c
@@ -71,7 +71,7 @@ pkg_repo_binary_get_user_version(sqlite3 *sqlite, int *reposcver)
	return (retcode);
}

-
int
+
static int
pkg_repo_binary_check_version(struct pkg_repo *repo, sqlite3 *sqlite)
{
	int reposcver;
modified libpkg/scripts.c
@@ -166,9 +166,9 @@ pkg_script_run(struct pkg * const pkg, pkg_script type, bool upgrade, bool noexe
			 * consider cur_pipe[1] to probably be the lastest
			 * opened fd close all unuseful fd up to there
			 */
-
			for (int i = 5; i <= cur_pipe[1]; i++) {
-
				if (i != cur_pipe[0] && i != ctx.devnullfd)
-
					posix_spawn_file_actions_addclose(&action, i);
+
			for (int j = 5; j <= cur_pipe[1]; j++) {
+
				if (j != cur_pipe[0] && j != ctx.devnullfd)
+
					posix_spawn_file_actions_addclose(&action, j);
			}
			if (script_len > argmax) {
				if (pipe(stdin_pipe) < 0) {
modified libpkg/triggers.c
@@ -297,7 +297,7 @@ trigger_is_it_a_cleanup(struct triggers *t, const char *path)
/*
 * Load triggers from a specific directory and add them to a vec.
 */
-
void
+
static void
triggers_load_from(trigger_t *triggers, bool cleanup_only, const char *dir)
{
	int dfd;
@@ -632,7 +632,7 @@ append_touched_file(const char *path)
	free(newpath);
}

-
void
+
static void
exec_deferred(int dfd, const char *name)
{
	bool sandbox = false;