]> git.lyx.org Git - lyx.git/blobdiff - src/tabular.C
fix reading the author field.
[lyx.git] / src / tabular.C
index 0cb7adec7bb1b19be5bc611dfcbd1ddcba483538..b8957c2ba2a6723a7c369b3bb4d9120c75b78144 100644 (file)
@@ -1126,7 +1126,7 @@ void LyXTabular::write(Buffer const & buf, ostream & os) const
                           << ">\n";
                        os << "\\begin_inset ";
                        cell_info[i][j].inset.write(buf, os);
-                       os << "\n\\end_inset \n"
+                       os << "\n\\end_inset\n"
                           << "</cell>\n";
                }
                os << "</row>\n";
@@ -1683,8 +1683,7 @@ int LyXTabular::getAscentOfRow(int row) const
 
 int LyXTabular::getDescentOfRow(int row) const
 {
-       if (row >= rows_)
-               return 0;
+       BOOST_ASSERT(row < rows_);
        return row_info[row].descent_of_row;
 }
 
@@ -1701,16 +1700,16 @@ int LyXTabular::getHeightOfTabular() const
 
 bool LyXTabular::isPartOfMultiColumn(int row, int column) const
 {
-       if (row >= rows_ || column >= columns_)
-               return false;
+       BOOST_ASSERT(row < rows_);
+       BOOST_ASSERT(column < columns_);
        return cell_info[row][column].multicolumn == CELL_PART_OF_MULTICOLUMN;
 }
 
 
 int LyXTabular::TeXTopHLine(ostream & os, int row) const
 {
-       if (row < 0 || row >= rows_)
-               return 0;
+       BOOST_ASSERT(row >= 0);
+       BOOST_ASSERT(row < rows_);
 
        int const fcell = getFirstCellInRow(row);
        int const n = numberOfCellsInRow(fcell) + fcell;
@@ -2342,7 +2341,8 @@ int LyXTabular::asciiTopHLine(ostream & os, int row,
                }
                int column = column_of_cell(i);
                int len = clen[column];
-               while (isPartOfMultiColumn(row, ++column))
+               while (column < columns_ - 1  
+                      && isPartOfMultiColumn(row, ++column))
                        len += clen[column] + 4;
                os << string(len, ch);
                if (topLine(i)) {
@@ -2389,7 +2389,8 @@ int LyXTabular::asciiBottomHLine(ostream & os, int row,
                }
                int column = column_of_cell(i);
                int len = clen[column];
-               while (isPartOfMultiColumn(row, ++column))
+               while (column < columns_ -1
+                      && isPartOfMultiColumn(row, ++column))
                        len += clen[column] + 4;
                os << string(len, ch);
                if (bottomLine(i)) {
@@ -2427,7 +2428,8 @@ int LyXTabular::asciiPrintCell(Buffer const & buf, ostream & os,
 
        unsigned int len1 = sstr.str().length();
        unsigned int len2 = clen[column];
-       while (isPartOfMultiColumn(row, ++column))
+       while (column < columns_ -1
+              && isPartOfMultiColumn(row, ++column))
                len2 += clen[column] + 4;
        len2 -= len1;