summaryrefslogtreecommitdiff
path: root/lib/libalpm/alpm.h
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-06-01 21:47:31 -0500
committerDan McGee <dan@archlinux.org>2008-06-04 15:38:47 -0500
commit0669c9bfac7aead01f1400444e691d542f7645c2 (patch)
treef5dc76963236bd50126d7b4e570969c14e066a03 /lib/libalpm/alpm.h
parent62b4195c7680f9d404e175eb0869182efdd09ef2 (diff)
downloadpacman-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/alpm.h')
-rw-r--r--lib/libalpm/alpm.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 62a517b4..fd3be0d3 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -1,7 +1,7 @@
/*
* 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 Christian Hamar <krics@linuxforum.hu>
* Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
@@ -26,6 +26,7 @@
extern "C" {
#endif
+#include <sys/types.h> /* for off_t */
#include <time.h> /* for time_t */
#include <stdarg.h> /* for va_list */
@@ -79,7 +80,8 @@ int alpm_logaction(char *fmt, ...);
* 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
@@ -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_md5sum(pmpkg_t *pkg);
const char *alpm_pkg_get_arch(pmpkg_t *pkg);
-unsigned long alpm_pkg_get_size(pmpkg_t *pkg);
-unsigned long alpm_pkg_get_isize(pmpkg_t *pkg);
+off_t alpm_pkg_get_size(pmpkg_t *pkg);
+off_t alpm_pkg_get_isize(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_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);
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
@@ -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_filename(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