Parse > 2GiB file sizes correctly
commit234b6ffc2c39268d1efdc414e02bc4b352e5d931
authorDan McGee <dan@archlinux.org>
Mon, 29 Aug 2011 17:12:54 +0000 (29 12:12 -0500)
committerDan McGee <dan@archlinux.org>
Tue, 30 Aug 2011 00:57:05 +0000 (29 19:57 -0500)
treef01da20df830137e3954631e93a5ce698b310109
parentd74dad79b7770725090e1eb2a015cbd6f88aed66
Parse > 2GiB file sizes correctly

We were using atol(), which on 32 bit, cannot handle values greater than
2GiB, which is fail.

Switch to a strtoull() wrapper function tailored toward parsing off_t
values. This allows parsing of very large positive integer values. off_t
is a signed type, but in our usages, we never parse or have a need for
negative values, so the function will return -1 on error.

Before:
    $ pacman -Si flightgear-data | grep Size
    Download Size  : 2097152.00 K
    Installed Size : 2097152.00 K

After:
    $ ./src/pacman/pacman -Si flightgear-data | grep Size
    Download Size  : 2312592.52 KiB
    Installed Size : 5402896.00 KiB

Signed-off-by: Dan McGee <dan@archlinux.org>
lib/libalpm/be_local.c
lib/libalpm/be_package.c
lib/libalpm/be_sync.c
lib/libalpm/delta.c
lib/libalpm/util.c
lib/libalpm/util.h