From 0669c9bfac7aead01f1400444e691d542f7645c2 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 1 Jun 2008 21:47:31 -0500 Subject: 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 --- lib/libalpm/be_files.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/be_files.c') diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c index 2302374d..dc644cea 100644 --- a/lib/libalpm/be_files.c +++ b/lib/libalpm/be_files.c @@ -25,7 +25,7 @@ #include #include #include -#include /* uintmax_t */ +#include /* uintmax_t, intmax_t */ #include #include #include @@ -710,10 +710,10 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) fprintf(fp, "%%PACKAGER%%\n" "%s\n\n", info->packager); } - if(info->size) { + if(info->isize) { /* only write installed size, csize is irrelevant once installed */ fprintf(fp, "%%SIZE%%\n" - "%lu\n\n", info->isize); + "%ju\n\n", (intmax_t)info->isize); } if(info->reason) { fprintf(fp, "%%REASON%%\n" @@ -722,11 +722,11 @@ int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) } else { if(info->size) { fprintf(fp, "%%CSIZE%%\n" - "%lu\n\n", info->size); + "%ju\n\n", (intmax_t)info->size); } if(info->isize) { fprintf(fp, "%%ISIZE%%\n" - "%lu\n\n", info->isize); + "%ju\n\n", (intmax_t)info->isize); } if(info->md5sum) { fprintf(fp, "%%MD5SUM%%\n" -- cgit v1.2.3-54-g00ecf