projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
*** empty log message ***
[pspp]
/
src
/
format.c
diff --git
a/src/format.c
b/src/format.c
index 1c09e26c395bf5f6fc2f368392ce9f5ac2f38330..cce8c46ed2def8225719b514f30a777cfbb029b3 100644
(file)
--- a/
src/format.c
+++ b/
src/format.c
@@
-64,8
+64,19
@@
fmt_to_string (const struct fmt_spec *f)
static bool
check_common_specifier (const struct fmt_spec *spec, bool emit_error)
{
static bool
check_common_specifier (const struct fmt_spec *spec, bool emit_error)
{
- struct fmt_desc *f = &formats[spec->type];
- char *str = fmt_to_string (spec);
+ struct fmt_desc *f ;
+ char *str;
+
+ if ( spec->type > FMT_NUMBER_OF_FORMATS )
+ {
+ if (emit_error)
+ msg (SE, _("Format specifies a bad type (%d)"), spec->type);
+
+ return false;
+ }
+
+ f = &formats[spec->type];
+ str = fmt_to_string (spec);
if ((f->cat & FCAT_EVEN_WIDTH) && spec->w % 2)
{
if ((f->cat & FCAT_EVEN_WIDTH) && spec->w % 2)
{
@@
-92,11
+103,16
@@
check_common_specifier (const struct fmt_spec *spec, bool emit_error)
int
check_input_specifier (const struct fmt_spec *spec, int emit_error)
{
int
check_input_specifier (const struct fmt_spec *spec, int emit_error)
{
- struct fmt_desc *f
= &formats[spec->type]
;
- char *str
= fmt_to_string (spec)
;
+ struct fmt_desc *f ;
+ char *str ;
if (!check_common_specifier (spec, emit_error))
return false;
if (!check_common_specifier (spec, emit_error))
return false;
+
+ f = &formats[spec->type];
+ str = fmt_to_string (spec);
+
+
if (spec->type == FMT_X)
return 1;
if (f->cat & FCAT_OUTPUT_ONLY)
if (spec->type == FMT_X)
return 1;
if (f->cat & FCAT_OUTPUT_ONLY)
@@
-131,11
+147,15
@@
check_input_specifier (const struct fmt_spec *spec, int emit_error)
int
check_output_specifier (const struct fmt_spec *spec, int emit_error)
{
int
check_output_specifier (const struct fmt_spec *spec, int emit_error)
{
- struct fmt_desc *f
= &formats[spec->type]
;
- char *str
= fmt_to_string (spec);
+ struct fmt_desc *f;
+ char *str
;
if (!check_common_specifier (spec, emit_error))
return false;
if (!check_common_specifier (spec, emit_error))
return false;
+
+ f = &formats[spec->type];
+ str = fmt_to_string (spec);
+
if (spec->type == FMT_X)
return 1;
if (spec->w < f->Omin_w || spec->w > f->Omax_w)
if (spec->type == FMT_X)
return 1;
if (spec->w < f->Omin_w || spec->w > f->Omax_w)