X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fzip-writer.c;h=e286a7eb1c5f281ddc739d88ab9c3a33e57c512b;hb=fce028c380d496e42823fd24774e0159ed7cc110;hp=e93ec887e8be952e08a3db28cd79c4b139ec8249;hpb=32ee0e0402d6d56674f53a47d879ec5c07dabe09;p=pspp diff --git a/src/libpspp/zip-writer.c b/src/libpspp/zip-writer.c index e93ec887e8..e286a7eb1c 100644 --- a/src/libpspp/zip-writer.c +++ b/src/libpspp/zip-writer.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2010 Free Software Foundation, Inc. + Copyright (C) 2010, 2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -19,17 +19,17 @@ #include "libpspp/zip-writer.h" #include "libpspp/zip-private.h" +#include #include #include #include -#include "libpspp/integer-format.h" - #include "gl/crc.h" -#include "gl/error.h" #include "gl/fwriteerror.h" #include "gl/xalloc.h" +#include "libpspp/message.h" + #include "gettext.h" #define _(msgid) gettext (msgid) @@ -63,16 +63,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); } @@ -89,7 +91,7 @@ zip_writer_create (const char *file_name) file = fopen (file_name, "wb"); if (file == NULL) { - error (0, errno, _("%s: error opening output file"), file_name); + msg_error (errno, _("%s: error opening output file"), file_name); return NULL; } @@ -222,7 +224,7 @@ zip_writer_close (struct zip_writer *zw) ok = true; else { - error (0, errno, _("%s: write failed"), zw->file_name); + msg_error (errno, _("%s: write failed"), zw->file_name); ok = false; }