[pacman-dev] [PATCH] Do not compare signed and unsigned types

Allan McRae allan at archlinux.org
Mon Jun 28 09:48:09 EDT 2010


The casting of nread is safe as it is tested to be >0 when it is
initally assigned.  It is also being implicitly case in the fwrite
call in the line above.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 lib/libalpm/dload.c |    2 +-
 src/pacman/pacman.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index c11148d..3185d2a 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -251,7 +251,7 @@ static int download_internal(const char *url, const char *localpath,
 		check_stop();
 		size_t nwritten = 0;
 		nwritten = fwrite(buffer, 1, nread, localf);
-		if((nwritten != nread) || ferror(localf)) {
+		if((nwritten != (size_t)nread) || ferror(localf)) {
 			pm_errno = PM_ERR_RETRIEVE;
 			_alpm_log(PM_LOG_ERROR, _("error writing to file '%s': %s\n"),
 					tempfile, strerror(errno));
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index ecc37c9..60f2e5e 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -1002,7 +1002,7 @@ static int _parseconfig(const char *file, const char *givensection,
 							file, linenum, value);
 				break;
 				default:
-					for(int gindex = 0; gindex < globbuf.gl_pathc; gindex++) {
+					for(size_t gindex = 0; gindex < globbuf.gl_pathc; gindex++) {
 						pm_printf(PM_LOG_DEBUG, "config file %s, line %d: including %s\n",
 								file, linenum, globbuf.gl_pathv[gindex]);
 						_parseconfig(globbuf.gl_pathv[gindex], section, db);
-- 
1.7.1



More information about the pacman-dev mailing list