From f7192b595881103f145a118d63d1b342ffd740b4 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 17 Nov 2008 21:47:55 -0600 Subject: Minor code cleanups Mostly noticed when compiling libalpm/pacman with ICC. Signed-off-by: Dan McGee --- lib/libalpm/dload.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'lib/libalpm/dload.c') diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index c07040b5..9b082943 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -111,11 +111,11 @@ static int download_internal(const char *url, const char *localpath, FILE *dlf, *localf = NULL; struct url_stat ust; struct stat st; - int chk_resume = 0; - size_t dl_thisfile = 0; + int chk_resume = 0, ret = 0; + size_t dl_thisfile = 0, nread = 0; char *tempfile, *destfile, *filename; - int ret = 0; struct url *fileurl = url_for_string(url); + char buffer[PM_DLBUF_LEN]; if(!fileurl) { return(-1); @@ -200,9 +200,8 @@ static int download_internal(const char *url, const char *localpath, handle->dlcb(filename, 0, ust.size); } - size_t nread = 0; - char buffer[PM_DLBUF_LEN]; while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) { + size_t nwritten = 0; if(ferror(dlf)) { pm_errno = PM_ERR_LIBDOWNLOAD; _alpm_log(PM_LOG_ERROR, _("error downloading '%s': %s\n"), @@ -211,7 +210,6 @@ static int download_internal(const char *url, const char *localpath, goto cleanup; } - size_t nwritten = 0; while(nwritten < nread) { nwritten += fwrite(buffer, 1, (nread - nwritten), localf); if(ferror(localf)) { -- cgit v1.2.3-24-g4f1b