int value_cnt; /* Number of 8-byte units per case. */
struct sfm_var *vars; /* Variables. */
size_t var_cnt; /* Number of variables. */
+ bool has_long_var_names; /* File has a long variable name map */
bool has_vls; /* File has one or more very long strings? */
/* Decompression. */
r->error = false;
r->value_cnt = 0;
r->has_vls = false;
+ r->has_long_var_names = false;
r->opcode_idx = sizeof r->opcodes;
if (setjmp (r->bail_out))
rec_type = read_int32 (r);
}
+
+ if ( ! r->has_long_var_names )
+ {
+ int i;
+ for (i = 0; i < dict_get_var_cnt (*dict); i++)
+ {
+ struct variable *var = dict_get_var (*dict, i);
+ char short_name [SHORT_NAME_LEN + 1];
+ char long_name [SHORT_NAME_LEN + 1];
+
+ strcpy (short_name, var_get_name (var));
+
+ strcpy (long_name, short_name);
+ str_lowercase (long_name);
+
+ /* Set long name. Renaming a variable may clear the short
+ name, but we want to retain it, so re-set it
+ explicitly. */
+ dict_rename_var (*dict, var, long_name);
+ var_set_short_name (var, short_name);
+ }
+
+ r->has_long_var_names = true;
+ }
+
/* Read record 999 data, which is just filler. */
read_int32 (r);
sys_error (r, _("Number of document lines (%d) "
"must be greater than 0."), line_cnt);
- documents = pool_nmalloc (r->pool, line_cnt + 1, 80);
- read_string (r, documents, 80 * line_cnt + 1);
- dict_set_documents (dict, documents);
+ documents = pool_nmalloc (r->pool, line_cnt + 1, DOC_LINE_LENGTH);
+ read_string (r, documents, DOC_LINE_LENGTH * line_cnt + 1);
+ if (strlen (documents) == DOC_LINE_LENGTH * line_cnt)
+ dict_set_documents (dict, documents);
+ else
+ sys_error (r, _("Document line contains null byte."));
pool_free (r->pool, documents);
}
var_set_short_name (var, short_name);
}
close_variable_to_value_map (r, map);
+ r->has_long_var_names = true;
}
/* Reads record type 7, subtype 14, which gives the real length