Fixed bug which crashed LyX when reading old tabular format

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@391 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 1999-12-21 15:43:47 +00:00
parent 5f3f9ad231
commit 23297eadbd
2 changed files with 34 additions and 4 deletions

View File

@ -1,3 +1,10 @@
1999-12-21 Juergen Vigna <jug@sad.it>
* src/table.C (Read): Now read bogus row format informations
if the format is < 5 so that afterwards the table can
be read by lyx but without any format-info. Fixed the
crash we experienced when not doing this.
1999-12-21 Lars Gullik Bjønnes <larsbj@lyx.org>
* src/text2.C (RedoHeightOfParagraph): rename arg cursor -> cur

View File

@ -872,13 +872,36 @@ void LyXTable::Read(FILE * file)
#ifdef WITH_WARNINGS
#warning Insert a error message window here that this format is not supported anymore
#endif
a = b = c = d = -1;
if (version < 5) {
lyxerr << "Tabular format < 5 is not supported anymore\n"
"Get an older version of LyX (< 1.1.x) for conversion!"
<< endl;
lyxerr << "Tabular format < 5 is not supported anymore\n"
"Get an older version of LyX (< 1.1.x) for conversion!"
<< endl;
if (version > 2) {
fgets(vtmp,sizeof(vtmp),file);
sscanf(vtmp, "%d %d %d %d %d %d %d %d\n",
&rows_arg, &columns_arg,
&is_long_table_arg, &rotate_arg, &a, &b, &c, &d);
} else
fscanf(file, "%d %d\n",
&rows_arg, &columns_arg);
Init(rows_arg, columns_arg);
SetLongTable(is_long_table_arg);
SetRotateTable(rotate_arg);
for (i = 0; i<rows; i++){
fgets(vtmp, sizeof(vtmp), file);
}
for (i = 0; i<columns; i++){
fgets(vtmp, sizeof(vtmp), file);
}
for (i = 0; i < rows; ++i) {
for (j = 0; j < columns; ++j) {
fgets(vtmp, sizeof(vtmp), file);
}
}
set_row_column_number_info();
return;
}
a = b = c = d = -1;
fgets(vtmp, sizeof(vtmp), file);
sscanf(vtmp, "%d %d %d %d %d %d %d %d\n", &rows_arg, &columns_arg,
&is_long_table_arg, &rotate_arg, &a, &b, &c, &d);