/* 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
#include "libpspp/zip-writer.h"
#include "libpspp/zip-private.h"
+#include <byteswap.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
-#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)
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);
}
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;
}
ok = true;
else
{
- error (0, errno, _("%s: write failed"), zw->file_name);
+ msg_error (errno, _("%s: write failed"), zw->file_name);
ok = false;
}