From 053a0212931c83393e2a9410695a9e30d832da44 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Thu, 1 Mar 2012 21:48:09 +0100 Subject: [PATCH] zip-writer.c: Fix incorrect big-endian handling. --- src/libpspp/zip-writer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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); } -- 2.30.2