From f01c6f814a278a3d024d34fed0c219c8cb1e1e33 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 27 Jun 2011 10:10:08 -0500 Subject: Fix several -Wshadow warnings Only one of these looked like a real red flag, in find_requiredby(), but it doesn't hurt to fix several of them up anyway. Unfortunately, we can't turn this on universally due to things like the sync(), remove(), etc. builtins which we often use as variable names. Signed-off-by: Dan McGee --- src/pacman/callback.c | 10 +++++----- src/pacman/sync.c | 4 +--- src/pacman/upgrade.c | 1 - src/pacman/util.c | 2 +- src/util/pactree.c | 4 ++-- src/util/testpkg.c | 2 +- 6 files changed, 10 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 66b14cdd..ffca8bec 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -623,14 +623,14 @@ void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total) /* if padwid is < 0, we need to trim the string so padwid = 0 */ if(padwid < 0) { int i = filenamelen - 3; - wchar_t *p = wcfname; + wchar_t *wcp = wcfname; /* grab the max number of char columns we can fill */ - while(i > 0 && wcwidth(*p) < i) { - i -= wcwidth(*p); - p++; + while(i > 0 && wcwidth(*wcp) < i) { + i -= wcwidth(*wcp); + wcp++; } /* then add the ellipsis and fill out any extra padding */ - wcscpy(p, L"..."); + wcscpy(wcp, L"..."); padwid = i; } diff --git a/src/pacman/sync.c b/src/pacman/sync.c index f242c827..fa30b8da 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -443,7 +443,6 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) if(targets) { for(i = targets; i; i = alpm_list_next(i)) { - pmdb_t *db = NULL; int foundpkg = 0; char target[512]; /* TODO is this enough space? */ @@ -452,6 +451,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets) strncpy(target, i->data, 512); pkgstr = strchr(target, '/'); if(pkgstr) { + pmdb_t *db = NULL; repo = target; *pkgstr = '\0'; ++pkgstr; @@ -767,7 +767,6 @@ static int sync_trans(alpm_list_t *targets) pm_fprintf(stderr, PM_LOG_ERROR, _("failed to prepare transaction (%s)\n"), alpm_strerror(err)); switch(err) { - alpm_list_t *i; case PM_ERR_PKG_INVALID_ARCH: for(i = data; i; i = alpm_list_next(i)) { char *pkg = alpm_list_getdata(i); @@ -835,7 +834,6 @@ static int sync_trans(alpm_list_t *targets) pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerror(err)); switch(err) { - alpm_list_t *i; case PM_ERR_FILE_CONFLICTS: for(i = data; i; i = alpm_list_next(i)) { pmfileconflict_t *conflict = alpm_list_getdata(i); diff --git a/src/pacman/upgrade.c b/src/pacman/upgrade.c index 6587671b..c1f72f6d 100644 --- a/src/pacman/upgrade.c +++ b/src/pacman/upgrade.c @@ -166,7 +166,6 @@ int pacman_upgrade(alpm_list_t *targets) pm_fprintf(stderr, PM_LOG_ERROR, _("failed to commit transaction (%s)\n"), alpm_strerror(err)); switch(err) { - alpm_list_t *i; case PM_ERR_FILE_CONFLICTS: for(i = data; i; i = alpm_list_next(i)) { pmfileconflict_t *conflict = alpm_list_getdata(i); diff --git a/src/pacman/util.c b/src/pacman/util.c index 77a7e56c..75e67170 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -589,7 +589,7 @@ void list_display(const char *title, const alpm_list_t *list) printf("%s", str); cols += string_length(str); for(i = alpm_list_next(list); i; i = alpm_list_next(i)) { - const char *str = alpm_list_getdata(i); + str = alpm_list_getdata(i); int s = string_length(str); /* wrap only if we have enough usable column space */ if(maxcols > len && cols + s + 2 >= maxcols) { diff --git a/src/util/pactree.c b/src/util/pactree.c index 2f79b66d..5beaa5a7 100644 --- a/src/util/pactree.c +++ b/src/util/pactree.c @@ -120,7 +120,7 @@ static char *strtrim(char *str) return str; } -static int register_syncs(pmhandle_t *handle) { +static int register_syncs(void) { FILE *fp; char *ptr, *section = NULL; char line[LINE_MAX]; @@ -421,7 +421,7 @@ int main(int argc, char *argv[]) } if(searchsyncs) { - if(register_syncs(handle) != 0) { + if(register_syncs() != 0) { fprintf(stderr, "error: failed to register sync DBs\n"); ret = 1; goto finish; diff --git a/src/util/testpkg.c b/src/util/testpkg.c index c6f02e34..d4d058d8 100644 --- a/src/util/testpkg.c +++ b/src/util/testpkg.c @@ -60,7 +60,7 @@ int main(int argc, char *argv[]) if(alpm_pkg_load(handle, argv[1], 1, PM_PGP_VERIFY_OPTIONAL, &pkg) == -1 || pkg == NULL) { - enum _pmerrno_t err = alpm_errno(handle); + err = alpm_errno(handle); switch(err) { case PM_ERR_PKG_OPEN: printf("Cannot open the given file.\n"); -- cgit v1.2.3-70-g09d2