Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/delta.c
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/delta.c
parent62b4195c7680f9d404e175eb0869182efdd09ef2 (diff)
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/delta.c')
-rw-r--r--lib/libalpm/delta.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index fdb4d99b..22d9beb4 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -71,7 +71,7 @@ const char SYMEXPORT *alpm_delta_get_md5sum(pmdelta_t *delta)
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));
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();
pmdelta_t *vdelta = i->data;
vdelta->download_size = vdelta->delta_size;
- v->weight = ULONG_MAX;
+ v->weight = LONG_MAX;
/* determine whether the delta file already exists */
fpath = _alpm_filecache_find(vdelta->delta);
@@ -139,7 +139,7 @@ static alpm_list_t *delta_graph_init(alpm_list_t *deltas)
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) {
alpm_list_t *i;
pmgraph_t *v;
@@ -157,7 +157,7 @@ static unsigned long delta_vert(alpm_list_t *vertices,
v = v_i;
}
}
- if(v == NULL || v->weight == ULONG_MAX) {
+ if(v == NULL || v->weight == LONG_MAX) {
break;
}
@@ -178,7 +178,7 @@ static unsigned long delta_vert(alpm_list_t *vertices,
}
v = NULL;
- unsigned long bestsize = 0;
+ off_t bestsize = 0;
for(i = vertices; i; i = i->next) {
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
* have the smallest size are placed. NULL is set if there is no path
* 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)
{
alpm_list_t *bestpath = NULL;
alpm_list_t *vertices;
- unsigned long bestsize = ULONG_MAX;
+ off_t bestsize = LONG_MAX;
ALPM_LOG_FUNC;