zip_member_ref (content);
+ if (r->xtr)
+ xmlFreeTextReader (r->xtr);
xtr = xmlReaderForIO ((xmlInputReadCallback) zip_member_read,
(xmlInputCloseCallback) zip_member_finish,
r->xtr = xtr;
r->spreadsheet.type = SPREADSHEET_ODS;
+ r->row = 0;
+ r->col = 0;
+ r->current_sheet = 0;
+ r->state = STATE_INIT;
if (report_errors)
xmlTextReaderSetErrorHandler (xtr, ods_error_handler, r);
/* xrealloc (unlike realloc) doesn't initialise its memory to 0 */
memset (var_spec + n_var_specs,
0,
- (n_var_specs - idx + 1) * sizeof (*var_spec));
+ (idx - n_var_specs + 1) * sizeof (*var_spec));
n_var_specs = idx + 1;
}
var_spec[idx].firstval.text = 0;
if (idx >= n_var_specs)
{
var_spec = xrealloc (var_spec, sizeof (*var_spec) * (idx + 1));
+ memset (var_spec + n_var_specs,
+ 0,
+ (idx - n_var_specs + 1) * sizeof (*var_spec));
+
var_spec [idx].name = NULL;
n_var_specs = idx + 1;
}
for (col = 0; col < r->col_span; ++col)
{
const struct variable *var;
- const int idx = r->col + col - r->start_col - 1;
+ const int idx = r->col - col - r->start_col - 1;
if (idx < 0)
continue;
if (r->stop_col != -1 && idx > r->stop_col - r->start_col )