summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/contrib')
-rw-r--r--apt-pkg/contrib/fileutl.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 6a621e2a9..24e3f08d9 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -42,6 +42,10 @@
#include <errno.h>
#include <set>
#include <algorithm>
+
+#ifndef WORDS_BIGENDIAN
+#include <inttypes.h>
+#endif
/*}}}*/
using namespace std;
@@ -967,8 +971,10 @@ unsigned long FileFd::Size()
return _error->Errno("read","Unable to read original size of gzipped file");
#ifdef WORDS_BIGENDIAN
- unsigned char const * const p = (unsigned char *) &size;
- size = (p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0];
+ 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
if (lseek(iFd, orig_pos, SEEK_SET) < 0)