[pacman-dev] [PATCH] Use correct format specifiers

Rikard Falkeborn rikard.falkeborn at gmail.com
Tue Nov 10 19:51:55 UTC 2015


---
 lib/libalpm/diskspace.c |  2 +-
 lib/libalpm/dload.c     |  2 +-
 lib/libalpm/remove.c    |  2 +-
 lib/libalpm/util.c      |  2 +-
 src/pacman/callback.c   | 12 ++++++------
 src/pacman/conf.c       |  4 ++--
 src/pacman/util.c       |  4 ++--
 7 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index aaa0036..5bb2173 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -349,7 +349,7 @@ static int check_mountpoint(alpm_handle_t *handle, alpm_mountpoint_t *mp)
 			(uintmax_t)cushion, (uintmax_t)mp->fsp.f_bfree);
 	if(needed >= 0 && (fsblkcnt_t)needed > mp->fsp.f_bfree) {
 		_alpm_log(handle, ALPM_LOG_ERROR,
-				_("Partition %s too full: %jd blocks needed, %jd blocks free\n"),
+				_("Partition %s too full: %jd blocks needed, %ju blocks free\n"),
 				mp->mount_dir, (intmax_t)needed, (uintmax_t)mp->fsp.f_bfree);
 		return 1;
 	}
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 63523aa..f3df9cd 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -323,7 +323,7 @@ static void curl_set_handle_opts(struct dload_payload *payload,
 		curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
 		curl_easy_setopt(curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
 		_alpm_log(handle, ALPM_LOG_DEBUG,
-				"using time condition: %lu\n", (long)st.st_mtime);
+				"using time condition: %ld\n", (long)st.st_mtime);
 	} else if(stat(payload->tempfile_name, &st) == 0 && payload->allow_resume) {
 		/* a previous partial download exists, resume from end of file. */
 		payload->tempfile_openmode = "ab";
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index bc5713a..2fb7993 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -599,7 +599,7 @@ static int remove_package_files(alpm_handle_t *handle,
 		}
 	}
 
-	_alpm_log(handle, ALPM_LOG_DEBUG, "removing %zd files\n", filelist->count);
+	_alpm_log(handle, ALPM_LOG_DEBUG, "removing %zu files\n", filelist->count);
 
 	if(!newpkg) {
 		/* init progress bar, but only on true remove transactions */
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 66a2742..955bf6f 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -1290,7 +1290,7 @@ void *_alpm_greedy_grow(void **data, size_t *current, const size_t required)
 
 void _alpm_alloc_fail(size_t size)
 {
-	fprintf(stderr, "alloc failure: could not allocate %zd bytes\n", size);
+	fprintf(stderr, "alloc failure: could not allocate %zu bytes\n", size);
 }
 
 /* vim: set noet: */
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index 9260ece..7a21b22 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -418,8 +418,8 @@ void cb_question(alpm_question_t *question)
 				alpm_question_select_provider_t *q = &question->select_provider;
 				size_t count = alpm_list_count(q->providers);
 				char *depstring = alpm_dep_compute_string(q->depend);
-				colon_printf(_n("There is %zd provider available for %s\n",
-						"There are %zd providers available for %s:\n", count),
+				colon_printf(_n("There is %zu provider available for %s\n",
+						"There are %zu providers available for %s:\n", count),
 						count, depstring);
 				free(depstring);
 				select_display(q->providers);
@@ -443,10 +443,10 @@ void cb_question(alpm_question_t *question)
 				strftime(created, 12, "%Y-%m-%d", localtime(&time));
 
 				if(q->key->revoked) {
-					q->import = yesno(_("Import PGP key %d%c/%s, \"%s\", created: %s (revoked)?"),
+					q->import = yesno(_("Import PGP key %u%c/%s, \"%s\", created: %s (revoked)?"),
 							q->key->length, q->key->pubkey_algo, q->key->fingerprint, q->key->uid, created);
 				} else {
-					q->import = yesno(_("Import PGP key %d%c/%s, \"%s\", created: %s?"),
+					q->import = yesno(_("Import PGP key %u%c/%s, \"%s\", created: %s?"),
 							q->key->length, q->key->pubkey_algo, q->key->fingerprint, q->key->uid, created);
 				}
 			}
@@ -590,8 +590,8 @@ void cb_progress(alpm_progress_t event, const char *pkgname, int percent,
 
 	}
 
-	printf("(%*ld/%*ld) %ls%-*s", digits, (unsigned long)current,
-			digits, (unsigned long)howmany, wcstr, padwid, "");
+	printf("(%*zu/%*zu) %ls%-*s", digits, current,
+			digits, howmany, wcstr, padwid, "");
 
 	free(wcstr);
 
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index f02e361..a2ee9b4 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -95,8 +95,8 @@ config_t *config_new(void)
 	config_t *newconfig = calloc(1, sizeof(config_t));
 	if(!newconfig) {
 		pm_printf(ALPM_LOG_ERROR,
-				_n("malloc failure: could not allocate %zd byte\n",
-				   "malloc failure: could not allocate %zd bytes\n", sizeof(config_t)),
+				_n("malloc failure: could not allocate %zu byte\n",
+				   "malloc failure: could not allocate %zu bytes\n", sizeof(config_t)),
 				sizeof(config_t));
 		return NULL;
 	}
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 5f331e8..3ab71cf 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -812,7 +812,7 @@ static alpm_list_t *create_verbose_header(size_t count)
 	alpm_list_t *ret = NULL;
 
 	char *header;
-	pm_asprintf(&header, "%s (%zd)", _("Package"), count);
+	pm_asprintf(&header, "%s (%zu)", _("Package"), count);
 
 	add_table_cell(&ret, header, CELL_TITLE | CELL_FREE);
 	add_table_cell(&ret, _("Old Version"), CELL_TITLE);
@@ -921,7 +921,7 @@ static void _display_targets(alpm_list_t *targets, int verbose)
 	}
 
 	/* print to screen */
-	pm_asprintf(&str, "%s (%zd)", _("Packages"), alpm_list_count(targets));
+	pm_asprintf(&str, "%s (%zu)", _("Packages"), alpm_list_count(targets));
 	printf("\n");
 
 	cols = getcols();
-- 
2.6.2


More information about the pacman-dev mailing list