projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Avoid "definition without prototype" warnings
[pspp]
/
src
/
data
/
por-file-writer.c
diff --git
a/src/data/por-file-writer.c
b/src/data/por-file-writer.c
index 39c763113aad1343d448ab06566857b9d0edcaec..3a4e88e7f0cb6e5c6b5a545340e00f8168d7723d 100644
(file)
--- a/
src/data/por-file-writer.c
+++ b/
src/data/por-file-writer.c
@@
-1,5
+1,5
@@
/* PSPP - a program for statistical analysis.
/* PSPP - a program for statistical analysis.
- Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+ Copyright (C) 1997-9, 2000, 2006, 2009, 2010, 2011, 2012
, 2013
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
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
@@
-74,7
+74,7
@@
struct pfm_writer
struct pfm_var
{
int width; /* 0=numeric, otherwise string var width. */
struct pfm_var
{
int width; /* 0=numeric, otherwise string var width. */
- int
fv; /* Starting case index
. */
+ int
case_index; /* Index in case
. */
};
static const struct casewriter_class por_file_casewriter_class;
};
static const struct casewriter_class por_file_casewriter_class;
@@
-131,7
+131,7
@@
pfm_open_writer (struct file_handle *fh, struct dictionary *dict,
const struct variable *dv = dict_get_var (dict, i);
struct pfm_var *pv = &w->vars[i];
pv->width = MIN (var_get_width (dv), MAX_POR_WIDTH);
const struct variable *dv = dict_get_var (dict, i);
struct pfm_var *pv = &w->vars[i];
pv->width = MIN (var_get_width (dv), MAX_POR_WIDTH);
- pv->
fv
= var_get_case_index (dv);
+ pv->
case_index
= var_get_case_index (dv);
}
w->digits = opts.digits;
}
w->digits = opts.digits;
@@
-153,8
+153,8
@@
pfm_open_writer (struct file_handle *fh, struct dictionary *dict,
mode = 0444;
if (opts.create_writeable)
mode |= 0222;
mode = 0444;
if (opts.create_writeable)
mode |= 0222;
- w->rf = replace_file_start (fh
_get_file_name (fh)
, "w", mode,
- &w->file
, NULL
);
+ w->rf = replace_file_start (fh, "w", mode,
+ &w->file);
if (w->rf == NULL)
{
msg (ME, _("Error opening `%s' for writing as a portable file: %s."),
if (w->rf == NULL)
{
msg (ME, _("Error opening `%s' for writing as a portable file: %s."),
@@
-336,7
+336,9
@@
write_variables (struct pfm_writer *w, struct dictionary *dict)
buf_write (w, "4", 1);
write_int (w, dict_get_var_cnt (dict));
buf_write (w, "4", 1);
write_int (w, dict_get_var_cnt (dict));
- write_int (w, 161);
+
+ buf_write (w, "5", 1);
+ write_int (w, ceil (w->digits * (log (10) / log (30))));
for (i = 0; i < dict_get_var_cnt (dict); i++)
{
for (i = 0; i < dict_get_var_cnt (dict); i++)
{
@@
-456,11
+458,11
@@
por_file_casewriter_write (struct casewriter *writer, void *w_,
struct pfm_var *v = &w->vars[i];
if (v->width == 0)
struct pfm_var *v = &w->vars[i];
if (v->width == 0)
- write_float (w, case_num_idx (c, v->
fv
));
+ write_float (w, case_num_idx (c, v->
case_index
));
else
{
write_int (w, v->width);
else
{
write_int (w, v->width);
- buf_write (w, case_str_idx (c, v->
fv
), v->width);
+ buf_write (w, case_str_idx (c, v->
case_index
), v->width);
}
}
}
}
}
}