Don't assume that MEASURE_* and ALIGN_* have the same values found in
[pspp-builds.git] / src / data / sys-file-reader.c
index d62dfc7bd6a411944da841e25a2a98e6221f9de9..9a4b33a911f69b75709b6b2edd763107e8f874b3 100644 (file)
@@ -1,6 +1,5 @@
 /* PSPP - computes sample statistics.
    Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
-   Written by Ben Pfaff <blp@gnu.org>.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -814,7 +813,7 @@ read_display_parameters (struct sfm_reader *r, size_t size, size_t count,
       int align = read_int32 (r);
       struct variable *v;
 
-      if (!measure_is_valid (measure) || !alignment_is_valid (align))
+      if (measure < 1 || measure > 3 || align < 0 || align > 2)
         {
           if (!warned)
             sys_warn (r, _("Invalid variable display parameters.  "
@@ -824,9 +823,13 @@ read_display_parameters (struct sfm_reader *r, size_t size, size_t count,
         }
 
       v = dict_get_var (dict, i);
-      var_set_measure (v, measure);
+      var_set_measure (v, (measure == 1 ? MEASURE_NOMINAL
+                           : measure == 2 ? MEASURE_ORDINAL
+                           : MEASURE_SCALE));
       var_set_display_width (v, width);
-      var_set_alignment (v, align);
+      var_set_alignment (v, (align == 0 ? ALIGN_LEFT
+                             : align == 1 ? ALIGN_RIGHT
+                             : ALIGN_CENTRE));
     }
 }