index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2007-05-14 03:16:55 -0400 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-05-14 03:16:55 -0400 |
commit | 2bcecbd62cb2bda681a3aba46bb0bbf690ba7219 (patch) | |
tree | cc7f9d60e04c65453527354bbd18312a9c323ed4 /src | |
parent | 5c930c318e7b80af3a322ddc7ddf9fe100e9c16b (diff) |
-rw-r--r-- | src/pacman/callback.c | 14 | ||||
-rw-r--r-- | src/pacman/package.c | 6 | ||||
-rw-r--r-- | src/pacman/util.c | 2 |
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index be209b44..5f391306 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -442,7 +442,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent, } /* convert above strings to wide chars */ oprlen = strlen(opr); - wcopr = (wchar_t*)calloc(oprlen, sizeof(wchar_t)); + wcopr = calloc(oprlen, sizeof(wchar_t)); if(!wcopr) { fprintf(stderr, "malloc failure: could not allocate %d bytes\n", strlen(opr) * sizeof(wchar_t)); @@ -519,10 +519,10 @@ void cb_dl_progress(const char *filename, int xfered, int total) diff_sec = current_time.tv_sec - initial_time.tv_sec; diff_usec = current_time.tv_usec - initial_time.tv_usec; timediff = diff_sec + (diff_usec / 1000000.0); - rate = (float)total / (timediff * 1024.0); + rate = total / (timediff * 1024.0); /* round elapsed time to the nearest second */ - eta_s = (int)floorf(timediff + 0.5); + eta_s = floorf(timediff + 0.5); } else { /* compute current average values */ timediff = get_update_timediff(0); @@ -531,10 +531,10 @@ void cb_dl_progress(const char *filename, int xfered, int total) /* return if the calling interval was too short */ return; } - rate = (float)(xfered - xfered_last) / (timediff * 1024.0); + rate = (xfered - xfered_last) / (timediff * 1024.0); /* average rate to reduce jumpiness */ - rate = (float)(rate + 2*rate_last) / 3; - eta_s = (unsigned int)(total - xfered) / (rate * 1024.0); + rate = (rate + 2*rate_last) / 3; + eta_s = (total - xfered) / (rate * 1024.0); rate_last = rate; xfered_last = xfered; } @@ -570,7 +570,7 @@ void cb_dl_progress(const char *filename, int xfered, int total) } } - f_xfered = (float) xfered / 1024.0; /* convert to K by default */ + f_xfered = xfered / 1024.0; /* convert to K by default */ /* xfered_size = 'K'; was set above */ if(f_xfered > 2048.0) { f_xfered /= 1024.0; diff --git a/src/pacman/package.c b/src/pacman/package.c index 03c2d88c..c91384d9 100644 --- a/src/pacman/package.c +++ b/src/pacman/package.c @@ -111,15 +111,15 @@ void dump_pkg_full(pmpkg_t *pkg, int level) */ void dump_pkg_sync(pmpkg_t *pkg, const char *treename) { - char *descheader, *md5sum, *sha1sum; + const char *descheader, *md5sum, *sha1sum; if(pkg == NULL) { return; } descheader = _("Description : "); - md5sum = (char *)alpm_pkg_get_md5sum(pkg); - sha1sum = (char *)alpm_pkg_get_sha1sum(pkg); + md5sum = alpm_pkg_get_md5sum(pkg); + sha1sum = alpm_pkg_get_sha1sum(pkg); printf(_("Repository : %s\n"), treename); printf(_("Name : %s\n"), (char *)alpm_pkg_get_name(pkg)); diff --git a/src/pacman/util.c b/src/pacman/util.c index 0057a85b..f38be60c 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -216,7 +216,7 @@ char *strtrim(char *str) memmove(str, pch, (strlen(pch) + 1)); } - pch = (char *)(str + (strlen(str) - 1)); + pch = (str + (strlen(str) - 1)); while(isspace(*pch)) { pch--; } |