From 1aa1d00248ac89fb02e762b96c58559a04679b2e Mon Sep 17 00:00:00 2001 From: Xavier Chantry Date: Sat, 5 Dec 2009 01:50:09 +0100 Subject: fix a few warnings reported by clang - remove unused variables - some more sanity checks - safer printf Signed-off-by: Xavier Chantry Signed-off-by: Dan McGee --- src/pacman/callback.c | 4 +++- src/pacman/pacman.c | 2 +- src/pacman/util.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pacman/callback.c b/src/pacman/callback.c index d2d94d9b..b021d9db 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -371,6 +371,8 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, case PM_TRANS_PROGRESS_CONFLICTS_START: opr = _("checking for file conflicts"); break; + default: + return; } /* find # of digits in package counts to scale output */ @@ -517,7 +519,7 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) gettimeofday(&initial_time, NULL); xfered_last = (off_t)0; rate_last = 0.0; - timediff = get_update_timediff(1); + get_update_timediff(1); } } else if(file_xfered == file_total) { /* compute final values */ diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index d4385ebc..4559f8c6 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -219,7 +219,7 @@ static void setarch(const char *arch) static void cleanup(int ret) { /* free alpm library resources */ if(alpm_release() == -1) { - pm_printf(PM_LOG_ERROR, alpm_strerrorlast()); + pm_printf(PM_LOG_ERROR, "%s\n", alpm_strerrorlast()); } /* free memory */ diff --git a/src/pacman/util.c b/src/pacman/util.c index fb6f5219..e421e9d5 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -229,7 +229,7 @@ void indentprint(const char *str, int indent) p = wcstr; cidx = indent; - if(!p) { + if(!p || !len) { return; } -- cgit v1.2.3-24-g4f1b