diff options
author | Dan McGee <dan@archlinux.org> | 2008-06-02 04:47:31 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2008-06-04 22:38:47 +0200 |
commit | 0669c9bfac7aead01f1400444e691d542f7645c2 (patch) | |
tree | f5dc76963236bd50126d7b4e570969c14e066a03 /lib/libalpm/dload.c | |
parent | 62b4195c7680f9d404e175eb0869182efdd09ef2 (diff) | |
download | pacman-0669c9bfac7aead01f1400444e691d542f7645c2.tar.gz pacman-0669c9bfac7aead01f1400444e691d542f7645c2.tar.xz |
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>
Diffstat (limited to 'lib/libalpm/dload.c')
-rw-r--r-- | lib/libalpm/dload.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 44acec70..b5f0b876 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -112,7 +112,7 @@ static int download_internal(const char *url, const char *localpath, struct url_stat ust; struct stat st; int chk_resume = 0; - int dl_thisfile = 0; + size_t dl_thisfile = 0; char *tempfile, *destfile, *filename; int ret = 0; 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); } - int nread = 0; + size_t nread = 0; char buffer[PM_DLBUF_LEN]; while((nread = fread(buffer, 1, PM_DLBUF_LEN, dlf)) > 0) { if(ferror(dlf)) { @@ -211,7 +211,7 @@ static int download_internal(const char *url, const char *localpath, goto cleanup; } - int nwritten = 0; + size_t nwritten = 0; while(nwritten < nread) { nwritten += fwrite(buffer, 1, (nread - nwritten), localf); if(ferror(localf)) { |