]> git.lyx.org Git - features.git/commitdiff
Fixed bug which crashed LyX when reading old tabular format
authorJürgen Vigna <jug@sad.it>
Tue, 21 Dec 1999 15:43:47 +0000 (15:43 +0000)
committerJürgen Vigna <jug@sad.it>
Tue, 21 Dec 1999 15:43:47 +0000 (15:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@391 a592a061-630c-0410-9148-cb99ea01b6c8

ChangeLog
src/table.C

index 1386aaeeb27d470c821011ab9b3d7492aacc4760..0d710f2a172e0943c6fb887b49fe9ae0836fc9ae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 0c454dcb25c0d07ec3c2ec7813155bb7fbf68549..ac5b6487d300a15e690bb75a1be7a64c52b7852b 100644 (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);