#include "data/short-names.h"
#include "data/value-labels.h"
#include "data/variable.h"
#include "data/short-names.h"
#include "data/value-labels.h"
#include "data/variable.h"
#include "libpspp/float-format.h"
#include "libpspp/i18n.h"
#include "libpspp/integer-format.h"
#include "libpspp/float-format.h"
#include "libpspp/i18n.h"
#include "libpspp/integer-format.h"
- w->rf = replace_file_start (fh, "wb", mode, &w->file);
+
+ int fd;
+ w->rf = replace_file_start_fd (fh, true, mode, &fd);
if (w->rf == NULL)
{
msg (ME, _("Error opening `%s' for writing as a system file: %s."),
fh_get_file_name (fh), strerror (errno));
goto error;
}
if (w->rf == NULL)
{
msg (ME, _("Error opening `%s' for writing as a system file: %s."),
fh_get_file_name (fh), strerror (errno));
goto error;
}
get_encoding_info (&encoding_info, dict_get_encoding (d));
w->space = encoding_info.space[0];
get_encoding_info (&encoding_info, dict_get_encoding (d));
w->space = encoding_info.space[0];
w->zstream.zalloc = Z_NULL;
w->zstream.zfree = Z_NULL;
w->zstream.opaque = Z_NULL;
w->zstream.zalloc = Z_NULL;
w->zstream.zfree = Z_NULL;
w->zstream.opaque = Z_NULL;
write_int (w, 1); /* Data item (byte) size. */
write_int (w, size); /* Number of data items. */
write_int (w, 1); /* Data item (byte) size. */
write_int (w, size); /* Number of data items. */
for (i = 0; i < n_vars; i++)
{
struct variable *var = dict_get_var (dict, i);
for (i = 0; i < n_vars; i++)
{
struct variable *var = dict_get_var (dict, i);
write_int (w, 1); /* Data item (byte) size. */
write_int (w, size); /* Number of data items. */
write_int (w, 1); /* Data item (byte) size. */
write_int (w, size); /* Number of data items. */
for (i = 0; i < n_vars; i++)
{
struct variable *var = dict_get_var (dict, i);
for (i = 0; i < n_vars; i++)
{
struct variable *var = dict_get_var (dict, i);
write_bytes (w, value_str (value, width), 8);
}
}
write_bytes (w, value_str (value, width), 8);
}
}
ok = !write_error (w);
/* Seek back to the beginning and update the number of cases.
This is just a courtesy to later readers, so there's no need
to check return values or report errors. */
ok = !write_error (w);
/* Seek back to the beginning and update the number of cases.
This is just a courtesy to later readers, so there's no need
to check return values or report errors. */
{
write_int64 (w, compressed_ofs);
write_int64 (w, 24 + (w->n_blocks * 24));
{
write_int64 (w, compressed_ofs);
write_int64 (w, 24 + (w->n_blocks * 24));
size_t pad_bytes = width - data_bytes;
write_bytes (w, string, data_bytes);
while (pad_bytes-- > 0)
size_t pad_bytes = width - data_bytes;
write_bytes (w, string, data_bytes);
while (pad_bytes-- > 0)