aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2016-10-18 03:40:50 +0200
committerThierry Vignaud <thierry.vignaud@gmail.com>2016-10-18 17:58:46 +0200
commit64e3770177e8368a555654dee602d26b4c1afdbe (patch)
tree7ee6c4090d9de68bb57fdf3c4f5e808195ac5d59
parent12ff33c3fbf1dfc2dce60f6a75bb546ca3bf6735 (diff)
downloadperl-URPM-64e3770177e8368a555654dee602d26b4c1afdbe.tar
perl-URPM-64e3770177e8368a555654dee602d26b4c1afdbe.tar.gz
perl-URPM-64e3770177e8368a555654dee602d26b4c1afdbe.tar.bz2
perl-URPM-64e3770177e8368a555654dee602d26b4c1afdbe.tar.xz
perl-URPM-64e3770177e8368a555654dee602d26b4c1afdbe.zip
switch to uint64_t for sizes (mga#19571)
Thus we use 64bit for package size on 32bit too, thanks to Math::Int64
-rw-r--r--NEWS2
-rw-r--r--URPM.xs18
2 files changed, 11 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index b29e41a..6513b5b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- use 64bit for package size on 32bit too (mga#19571)
+
Version 5.09 - 16 October 2016
- don't crash if /etc/urpmi/skip.list RE is wrong (mga#15353)
diff --git a/URPM.xs b/URPM.xs
index 8602dc9..0800993 100644
--- a/URPM.xs
+++ b/URPM.xs
@@ -50,7 +50,7 @@ typedef struct rpmSpec_s * Spec;
struct s_Package {
Header h;
- int filesize;
+ uint64_t filesize;
unsigned flag;
char *info;
char *requires;
@@ -213,7 +213,7 @@ get_int(const Header header, rpmTag tag) {
return rpmtdGetNumber(&val);
}
-static size_t
+static uint64_t
get_filesize(const Header h) {
return headerGetNumber(h, RPMTAG_SIGSIZE) + 440; /* 440 is the rpm header size (?) empirical, but works */
}
@@ -1051,7 +1051,7 @@ parse_line(AV *depslist, HV *provides, HV *obsoletes, URPM__Package pkg, char *b
// reset package, next line will be for another one
memset(pkg, 0, sizeof(struct s_Package));
} else if (!strcmp(tag, "filesize"))
- pkg->filesize = atoi(data);
+ pkg->filesize = atoll(data);
else {
char **ptr = NULL;
if (!strcmp(tag, "requires"))
@@ -1755,7 +1755,7 @@ Pkg_compare(pkg, evr)
OUTPUT:
RETVAL
-int
+uint64_t
Pkg_size(pkg)
URPM::Package pkg
CODE:
@@ -1765,7 +1765,7 @@ Pkg_size(pkg)
if ((s = strchr(pkg->info, '@')) != NULL && (s = strchr(s+1, '@')) != NULL) {
if ((eos = strchr(s+1, '@')) != NULL)
*eos = 0; /* mark end of string to enable searching backwards */
- RETVAL = atoi(s+1);
+ RETVAL = atoll(s+1);
if (eos != NULL) *eos = '@';
} else
RETVAL = 0;
@@ -1779,11 +1779,11 @@ Pkg_size(pkg)
void
Pkg_set_filesize(pkg, filesize)
URPM::Package pkg
- size_t filesize;
+ uint64_t filesize;
PPCODE:
pkg->filesize = filesize;
-int
+uint64_t
Pkg_filesize(pkg)
URPM::Package pkg
CODE:
@@ -2091,7 +2091,7 @@ Pkg_build_info(pkg, fileno, provides_files=NULL, recommends=0)
CODE:
if (pkg->info) {
char buff[65536*2];
- size_t size;
+ uint64_t size;
/* info line should be the last to be written */
if (pkg->provides && *pkg->provides) {
@@ -2125,7 +2125,7 @@ Pkg_build_info(pkg, fileno, provides_files=NULL, recommends=0)
if (size < sizeof(buff)) write_nocheck(fileno, buff, size);
}
if (pkg->filesize) {
- size = snprintf(buff, sizeof(buff), "@filesize@%d\n", pkg->filesize);
+ size = snprintf(buff, sizeof(buff), "@filesize@%llu\n", pkg->filesize);
if (size < sizeof(buff)) write_nocheck(fileno, buff, size);
}
size = snprintf(buff, sizeof(buff), "@info@%s\n", pkg->info);