From: John Darrington Date: Thu, 1 Mar 2012 20:48:09 +0000 (+0100) Subject: zip-writer.c: Fix incorrect big-endian handling. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=053a0212931c83393e2a9410695a9e30d832da44;p=pspp zip-writer.c: Fix incorrect big-endian handling. --- diff --git a/src/libpspp/zip-writer.c b/src/libpspp/zip-writer.c index e93ec887e8..01c11d77c0 100644 --- a/src/libpspp/zip-writer.c +++ b/src/libpspp/zip-writer.c @@ -23,8 +23,6 @@ #include #include -#include "libpspp/integer-format.h" - #include "gl/crc.h" #include "gl/error.h" #include "gl/fwriteerror.h" @@ -63,16 +61,18 @@ put_bytes (struct zip_writer *zw, const void *p, size_t n) static void put_u16 (struct zip_writer *zw, uint16_t x) { - if (INTEGER_NATIVE != INTEGER_LSB_FIRST) - integer_convert (INTEGER_NATIVE, &x, INTEGER_MSB_FIRST, &x, sizeof x); +#ifdef WORDS_BIGENDIAN + x = bswap_16 (x); +#endif put_bytes (zw, &x, sizeof x); } static void put_u32 (struct zip_writer *zw, uint32_t x) { - if (INTEGER_NATIVE != INTEGER_LSB_FIRST) - integer_convert (INTEGER_NATIVE, &x, INTEGER_MSB_FIRST, &x, sizeof x); +#ifdef WORDS_BIGENDIAN + x = bswap_32 (x); +#endif put_bytes (zw, &x, sizeof x); }