- if (s->label && strcspn (s->label, " ") != strlen (s->label))
- {
- free (t->label);
- t->label = s->label;
- s->label = NULL;
- }
-
- if (val_labs_count (s->val_labs) && t->width > MAX_SHORT_STRING)
- msg (SW, _("Cannot add value labels from source file to "
- "long string variable %s."),
- s->name);
- else if (val_labs_count (s->val_labs))
- {
- /* Whether to apply the value labels. */
- int apply = 1;
-
- if (t->width < s->width)
- {
- struct val_labs_iterator *i;
- struct val_lab *lab;
-
- for (lab = val_labs_first (s->val_labs, &i); lab != NULL;
- lab = val_labs_next (s->val_labs, &i))
- {
- int j;
-
- /* We will apply the value labels only if all
- the truncated characters are blanks. */
- for (j = t->width; j < s->width; j++)
- if (lab->value.s[j] != ' ')
- {
- val_labs_done (&i);
- apply = 0;
- break;
- }
- }
- }
- else
- {
- /* Fortunately, we follow the convention that all value
- label values are right-padded with spaces, so it is
- unnecessary to bother padding values here. */
- }
-
- if (apply)
- {
- val_labs_destroy (t->val_labs);
- t->val_labs = s->val_labs;
- val_labs_set_width (t->val_labs, t->width);
- s->val_labs = val_labs_create (s->width);
- }
- }
-
- if (!mv_is_empty (&s->miss) && t->width > MAX_SHORT_STRING)
- msg (SW, _("Cannot apply missing values from source file to "
- "long string variable %s."),
- s->name);
- else if (!mv_is_empty (&s->miss))
+ if (var_get_label (s))
+ {
+ const char *label = var_get_label (s);
+ if (strcspn (label, " ") != strlen (label))
+ var_set_label (t, label);
+ }
+
+ if (var_has_value_labels (s))
+ {
+ const struct val_labs *value_labels = var_get_value_labels (s);
+ if (val_labs_can_set_width (value_labels, var_get_width (t)))
+ var_set_value_labels (s, value_labels);
+ }
+
+ if (var_has_missing_values (s))
+ {
+ const struct missing_values *miss = var_get_missing_values (s);
+ if (mv_is_resizable (miss, var_get_width (t)))
+ var_set_missing_values (t, miss);
+ }
+
+ if (var_is_numeric (s))