Fixed bug importing ODS files.
[pspp] / src / data / variable.c
index d3f9addc4c1c4d1a4dbc23d7491ae756a748d3c8..c4bab00fc36081b15aa368ec5b57dc89b7088dfe 100644 (file)
@@ -103,7 +103,7 @@ var_create (const char *name, int width)
   type = val_type_from_width (width);
   v->alignment = var_default_alignment (type);
   v->measure = var_default_measure (type);
-  v->role = ROLE_NONE;
+  v->role = ROLE_INPUT;
   v->display_width = var_default_display_width (width);
   v->print = v->write = var_default_formats (width);
   attrset_init (&v->attributes);
@@ -285,8 +285,11 @@ var_set_width_and_formats (struct variable *v, int new_width,
   if (fmt_resize (&v->write, new_width))
     traits |= VAR_TRAIT_WRITE_FORMAT;
 
-  v->width = new_width;
-  traits |= VAR_TRAIT_WIDTH;
+  if (v->width != new_width)
+    {
+      v->width = new_width;
+      traits |= VAR_TRAIT_WIDTH;
+    }
 
   if (print)
     {
@@ -300,7 +303,8 @@ var_set_width_and_formats (struct variable *v, int new_width,
       traits |= VAR_TRAIT_WRITE_FORMAT;
     }
 
-  dict_var_changed (v, traits, ov);
+  if (traits != 0)
+    dict_var_changed (v, traits, ov);
 }
 
 /* Changes the width of V to NEW_WIDTH.
@@ -888,7 +892,7 @@ var_role_is_valid (enum var_role role)
     {
     case ROLE_NONE:
     case ROLE_INPUT:
-    case ROLE_OUTPUT:
+    case ROLE_TARGET:
     case ROLE_BOTH:
     case ROLE_PARTITION:
     case ROLE_SPLIT:
@@ -905,18 +909,18 @@ var_role_to_string (enum var_role role)
 {
   switch (role)
     {
-    case ROLE_NONE:
-      return _("None");
-
     case ROLE_INPUT:
       return _("Input");
 
-    case ROLE_OUTPUT:
+    case ROLE_TARGET:
       return _("Output");
 
     case ROLE_BOTH:
       return _("Both");
 
+    case ROLE_NONE:
+      return _("None");
+
     case ROLE_PARTITION:
       return _("Partition");
 
@@ -934,18 +938,18 @@ var_role_to_syntax (enum var_role role)
 {
   switch (role)
     {
-    case ROLE_NONE:
-      return "NONE";
-
     case ROLE_INPUT:
       return "INPUT";
 
-    case ROLE_OUTPUT:
+    case ROLE_TARGET:
       return "TARGET";
 
     case ROLE_BOTH:
       return "BOTH";
 
+    case ROLE_NONE:
+      return "NONE";
+
     case ROLE_PARTITION:
       return "PARTITION";