projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added automake.mk files in src/language
[pspp]
/
src
/
pfm-write.c
diff --git
a/src/pfm-write.c
b/src/pfm-write.c
index cd088b7b85048be501fbd2ccbec3c45b316ddcee..132216d5cbe6ff2a58fc4072d004c0d369eab706 100644
(file)
--- a/
src/pfm-write.c
+++ b/
src/pfm-write.c
@@
-106,12
+106,12
@@
pfm_open_writer (struct file_handle *fh, struct dictionary *dict,
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
mode = S_IRUSR | S_IRGRP | S_IROTH;
if (opts.create_writeable)
mode |= S_IWUSR | S_IWGRP | S_IWOTH;
- fd = open (
handle
_get_filename (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
+ fd = open (
fh
_get_filename (fh), O_WRONLY | O_CREAT | O_TRUNC, mode);
if (fd < 0)
goto open_error;
/* Open file handle. */
if (fd < 0)
goto open_error;
/* Open file handle. */
- if (!fh_open (fh, "portable file", "we"))
+ if (!fh_open (fh,
FH_REF_FILE,
"portable file", "we"))
goto error;
/* Initialize data structures. */
goto error;
/* Initialize data structures. */
@@
-129,7
+129,7
@@
pfm_open_writer (struct file_handle *fh, struct dictionary *dict,
w->vars = NULL;
w->var_cnt = dict_get_var_cnt (dict);
w->vars = NULL;
w->var_cnt = dict_get_var_cnt (dict);
- w->vars = x
malloc (sizeof *w->vars * w->var_cnt
);
+ w->vars = x
nmalloc (w->var_cnt, sizeof *w->vars
);
for (i = 0; i < w->var_cnt; i++)
{
const struct variable *dv = dict_get_var (dict, i);
for (i = 0; i < w->var_cnt; i++)
{
const struct variable *dv = dict_get_var (dict, i);
@@
-163,7
+163,7
@@
pfm_open_writer (struct file_handle *fh, struct dictionary *dict,
open_error:
msg (ME, _("An error occurred while opening \"%s\" for writing "
"as a portable file: %s."),
open_error:
msg (ME, _("An error occurred while opening \"%s\" for writing "
"as a portable file: %s."),
-
handle
_get_filename (fh), strerror (errno));
+
fh
_get_filename (fh), strerror (errno));
err_cond_fail ();
goto error;
}
err_cond_fail ();
goto error;
}
@@
-199,7
+199,7
@@
buf_write (struct pfm_writer *w, const void *buf_, size_t nbytes)
error:
msg (ME, _("%s: Writing portable file: %s."),
error:
msg (ME, _("%s: Writing portable file: %s."),
-
handle
_get_filename (w->fh), strerror (errno));
+
fh
_get_filename (w->fh), strerror (errno));
return 0;
}
return 0;
}
@@
-246,7
+246,7
@@
write_header (struct pfm_writer *w)
{
/* PORTME: Translation table from SPSS character code to this
computer's native character code (which is probably ASCII). */
{
/* PORTME: Translation table from SPSS character code to this
computer's native character code (which is probably ASCII). */
- static const
unsigned
char spss2ascii[256] =
+ static const char spss2ascii[256] =
{
"0000000000000000000000000000000000000000000000000000000000000000"
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ."
{
"0000000000000000000000000000000000000000000000000000000000000000"
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ."
@@
-420,7
+420,7
@@
write_value_labels (struct pfm_writer *w, const struct dictionary *dict)
/* Writes case ELEM to the portable file represented by H. Returns
success. */
int
/* Writes case ELEM to the portable file represented by H. Returns
success. */
int
-pfm_write_case (struct pfm_writer *w, struct ccase *c)
+pfm_write_case (struct pfm_writer *w,
const
struct ccase *c)
{
int i;
{
int i;
@@
-451,8
+451,6
@@
pfm_close_writer (struct pfm_writer *w)
if (w == NULL)
return;
if (w == NULL)
return;
- fh_close (w->fh, "portable file", "we");
-
if (w->file != NULL)
{
char buf[80];
if (w->file != NULL)
{
char buf[80];
@@
-466,9
+464,11
@@
pfm_close_writer (struct pfm_writer *w)
if (fclose (w->file) == EOF)
msg (ME, _("%s: Closing portable file: %s."),
if (fclose (w->file) == EOF)
msg (ME, _("%s: Closing portable file: %s."),
-
handle
_get_filename (w->fh), strerror (errno));
+
fh
_get_filename (w->fh), strerror (errno));
}
}
+ fh_close (w->fh, "portable file", "we");
+
free (w->vars);
free (w);
}
free (w->vars);
free (w);
}