diff options
author | Michael Vogt <mvo@ubuntu.com> | 2014-05-05 16:03:03 +0200 |
---|---|---|
committer | Michael Vogt <mvo@ubuntu.com> | 2014-05-05 16:03:03 +0200 |
commit | 98c934f2723d63d00908803ad47ab1359081ec2d (patch) | |
tree | df7c21f028089b99d63289d784ee5bd23d54d380 /apt-pkg/contrib/fileutl.cc | |
parent | a298a1dc595c548e6c10b48b8e69d987e5be1c42 (diff) | |
parent | a11f6c973bc0dc226d8953e3edb6333d526c3143 (diff) |
Merge remote-tracking branch 'upstream/debian/sid' into debian/sid
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r-- | apt-pkg/contrib/fileutl.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc index de73a7fd8..b77c7ff7f 100644 --- a/apt-pkg/contrib/fileutl.cc +++ b/apt-pkg/contrib/fileutl.cc @@ -58,13 +58,10 @@ #include <bzlib.h> #endif #ifdef HAVE_LZMA - #include <stdint.h> #include <lzma.h> #endif - -#ifdef WORDS_BIGENDIAN -#include <inttypes.h> -#endif +#include <endian.h> +#include <stdint.h> #include <apti18n.h> /*}}}*/ @@ -1880,19 +1877,13 @@ unsigned long long FileFd::Size() FileFdErrno("lseek","Unable to seek to end of gzipped file"); return 0; } - size = 0; + uint32_t size = 0; if (read(iFd, &size, 4) != 4) { FileFdErrno("read","Unable to read original size of gzipped file"); return 0; } - -#ifdef WORDS_BIGENDIAN - uint32_t tmp_size = size; - uint8_t const * const p = (uint8_t const * const) &tmp_size; - tmp_size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]; - size = tmp_size; -#endif + size = le32toh(size); if (lseek(iFd, oldPos, SEEK_SET) < 0) { |