projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
work
[pspp]
/
src
/
data
/
por-file-reader.c
diff --git
a/src/data/por-file-reader.c
b/src/data/por-file-reader.c
index 94a2faf33b1ff4849c1d19a7f4801f6ec28d4b28..2487ab2cb43f140d3fe6f9962b9a07afa4090d8e 100644
(file)
--- a/
src/data/por-file-reader.c
+++ b/
src/data/por-file-reader.c
@@
-215,7
+215,7
@@
advance (struct pfm_reader *r)
r->line_length = 0;
}
if (c == EOF)
r->line_length = 0;
}
if (c == EOF)
- error (r, _("
u
nexpected end of file"));
+ error (r, _("
U
nexpected end of file"));
if (r->trans != NULL)
c = r->trans[c];
if (r->trans != NULL)
c = r->trans[c];
@@
-623,32
+623,23
@@
static struct fmt_spec
convert_format (struct pfm_reader *r, const int portable_format[3],
struct variable *v, bool *report_error)
{
convert_format (struct pfm_reader *r, const int portable_format[3],
struct variable *v, bool *report_error)
{
- struct fmt_spec format;
- bool ok;
-
- if (!fmt_from_io (portable_format[0], &format.type))
+ enum fmt_type type;
+ if (fmt_from_io (portable_format[0], &type))
{
{
- if (*report_error)
- warning (r, _("%s: Bad format specifier byte (%d). Variable "
- "will be assigned a default format."),
- var_get_name (v), portable_format[0]);
- goto assign_default;
- }
+ struct fmt_spec format = {
+ .type = type,
+ .w = portable_format[1],
+ .d = portable_format[2],
+ };
- format.w = portable_format[1];
- format.d = portable_format[2];
+ if (fmt_check_output (format)
+ && fmt_check_width_compat (format, var_get_width (v)))
+ return format;
- msg_disable ();
- ok = (fmt_check_output (&format)
- && fmt_check_width_compat (&format, var_get_width (v)));
- msg_enable ();
-
- if (!ok)
- {
if (*report_error)
{
char fmt_string[FMT_STRING_LEN_MAX + 1];
if (*report_error)
{
char fmt_string[FMT_STRING_LEN_MAX + 1];
- fmt_to_string (
&
format, fmt_string);
+ fmt_to_string (format, fmt_string);
if (var_is_numeric (v))
warning (r, _("Numeric variable %s has invalid format "
"specifier %s."),
if (var_is_numeric (v))
warning (r, _("Numeric variable %s has invalid format "
"specifier %s."),
@@
-658,12
+649,15
@@
convert_format (struct pfm_reader *r, const int portable_format[3],
"invalid format specifier %s."),
var_get_name (v), var_get_width (v), fmt_string);
}
"invalid format specifier %s."),
var_get_name (v), var_get_width (v), fmt_string);
}
- goto assign_default;
+ }
+ else
+ {
+ if (*report_error)
+ warning (r, _("%s: Bad format specifier byte (%d). Variable "
+ "will be assigned a default format."),
+ var_get_name (v), portable_format[0]);
}
}
- return format;
-
-assign_default:
*report_error = false;
return fmt_default_for_width (var_get_width (v));
}
*report_error = false;
return fmt_default_for_width (var_get_width (v));
}
@@
-716,8
+710,7
@@
read_variables (struct pfm_reader *r, struct dictionary *dict)
for (j = 0; j < 6; j++)
fmt[j] = read_int (r);
for (j = 0; j < 6; j++)
fmt[j] = read_int (r);
- if (!dict_id_is_valid (dict, name, false)
- || *name == '#' || *name == '$')
+ if (!dict_id_is_valid (dict, name) || *name == '#' || *name == '$')
error (r, _("Invalid variable name `%s' in position %d."), name, i);
str_uppercase (name);
error (r, _("Invalid variable name `%s' in position %d."), name, i);
str_uppercase (name);
@@
-742,8
+735,8
@@
read_variables (struct pfm_reader *r, struct dictionary *dict)
print = convert_format (r, &fmt[0], v, &report_error);
write = convert_format (r, &fmt[3], v, &report_error);
print = convert_format (r, &fmt[0], v, &report_error);
write = convert_format (r, &fmt[3], v, &report_error);
- var_set_print_format (v,
&
print);
- var_set_write_format (v,
&
write);
+ var_set_print_format (v, print);
+ var_set_write_format (v, write);
/* Range missing values. */
mv_init (&miss, width);
/* Range missing values. */
mv_init (&miss, width);