Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
Fix format strings issues
Vsevolod Stakhov committed 9 years ago
commit 7957c5b0246261c23ba434da1c8f7de18df77f72
parent 052acf1
10 files changed +41 -37
modified libpkg/fetch.c
@@ -3,7 +3,7 @@
 * Copyright (c) 2011-2012 Julien Laffaye <jlaffaye@FreeBSD.org>
 * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -13,7 +13,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -169,7 +169,7 @@ ssh_read(void *data, char *buf, int len)
	ssize_t rlen;
	int deltams;

-
	pkg_debug(2, "ssh: start reading %d");
+
	pkg_debug(2, "ssh: start reading");

	if (fetchTimeout > 0) {
		gettimeofday(&timeout, NULL);
@@ -183,7 +183,7 @@ ssh_read(void *data, char *buf, int len)

	for (;;) {
		rlen = read(pfd.fd, buf, len);
-
		pkg_debug(2, "read %d", rlen);
+
		pkg_debug(2, "read %jd", (intmax_t)rlen);
		if (rlen >= 0) {
			break;
		} else if (rlen == -1) {
@@ -220,7 +220,7 @@ ssh_read(void *data, char *buf, int len)

	}

-
	pkg_debug(2, "ssh: have read %d bytes", rlen);
+
	pkg_debug(2, "ssh: have read %jd bytes", (intmax_t)rlen);

	return (rlen);
}
@@ -673,9 +673,9 @@ pkg_fetch_file_to_fd(struct pkg_repo *repo, const char *url, int dest,
		done += r;
		if (sz > 0) {
			left -= r;
-
			pkg_debug(4, "Read status: %d over %d", done, sz);
+
			pkg_debug(4, "Read status: %jd over %jd", (intmax_t)done, (intmax_t)sz);
		} else
-
			pkg_debug(4, "Read status: %d", done);
+
			pkg_debug(4, "Read status: %jd", (intmax_t)done);
		if (sz > 0)
			pkg_emit_progress_tick(done, sz);
	}
modified libpkg/pkg_add.c
@@ -147,20 +147,20 @@ attempt_to_merge(int rootfd, struct pkg_config_file *rcf, struct pkg *local,
	if (file_to_bufferat(rootfd, RELATIVE_PATH(rcf->path), &localconf, &sz) != EPKG_OK)
		return;

-
	pkg_debug(2, "size: %d vs %d", sz, strlen(lcf->content));
+
	pkg_debug(2, "size: %jd vs %jd", (intmax_t)sz, (intmax_t)strlen(lcf->content));

	if (sz == strlen(lcf->content)) {
		pkg_debug(2, "Ancient vanilla and deployed conf are the same size testing checksum");
		localsum = pkg_checksum_data(localconf, sz,
		    PKG_HASH_TYPE_SHA256_HEX);
		if (localsum && strcmp(localsum, lf->sum) == 0) {
-
			pkg_debug(2, "Checksum are the same %d", strlen(localconf));
+
			pkg_debug(2, "Checksum are the same %jd", (intmax_t)strlen(localconf));
			free(localconf);
			free(localsum);
			return;
		}
		free(localsum);
-
		pkg_debug(2, "Checksum are different %d", strlen(localconf));
+
		pkg_debug(2, "Checksum are different %jd", (intmax_t)strlen(localconf));
	}
	rcf->status = MERGE_FAILED;
	if (!merge) {
@@ -347,7 +347,8 @@ do_extract_dir(struct pkg* pkg, struct archive *a __unused, struct archive_entry

	d = pkg_get_dir(pkg, path);
	if (d == NULL) {
-
		pkg_emit_error("Directory %s not specified in the manifest, skipping");
+
		pkg_emit_error("Directory %s not specified in the manifest, skipping",
+
				path);
		return (EPKG_OK);
	}
	aest = archive_entry_stat(ae);
@@ -404,7 +405,7 @@ do_extract_symlink(struct pkg *pkg, struct archive *a __unused, struct archive_e

	f = pkg_get_file(pkg, path);
	if (f == NULL) {
-
		pkg_emit_error("Symlink %s not specified in the manifest");
+
		pkg_emit_error("Symlink %s not specified in the manifest", path);
		return (EPKG_FATAL);
	}

@@ -468,7 +469,7 @@ do_extract_hardlink(struct pkg *pkg, struct archive *a __unused, struct archive_

	f = pkg_get_file(pkg, path);
	if (f == NULL) {
-
		pkg_emit_error("Hardlink %s not specified in the manifest");
+
		pkg_emit_error("Hardlink %s not specified in the manifest", path);
		return (EPKG_FATAL);
	}
	lp = archive_entry_hardlink(ae);
@@ -566,7 +567,7 @@ do_extract_regfile(struct pkg *pkg, struct archive *a, struct archive_entry *ae,

	f = pkg_get_file(pkg, path);
	if (f == NULL) {
-
		pkg_emit_error("File %s not specified in the manifest");
+
		pkg_emit_error("File %s not specified in the manifest", path);
		return (EPKG_FATAL);
	}

modified libpkg/pkg_config.c
@@ -1204,7 +1204,7 @@ pkg_ini(const char *path, const char *reposdir, pkg_init_flags flags)
		}

		if (fatal_errors) {
-
			pkg_emit_error("invalid scheme %.*s", buf - url, url);
+
			pkg_emit_error("invalid scheme %.*s", (int)(buf - url), url);
			return (EPKG_FATAL);
		}
	}
modified libpkg/pkg_create.c
@@ -4,7 +4,7 @@
 * Copyright (c) 2014-2015 Matthew Seaman <matthew@FreeBSD.org>
 * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -14,7 +14,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -484,8 +484,8 @@ counter_init(const char *count_what, int64_t max)
	count = 0;
	what = count_what;
	maxcount = max;
-
	pkg_emit_progress_start("%-20s%*s[%ld]", what,
-
	    6 - magnitude(maxcount), " ", maxcount);
+
	pkg_emit_progress_start("%-20s%*s[%jd]", what,
+
	    6 - magnitude(maxcount), " ", (intmax_t)maxcount);

	return;
}
modified libpkg/pkg_delete.c
@@ -5,7 +5,7 @@
 * Copyright (c) 2011 Philippe Pepiot <phil@philpep.org>
 * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -15,7 +15,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -207,7 +207,7 @@ rmdir_p(struct pkgdb *db, struct pkg *pkg, char *dir, const char *prefix_r)
		return;

	pkg_debug(1, "Number of packages owning the directory '%s': %d",
-
	    fullpath, cnt);
+
	    fullpath, (int)cnt);
	/*
	 * At this moment the package we are removing have already been removed
	 * from the local database so if anything else is owning the directory
@@ -354,7 +354,7 @@ pkg_delete_file(struct pkg *pkg, struct pkg_file *file, unsigned force)

int
pkg_delete_files(struct pkg *pkg, unsigned force)
-
	/* force: 0 ... be careful and vocal about it. 
+
	/* force: 0 ... be careful and vocal about it.
	 *        1 ... remove files without bothering about checksums.
	 *        2 ... like 1, but remain silent if removal fails.
	 */
modified libpkg/pkg_event.c
@@ -375,8 +375,9 @@ pipeevent(struct pkg_event *ev)
		break;
	case PKG_EVENT_PROGRESS_TICK:
		utstring_printf(msg, "{ \"type\": \"INFO_PROGRESS_TICK\", "
-
		  "\"data\": { \"current\": %ld, \"total\" : %ld}}",
-
		  ev->e_progress_tick.current, ev->e_progress_tick.total);
+
		  "\"data\": { \"current\": %jd, \"total\" : %jd}}",
+
		  (intmax_t)ev->e_progress_tick.current,
+
		  (intmax_t)ev->e_progress_tick.total);
		break;
	case PKG_EVENT_BACKUP:
	case PKG_EVENT_RESTORE:
modified libpkg/pkg_macho.c
@@ -3,7 +3,7 @@
 * Copyright (c) 2011-2012 Baptiste Daroussin <bapt@FreeBSD.org>
 * Copyright (c) 2012-2013 Matthew Seaman <matthew@FreeBSD.org>
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -13,7 +13,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -240,7 +240,8 @@ host_os_info(char *osname, size_t sz, long long *major_version)

	/* Provide the OS name to the caller. */
	if (sz < strlen(ut.sysname) + 1) {
-
		pkg_emit_error("provided buffer is too small for os name: %s", strlen(ut.sysname));
+
		pkg_emit_error("provided buffer is too small for os name: %d",
+
				(int)strlen(ut.sysname));
		return EPKG_FATAL;
	}

modified libpkg/pkg_repo.c
@@ -6,7 +6,7 @@
 * Copyright (c) 2014 Vsevolod Stakhov <vsevolod@FreeBSD.org>
 *
 * All rights reserved.
-
 * 
+
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
@@ -16,7 +16,7 @@
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
-
 * 
+
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
@@ -427,7 +427,7 @@ pkg_repo_parse_sigkeys(const char *in, int inlen, struct sig_cert **sc)
		case fp_parse_flen:
			if (end - p < sizeof (int)) {
				pkg_emit_error("truncated reply for signature_fingerprints"
-
						"output", type);
+
						"output");
				return (EPKG_FATAL);
			}
			memcpy(&len, p, sizeof(int));
@@ -438,7 +438,7 @@ pkg_repo_parse_sigkeys(const char *in, int inlen, struct sig_cert **sc)
		case fp_parse_file:
			if (end - p < len || len <= 0) {
				pkg_emit_error("truncated reply for signature_fingerprints"
-
						"output, wanted %d bytes", type, len);
+
						"output, wanted %d bytes", len);
				return (EPKG_FATAL);
			}
			else if (len >= MAXPATHLEN) {
@@ -468,7 +468,7 @@ pkg_repo_parse_sigkeys(const char *in, int inlen, struct sig_cert **sc)
			}
			if (end - p < sizeof (int)) {
				pkg_emit_error("truncated reply for signature_fingerprints"
-
						"output", type);
+
						"output");
				free(s);
				return (EPKG_FATAL);
			}
@@ -483,7 +483,7 @@ pkg_repo_parse_sigkeys(const char *in, int inlen, struct sig_cert **sc)
			}
			if (end - p < len || len <= 0) {
				pkg_emit_error("truncated reply for signature_fingerprints"
-
						"output, wanted %d bytes", type, len);
+
						"output, wanted %d bytes", len);
				free(s);
				return (EPKG_FATAL);
			}
modified libpkg/pkg_repo_create.c
@@ -231,7 +231,7 @@ pkg_create_repo_worker(struct pkg_fts_item *start, size_t nelts,
	struct iovec iov[2];
	struct msghdr msg;
	UT_string *b;
-
	
+

	utstring_new(b);

	mfd = open(mlfile, O_APPEND|O_CREAT|O_WRONLY, 00644);
@@ -275,7 +275,7 @@ pkg_create_repo_worker(struct pkg_fts_item *start, size_t nelts,
	}

	pkg_manifest_keys_new(&keys);
-
	pkg_debug(1, "start worker to parse %d packages", nelts);
+
	pkg_debug(1, "start worker to parse %jd packages", (intmax_t)nelts);

	if (read_files)
		flags = PKG_OPEN_MANIFEST_ONLY;
modified libpkg/pkgdb.c
@@ -2810,7 +2810,8 @@ pkgdb_try_lock(struct pkgdb *db, const char *lock_sql, pkgdb_lock_t type,
	struct timespec ts;
	int ret = EPKG_END;
	const pkg_object *timeout, *max_tries;
-
	int64_t num_timeout = 1, num_maxtries = 1;
+
	double num_timeout = 1.0;
+
	int64_t num_maxtries = 1;
	const char reset_lock_sql[] = ""
			"DELETE FROM pkg_lock; INSERT INTO pkg_lock VALUES (0,0,0);";