+ break;
+ if (!read_record (r, type, &allocated_vars, &allocated_labels))
+ return false;
+ }
+
+ if (!skip_bytes (r, 4))
+ return false;
+
+ if (r->compression == SFM_COMP_ZLIB && !read_zheader (r))
+ return false;
+
+ return true;
+}
+
+static bool
+read_record (struct sfm_reader *r, int type,
+ size_t *allocated_vars, size_t *allocated_labels)
+{
+ int subtype;
+
+ switch (type)
+ {
+ case 2:
+ if (r->n_vars >= *allocated_vars)
+ r->vars = pool_2nrealloc (r->pool, r->vars, allocated_vars,
+ sizeof *r->vars);
+ return read_variable_record (r, &r->vars[r->n_vars++]);
+
+ case 3:
+ if (r->n_labels >= *allocated_labels)
+ r->labels = pool_2nrealloc (r->pool, r->labels, allocated_labels,
+ sizeof *r->labels);
+ return read_value_label_record (r, &r->labels[r->n_labels++]);
+
+ case 4:
+ /* A Type 4 record is always immediately after a type 3 record,
+ so the code for type 3 records reads the type 4 record too. */
+ sys_error (r, r->pos, _("Misplaced type 4 record."));
+ return false;
+
+ case 6:
+ if (r->document != NULL)