[pacman-dev] [PATCH] More consistent printing of off_t and time_t

Xavier Chantry chantry.xavier at gmail.com
Mon Mar 15 23:52:29 CET 2010


From: Xavier Chantry <shiningxc at gmail.com>

time_t : %ld
off_t : %jd and cast to intmax_t

Signed-off-by: Xavier Chantry <shiningxc at gmail.com>
---
 lib/libalpm/be_files.c |    6 +++---
 lib/libalpm/delta.c    |    2 +-
 lib/libalpm/dload.c    |    6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 4ddb136..d674f33 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <string.h>
-#include <stdint.h> /* uintmax_t, intmax_t */
+#include <stdint.h> /* intmax_t */
 #include <sys/stat.h>
 #include <dirent.h>
 #include <ctype.h>
@@ -835,11 +835,11 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
 			}
 			if(info->builddate) {
 				fprintf(fp, "%%BUILDDATE%%\n"
-								"%ju\n\n", (uintmax_t)info->builddate);
+								"%ld\n\n", info->builddate);
 			}
 			if(info->installdate) {
 				fprintf(fp, "%%INSTALLDATE%%\n"
-								"%ju\n\n", (uintmax_t)info->installdate);
+								"%ld\n\n", info->installdate);
 			}
 			if(info->packager) {
 				fprintf(fp, "%%PACKAGER%%\n"
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index 3aa7d5e..7283500 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -337,7 +337,7 @@ pmdelta_t *_alpm_delta_parse(char *line)
 	tmp2 = tmp;
 	STRDUP(delta->to, tmp2, RET_ERR(PM_ERR_MEMORY, NULL));
 
-	_alpm_log(PM_LOG_DEBUG, "delta : %s %s '%lld'\n", delta->from, delta->to, (long long)delta->delta_size);
+	_alpm_log(PM_LOG_DEBUG, "delta : %s %s '%jd'\n", delta->from, delta->to, (intmax_t)delta->delta_size);
 
 	return(delta);
 }
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index cff5cc5..c11148d 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -190,8 +190,8 @@ static int download_internal(const char *url, const char *localpath,
 
 	_alpm_log(PM_LOG_DEBUG, "ust.mtime: %ld local_time: %ld compare: %ld\n",
 			ust.mtime, local_time, local_time - ust.mtime);
-	_alpm_log(PM_LOG_DEBUG, "ust.size: %"PRId64" local_size: %"PRId64" compare: %"PRId64"\n",
-			ust.size, local_size, local_size - ust.size);
+	_alpm_log(PM_LOG_DEBUG, "ust.size: %jd local_size: %jd compare: %jd\n",
+			(intmax_t)ust.size, (intmax_t)local_size, (intmax_t)(local_size - ust.size));
 	if(!force && ust.mtime && ust.mtime == local_time
 			&& ust.size && ust.size == local_size) {
 		/* the remote time and size values agreed with what we have, so move on
@@ -224,7 +224,7 @@ static int download_internal(const char *url, const char *localpath,
 		fclose(localf);
 		localf = NULL;
 	} else if(fileurl->offset) {
-		_alpm_log(PM_LOG_DEBUG, "resuming download at position %"PRId64"\n", fileurl->offset);
+		_alpm_log(PM_LOG_DEBUG, "resuming download at position %jd\n", (intmax_t)fileurl->offset);
 	}
 
 
-- 
1.7.0.2



More information about the pacman-dev mailing list