Commit 088b691c authored by Michael Meeks's avatar Michael Meeks

broken lotus files don't hang gnumeric no more.

parent 9a69819d
1999-10-13 Michael Meeks <mmeeks@gnu.org>
* lotus.c (read_workbook): Pre-initialize the only sheet we
can read, so if we don't get a BOF (!) we can cope.
(attach_sheet): create. (read_workbook): update so we allways
have at least one sheet attached.
1999-08-11 Michael Meeks <michael@imaginator.com>
* boot.c (lotus_load): Add workbook argument to lotus_read.
......
......@@ -131,6 +131,20 @@ insert_value (Sheet *sheet, guint32 col, guint32 row, Value *val)
return cell;
}
static Sheet *
attach_sheet (Workbook *wb, int idx)
{
Sheet *sheet;
char *sheet_name;
sheet_name = g_strdup_printf ("Sheet%d\n", idx);
sheet = sheet_new (wb, sheet_name);
g_free (sheet_name);
workbook_attach_sheet (wb, sheet);
return sheet;
}
/* buf was old siag wb / sheet */
static gboolean
read_workbook (Workbook *wb, FILE *f)
......@@ -139,6 +153,8 @@ read_workbook (Workbook *wb, FILE *f)
Sheet *sheet = NULL;
gboolean panic = FALSE;
record_t *r;
sheet = attach_sheet (wb, sheetidx++);
r = record_new (f);
......@@ -149,13 +165,9 @@ read_workbook (Workbook *wb, FILE *f)
switch (r->type) {
case LOTUS_BOF:
{
char *name = g_strdup_printf ("Sheet%d\n", sheetidx++);
sheet = sheet_new (wb, name);
g_free (name);
workbook_attach_sheet (wb, sheet);
if (sheetidx > 1)
sheet = attach_sheet (wb, sheetidx++);
break;
}
case LOTUS_EOF:
sheet = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment