projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix bad syntax generation introduced by previous commit.
[pspp]
/
utilities
/
pspp-dump-sav.c
diff --git
a/utilities/pspp-dump-sav.c
b/utilities/pspp-dump-sav.c
index 788c34f76b7527612eaefe03cbfecc73d68fa1f5..c194f230500fbdf7c5c52d7a6778651e8f412ae6 100644
(file)
--- a/
utilities/pspp-dump-sav.c
+++ b/
utilities/pspp-dump-sav.c
@@
-444,18
+444,16
@@
read_variable_record (struct sfm_reader *r)
if (has_variable_label == 1)
{
long long int offset = ftello (r->file);
if (has_variable_label == 1)
{
long long int offset = ftello (r->file);
- size_t len
, read_len
;
- char
label[255 + 1]
;
+ size_t len;
+ char
*label
;
len = read_int (r);
/* Read up to 255 bytes of label. */
len = read_int (r);
/* Read up to 255 bytes of label. */
-
read_len = MIN (sizeof label - 1, len
);
- read_string (r, label,
read_
len + 1);
+
label = xmalloc (len + 1
);
+ read_string (r, label, len + 1);
printf("\t%08llx Variable label: \"%s\"\n", offset, label);
printf("\t%08llx Variable label: \"%s\"\n", offset, label);
-
- /* Skip unread label bytes. */
- skip_bytes (r, len - read_len);
+ free (label);
/* Skip label padding up to multiple of 4 bytes. */
skip_bytes (r, ROUND_UP (len, 4) - len);
/* Skip label padding up to multiple of 4 bytes. */
skip_bytes (r, ROUND_UP (len, 4) - len);
@@
-606,12
+604,6
@@
read_extension_record (struct sfm_reader *r)
read_machine_float_info (r, size, count);
return;
read_machine_float_info (r, size, count);
return;
- case 5:
- /* Variable sets information. We don't use these yet.
- They only apply to GUIs; see VARSETS on the APPLY
- DICTIONARY command in SPSS documentation. */
- break;
-
case 6:
/* DATE variable information. We don't use it yet, but we
should. */
case 6:
/* DATE variable information. We don't use it yet, but we
should. */
@@
-768,6
+760,9
@@
read_mrsets (struct sfm_reader *r, size_t size, size_t count)
const char *label;
const char *variables;
const char *label;
const char *variables;
+ while (text_match (text, '\n'))
+ continue;
+
name = text_tokenize (text, '=');
if (name == NULL)
break;
name = text_tokenize (text, '=');
if (name == NULL)
break;
@@
-829,12
+824,6
@@
read_mrsets (struct sfm_reader *r, size_t size, size_t count)
break;
variables = text_tokenize (text, '\n');
break;
variables = text_tokenize (text, '\n');
- if (variables == NULL)
- {
- sys_warn (r, "missing variable names following label "
- "at offset %zu in mrsets record", text_pos (text));
- break;
- }
printf ("\t\"%s\": multiple %s set",
name, type == MRSET_MC ? "category" : "dichotomy");
printf ("\t\"%s\": multiple %s set",
name, type == MRSET_MC ? "category" : "dichotomy");
@@
-846,7
+835,10
@@
read_mrsets (struct sfm_reader *r, size_t size, size_t count)
printf (", label \"%s\"", label);
if (label_from_var_label)
printf (", label from variable label");
printf (", label \"%s\"", label);
if (label_from_var_label)
printf (", label from variable label");
- printf(", variables \"%s\"\n", variables);
+ if (variables != NULL)
+ printf(", variables \"%s\"\n", variables);
+ else
+ printf(", no variables\n");
}
close_text_record (text);
}
}
close_text_record (text);
}