1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-12-22 15:58:50 -05:00

Use correct C type for file sizes

We have been using unsigned long as a file size type for a while, which
works but isn't quite correct and could easily break. Worse was probably our
use of int in the download callback functions, which could be restrictive
for packages > 2GB in size.

Switch all file size variables to use off_t, which is the preferred type for
file sizes. Note that at least on Linux, all applications compiled against
libalpm must now be sure to use large file support, where _FILE_OFFSET_BITS
is defined to be 64 or there will be some weird issues that crop up.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-06-01 21:47:31 -05:00
parent 62b4195c76
commit 0669c9bfac
14 changed files with 66 additions and 50 deletions

View File

@ -27,6 +27,8 @@
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#include <inttypes.h> /* int64_t */
#include <stdint.h> /* intmax_t */
/* libarchive */ /* libarchive */
#include <archive.h> #include <archive.h>
@ -635,7 +637,6 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
int i, ret = 0, errors = 0; int i, ret = 0, errors = 0;
char scriptlet[PATH_MAX+1]; char scriptlet[PATH_MAX+1];
int is_upgrade = 0; int is_upgrade = 0;
double percent = 0.0;
pmpkg_t *oldpkg = NULL; pmpkg_t *oldpkg = NULL;
ALPM_LOG_FUNC; ALPM_LOG_FUNC;
@ -730,17 +731,22 @@ static int commit_single_pkg(pmpkg_t *newpkg, int pkg_current, int pkg_count,
} }
for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) { for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
double percent;
if(newpkg->size != 0) { if(newpkg->size != 0) {
/* Using compressed size for calculations here, as newpkg->isize is not /* Using compressed size for calculations here, as newpkg->isize is not
* exact when it comes to comparing to the ACTUAL uncompressed size * exact when it comes to comparing to the ACTUAL uncompressed size
* (missing metadata sizes) */ * (missing metadata sizes) */
unsigned long pos = archive_position_compressed(archive); int64_t pos = archive_position_compressed(archive);
percent = (double)pos / (double)newpkg->size; percent = (double)pos / (double)newpkg->size;
_alpm_log(PM_LOG_DEBUG, "decompression progress: %f%% (%ld / %ld)\n", _alpm_log(PM_LOG_DEBUG, "decompression progress: "
percent*100.0, pos, newpkg->size); "%f%% (%"PRId64" / %jd)\n",
percent*100.0, pos, (intmax_t)newpkg->size);
if(percent >= 1.0) { if(percent >= 1.0) {
percent = 1.0; percent = 1.0;
} }
} else {
percent = 0.0;
} }
if(is_upgrade) { if(is_upgrade) {

View File

@ -1,7 +1,7 @@
/* /*
* alpm.h * alpm.h
* *
* Copyright (c) 2002-2007 by Judd Vinet <jvinet@zeroflux.org> * Copyright (c) 2002-2008 by Judd Vinet <jvinet@zeroflux.org>
* Copyright (c) 2005 by Aurelien Foret <orelien@chez.com> * Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
* Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu> * Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org> * Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
@ -26,6 +26,7 @@
extern "C" { extern "C" {
#endif #endif
#include <sys/types.h> /* for off_t */
#include <time.h> /* for time_t */ #include <time.h> /* for time_t */
#include <stdarg.h> /* for va_list */ #include <stdarg.h> /* for va_list */
@ -79,7 +80,8 @@ int alpm_logaction(char *fmt, ...);
* Downloading * Downloading
*/ */
typedef void (*alpm_cb_download)(const char *filename, int xfered, int total); typedef void (*alpm_cb_download)(const char *filename,
off_t xfered, off_t total);
/* /*
* Options * Options
@ -201,8 +203,8 @@ time_t alpm_pkg_get_installdate(pmpkg_t *pkg);
const char *alpm_pkg_get_packager(pmpkg_t *pkg); const char *alpm_pkg_get_packager(pmpkg_t *pkg);
const char *alpm_pkg_get_md5sum(pmpkg_t *pkg); const char *alpm_pkg_get_md5sum(pmpkg_t *pkg);
const char *alpm_pkg_get_arch(pmpkg_t *pkg); const char *alpm_pkg_get_arch(pmpkg_t *pkg);
unsigned long alpm_pkg_get_size(pmpkg_t *pkg); off_t alpm_pkg_get_size(pmpkg_t *pkg);
unsigned long alpm_pkg_get_isize(pmpkg_t *pkg); off_t alpm_pkg_get_isize(pmpkg_t *pkg);
pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg); pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg);
alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg);
@ -221,7 +223,7 @@ size_t alpm_pkg_changelog_read(void *ptr, size_t size,
int alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp); int alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp);
unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg); unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg);
unsigned long alpm_pkg_download_size(pmpkg_t *newpkg); off_t alpm_pkg_download_size(pmpkg_t *newpkg);
/* /*
* Deltas * Deltas
@ -233,7 +235,7 @@ const char *alpm_delta_get_to(pmdelta_t *delta);
const char *alpm_delta_get_to_md5sum(pmdelta_t *delta); const char *alpm_delta_get_to_md5sum(pmdelta_t *delta);
const char *alpm_delta_get_filename(pmdelta_t *delta); const char *alpm_delta_get_filename(pmdelta_t *delta);
const char *alpm_delta_get_md5sum(pmdelta_t *delta); const char *alpm_delta_get_md5sum(pmdelta_t *delta);
unsigned long alpm_delta_get_size(pmdelta_t *delta); off_t alpm_delta_get_size(pmdelta_t *delta);
/* /*
* Groups * Groups

View File

@ -25,7 +25,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdint.h> /* uintmax_t */ #include <stdint.h> /* uintmax_t, intmax_t */
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <ctype.h> #include <ctype.h>
@ -710,10 +710,10 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
fprintf(fp, "%%PACKAGER%%\n" fprintf(fp, "%%PACKAGER%%\n"
"%s\n\n", info->packager); "%s\n\n", info->packager);
} }
if(info->size) { if(info->isize) {
/* only write installed size, csize is irrelevant once installed */ /* only write installed size, csize is irrelevant once installed */
fprintf(fp, "%%SIZE%%\n" fprintf(fp, "%%SIZE%%\n"
"%lu\n\n", info->isize); "%ju\n\n", (intmax_t)info->isize);
} }
if(info->reason) { if(info->reason) {
fprintf(fp, "%%REASON%%\n" fprintf(fp, "%%REASON%%\n"
@ -722,11 +722,11 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
} else { } else {
if(info->size) { if(info->size) {
fprintf(fp, "%%CSIZE%%\n" fprintf(fp, "%%CSIZE%%\n"
"%lu\n\n", info->size); "%ju\n\n", (intmax_t)info->size);
} }
if(info->isize) { if(info->isize) {
fprintf(fp, "%%ISIZE%%\n" fprintf(fp, "%%ISIZE%%\n"
"%lu\n\n", info->isize); "%ju\n\n", (intmax_t)info->isize);
} }
if(info->md5sum) { if(info->md5sum) {
fprintf(fp, "%%MD5SUM%%\n" fprintf(fp, "%%MD5SUM%%\n"

View File

@ -28,7 +28,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <string.h> #include <string.h>
#include <stdint.h> /* uintmax_t */
#include <sys/stat.h> #include <sys/stat.h>
#include <dirent.h> #include <dirent.h>
#include <regex.h> #include <regex.h>

View File

@ -71,7 +71,7 @@ const char SYMEXPORT *alpm_delta_get_md5sum(pmdelta_t *delta)
return(delta->delta_md5); return(delta->delta_md5);
} }
unsigned long SYMEXPORT alpm_delta_get_size(pmdelta_t *delta) off_t SYMEXPORT alpm_delta_get_size(pmdelta_t *delta)
{ {
ASSERT(delta != NULL, return(-1)); ASSERT(delta != NULL, return(-1));
return(delta->delta_size); return(delta->delta_size);
@ -89,7 +89,7 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
pmgraph_t *v = _alpm_graph_new(); pmgraph_t *v = _alpm_graph_new();
pmdelta_t *vdelta = i->data; pmdelta_t *vdelta = i->data;
vdelta->download_size = vdelta->delta_size; vdelta->download_size = vdelta->delta_size;
v->weight = ULONG_MAX; v->weight = LONG_MAX;
/* determine whether the delta file already exists */ /* determine whether the delta file already exists */
fpath = _alpm_filecache_find(vdelta->delta); fpath = _alpm_filecache_find(vdelta->delta);
@ -139,7 +139,7 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
return(vertices); return(vertices);
} }
static unsigned long delta_vert(alpm_list_t *vertices, static off_t delta_vert(alpm_list_t *vertices,
const char *to, const char *to_md5, alpm_list_t **path) { const char *to, const char *to_md5, alpm_list_t **path) {
alpm_list_t *i; alpm_list_t *i;
pmgraph_t *v; pmgraph_t *v;
@ -157,7 +157,7 @@ static unsigned long delta_vert(alpm_list_t *vertices,
v = v_i; v = v_i;
} }
} }
if(v == NULL || v->weight == ULONG_MAX) { if(v == NULL || v->weight == LONG_MAX) {
break; break;
} }
@ -178,7 +178,7 @@ static unsigned long delta_vert(alpm_list_t *vertices,
} }
v = NULL; v = NULL;
unsigned long bestsize = 0; off_t bestsize = 0;
for(i = vertices; i; i = i->next) { for(i = vertices; i; i = i->next) {
pmgraph_t *v_i = i->data; pmgraph_t *v_i = i->data;
@ -214,14 +214,14 @@ static unsigned long delta_vert(alpm_list_t *vertices,
* @param path the pointer to a list location where pmdelta_t * objects that * @param path the pointer to a list location where pmdelta_t * objects that
* have the smallest size are placed. NULL is set if there is no path * have the smallest size are placed. NULL is set if there is no path
* possible with the files available. * possible with the files available.
* @return the size of the path stored, or ULONG_MAX if path is unfindable * @return the size of the path stored, or LONG_MAX if path is unfindable
*/ */
unsigned long _alpm_shortest_delta_path(alpm_list_t *deltas, off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
const char *to, const char *to_md5, alpm_list_t **path) const char *to, const char *to_md5, alpm_list_t **path)
{ {
alpm_list_t *bestpath = NULL; alpm_list_t *bestpath = NULL;
alpm_list_t *vertices; alpm_list_t *vertices;
unsigned long bestsize = ULONG_MAX; off_t bestsize = LONG_MAX;
ALPM_LOG_FUNC; ALPM_LOG_FUNC;

View File

@ -19,6 +19,8 @@
#ifndef _ALPM_DELTA_H #ifndef _ALPM_DELTA_H
#define _ALPM_DELTA_H #define _ALPM_DELTA_H
#include <sys/types.h> /* off_t */
#include "alpm.h" #include "alpm.h"
struct __pmdelta_t { struct __pmdelta_t {
@ -35,14 +37,14 @@ struct __pmdelta_t {
/** md5sum of the delta file */ /** md5sum of the delta file */
char *delta_md5; char *delta_md5;
/** filesize of the delta file */ /** filesize of the delta file */
unsigned long delta_size; off_t delta_size;
/** download filesize of the delta file */ /** download filesize of the delta file */
unsigned long download_size; off_t download_size;
}; };
pmdelta_t *_alpm_delta_parse(char *line); pmdelta_t *_alpm_delta_parse(char *line);
void _alpm_delta_free(pmdelta_t *delta); void _alpm_delta_free(pmdelta_t *delta);
unsigned long _alpm_shortest_delta_path(alpm_list_t *deltas, off_t _alpm_shortest_delta_path(alpm_list_t *deltas,
const char *to, const char *to_md5, alpm_list_t **path); const char *to, const char *to_md5, alpm_list_t **path);
#endif /* _ALPM_DELTA_H */ #endif /* _ALPM_DELTA_H */

View File

@ -112,7 +112,7 @@ static int download_internal(const char *url, const char *localpath,
struct url_stat ust; struct url_stat ust;
struct stat st; struct stat st;
int chk_resume = 0; int chk_resume = 0;
int dl_thisfile = 0; size_t dl_thisfile = 0;
char *tempfile, *destfile, *filename; char *tempfile, *destfile, *filename;
int ret = 0; int ret = 0;
struct url *fileurl = url_for_string(url); struct url *fileurl = url_for_string(url);
@ -200,7 +200,7 @@ static int download_internal(const char *url, const char *localpath,
handle->dlcb(filename, 0, ust.size); handle->dlcb(filename, 0, ust.size);
} }
int nread = 0; size_t nread = 0;
char buffer[PM_DLBUF_LEN]; char buffer[PM_DLBUF_LEN];
while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) { while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) {
if(ferror(dlf)) { if(ferror(dlf)) {
@ -211,7 +211,7 @@ static int download_internal(const char *url, const char *localpath,
goto cleanup; goto cleanup;
} }
int nwritten = 0; size_t nwritten = 0;
while(nwritten < nread) { while(nwritten < nread) {
nwritten += fwrite(buffer, 1, (nread - nwritten), localf); nwritten += fwrite(buffer, 1, (nread - nwritten), localf);
if(ferror(localf)) { if(ferror(localf)) {

View File

@ -17,6 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <sys/types.h> /* off_t */
#include "alpm_list.h" #include "alpm_list.h"
#include "util.h" /* MALLOC() */ #include "util.h" /* MALLOC() */
#include "alpm.h" #include "alpm.h"
@ -24,7 +26,7 @@
struct __pmgraph_t { struct __pmgraph_t {
char state; /* 0: untouched, -1: entered, other: leaving time */ char state; /* 0: untouched, -1: entered, other: leaving time */
void *data; void *data;
unsigned long int weight; /* weight of the node */ off_t weight; /* weight of the node */
struct __pmgraph_t *parent; /* where did we come from? */ struct __pmgraph_t *parent; /* where did we come from? */
alpm_list_t *children; alpm_list_t *children;
alpm_list_t *childptr; /* points to a child in children list */ alpm_list_t *childptr; /* points to a child in children list */

View File

@ -225,7 +225,7 @@ const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg)
return pkg->arch; return pkg->arch;
} }
unsigned long SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg) off_t SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg)
{ {
ALPM_LOG_FUNC; ALPM_LOG_FUNC;
@ -239,7 +239,7 @@ unsigned long SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg)
return pkg->size; return pkg->size;
} }
unsigned long SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg) off_t SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg)
{ {
ALPM_LOG_FUNC; ALPM_LOG_FUNC;

View File

@ -23,7 +23,8 @@
#ifndef _ALPM_PACKAGE_H #ifndef _ALPM_PACKAGE_H
#define _ALPM_PACKAGE_H #define _ALPM_PACKAGE_H
#include <time.h> #include <sys/types.h> /* off_t */
#include <time.h> /* time_t */
#include "alpm.h" #include "alpm.h"
#include "db.h" #include "db.h"
@ -44,8 +45,9 @@ struct __pmpkg_t {
char *packager; char *packager;
char *md5sum; char *md5sum;
char *arch; char *arch;
unsigned long size; off_t size;
unsigned long isize; off_t isize;
off_t download_size;
unsigned short scriptlet; unsigned short scriptlet;
unsigned short force; unsigned short force;
pmpkgreason_t reason; pmpkgreason_t reason;
@ -59,6 +61,7 @@ struct __pmpkg_t {
alpm_list_t *conflicts; alpm_list_t *conflicts;
alpm_list_t *provides; alpm_list_t *provides;
alpm_list_t *deltas; alpm_list_t *deltas;
alpm_list_t *delta_path;
/* internal */ /* internal */
pmpkgfrom_t origin; pmpkgfrom_t origin;
/* Replaced 'void *data' with this union as follows: /* Replaced 'void *data' with this union as follows:
@ -70,8 +73,6 @@ struct __pmpkg_t {
char *file; char *file;
} origin_data; } origin_data;
pmdbinfrq_t infolevel; pmdbinfrq_t infolevel;
unsigned long download_size;
alpm_list_t *delta_path;
}; };
pmpkg_t* _alpm_pkg_new(void); pmpkg_t* _alpm_pkg_new(void);

View File

@ -22,6 +22,7 @@
#include "config.h" #include "config.h"
#include <sys/types.h> /* off_t */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <fcntl.h> #include <fcntl.h>
@ -385,7 +386,7 @@ static int compute_download_size(pmpkg_t *newpkg)
{ {
const char *fname; const char *fname;
char *fpath; char *fpath;
unsigned long size = 0; off_t size = 0;
fname = alpm_pkg_get_filename(newpkg); fname = alpm_pkg_get_filename(newpkg);
ASSERT(fname != NULL, RET_ERR(PM_ERR_PKG_INVALID_NAME, -1)); ASSERT(fname != NULL, RET_ERR(PM_ERR_PKG_INVALID_NAME, -1));
@ -395,8 +396,8 @@ static int compute_download_size(pmpkg_t *newpkg)
FREE(fpath); FREE(fpath);
size = 0; size = 0;
} else if(handle->usedelta) { } else if(handle->usedelta) {
unsigned long dltsize; off_t dltsize;
unsigned long pkgsize = alpm_pkg_get_size(newpkg); off_t pkgsize = alpm_pkg_get_size(newpkg);
dltsize = _alpm_shortest_delta_path( dltsize = _alpm_shortest_delta_path(
alpm_pkg_get_deltas(newpkg), alpm_pkg_get_deltas(newpkg),
@ -417,8 +418,8 @@ static int compute_download_size(pmpkg_t *newpkg)
size = alpm_pkg_get_size(newpkg); size = alpm_pkg_get_size(newpkg);
} }
_alpm_log(PM_LOG_DEBUG, "setting download size %ld for pkg %s\n", size, _alpm_log(PM_LOG_DEBUG, "setting download size %lld for pkg %s\n",
alpm_pkg_get_name(newpkg)); (long long)size, alpm_pkg_get_name(newpkg));
newpkg->download_size = size; newpkg->download_size = size;
return(0); return(0);
@ -670,7 +671,7 @@ cleanup:
* @param newpkg the new package to upgrade to * @param newpkg the new package to upgrade to
* @return the size of the download * @return the size of the download
*/ */
unsigned long SYMEXPORT alpm_pkg_download_size(pmpkg_t *newpkg) off_t SYMEXPORT alpm_pkg_download_size(pmpkg_t *newpkg)
{ {
return(newpkg->download_size); return(newpkg->download_size);
} }

View File

@ -23,6 +23,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> /* off_t */
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
#include <wchar.h> #include <wchar.h>
@ -36,7 +37,7 @@
/* download progress bar */ /* download progress bar */
static float rate_last; static float rate_last;
static int xfered_last; static off_t xfered_last;
static struct timeval initial_time; static struct timeval initial_time;
/* transaction progress bar */ /* transaction progress bar */
@ -410,7 +411,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent,
} }
/* callback to handle display of download progress */ /* callback to handle display of download progress */
void cb_dl_progress(const char *filename, int xfered, int total) void cb_dl_progress(const char *filename, off_t xfered, off_t total)
{ {
const int infolen = 50; const int infolen = 50;
const int filenamelen = infolen - 27; const int filenamelen = infolen - 27;
@ -428,12 +429,12 @@ void cb_dl_progress(const char *filename, int xfered, int total)
return; return;
} }
/* this is basically a switch on file_xferred: 0, file_total, and /* this is basically a switch on xfered: 0, total, and
* anything else */ * anything else */
if(xfered == 0) { if(xfered == 0) {
/* set default starting values */ /* set default starting values */
gettimeofday(&initial_time, NULL); gettimeofday(&initial_time, NULL);
xfered_last = 0; xfered_last = (off_t)0;
rate_last = 0.0; rate_last = 0.0;
timediff = get_update_timediff(1); timediff = get_update_timediff(1);
} else if(xfered == total) { } else if(xfered == total) {

View File

@ -19,6 +19,8 @@
#ifndef _PM_CALLBACK_H #ifndef _PM_CALLBACK_H
#define _PM_CALLBACK_H #define _PM_CALLBACK_H
#include <sys/types.h> /* off_t */
#include <alpm.h> #include <alpm.h>
/* callback to handle messages/notifications from libalpm transactions */ /* callback to handle messages/notifications from libalpm transactions */
@ -33,7 +35,7 @@ void cb_trans_progress(pmtransprog_t event, const char *pkgname, int percent,
int howmany, int remain); int howmany, int remain);
/* callback to handle display of download progress */ /* callback to handle display of download progress */
void cb_dl_progress(const char *filename, int file_xfered, int file_total); void cb_dl_progress(const char *filename, off_t file_xfered, off_t file_total);
/* callback to handle messages/notifications from pacman library */ /* callback to handle messages/notifications from pacman library */
void cb_log(pmloglevel_t level, char *fmt, va_list args); void cb_log(pmloglevel_t level, char *fmt, va_list args);

View File

@ -493,7 +493,7 @@ void display_targets(const alpm_list_t *syncpkgs, pmdb_t *db_local)
const alpm_list_t *i, *j; const alpm_list_t *i, *j;
alpm_list_t *targets = NULL, *to_remove = NULL; alpm_list_t *targets = NULL, *to_remove = NULL;
/* TODO these are some messy variable names */ /* TODO these are some messy variable names */
unsigned long isize = 0, rsize = 0, dispsize = 0, dlsize = 0; off_t isize = 0, rsize = 0, dispsize = 0, dlsize = 0;
double mbisize = 0.0, mbrsize = 0.0, mbdispsize = 0.0, mbdlsize = 0.0; double mbisize = 0.0, mbrsize = 0.0, mbdispsize = 0.0, mbdlsize = 0.0;
for(i = syncpkgs; i; i = alpm_list_next(i)) { for(i = syncpkgs; i; i = alpm_list_next(i)) {