Bug 62984 - Cannot compile koffice with gcc 3.3.1 (related to bug# 62906)
Summary: Cannot compile koffice with gcc 3.3.1 (related to bug# 62906)
Status: RESOLVED FIXED
Alias: None
Product: calligrasheets
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Laurent Montel
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-20 00:09 UTC by Philippe Rigault
Modified: 2003-08-20 01:31 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch for table.cc (1.20 KB, patch)
2003-08-20 00:10 UTC, Philippe Rigault
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Rigault 2003-08-20 00:09:08 UTC
Version:           1.2.92 (1.3beta3) (using KDE KDE 3.1.3)
Installed from:    Compiled From Sources
Compiler:          gcc-3.3.1 gcc compiled from sources
OS:          Linux

The file filters/kspread/latex/export/table.cc cannot compile with 'gcc-3.3.1 -pedantic' because it uses variable-length arrays (an extension of GCC) and an error is reported.

Please see bug# 62906, where I describe that
- prior versions of gcc used to (wrongly) issue a warning instead of an error.
- there was the same problem in koffice-1.2.1 filters/kword/latex/export/table.cc , but that file got corrected (replaced variable length array by QBitArray).

The inclusion of the kspread filter must have happened after that, since the author overlooked the variable-length arrays in that one.

I am including a patch as a follow-up
Comment 1 Philippe Rigault 2003-08-20 00:10:30 UTC
Created attachment 2279 [details]
Patch for table.cc

Here is the patch to fix the problem
Comment 2 David Faure 2003-08-20 01:31:58 UTC
Subject: koffice/filters/kspread/latex/export

CVS commit by faure: 

Helio already fixed compilation with gcc-3.3.1, but it's indeed more efficient to
use QBitArray than QValueVector<bool> (since we know the number of items before hand),
and this is more consistent with filters/kword/latex/export/.
CCMAIL: 62984-done@bugs.kde.org


  M +7 -7      table.cc   1.5


--- koffice/filters/kspread/latex/export/table.cc  #1.4:1.5
@@ -21,5 +21,5 @@
 
 #include <kdebug.h>             /* for kdDebug stream */
-#include <qvaluevector.h>
+#include <qbitarray.h>
 #include "cell.h"
 #include "column.h"
@@ -271,5 +271,5 @@ void Table::generateTopLineBorder(QTextS
         
         Cell* cell = 0;
-        QValueVector<bool> border;
+        QBitArray border( getMaxColumn() );
         bool fullLine = true;
         for(int index = 1; index <= getMaxColumn(); index++)
@@ -283,5 +283,5 @@ void Table::generateTopLineBorder(QTextS
 
                 /* If the element has a border display it here */
-                border.push_back( cell->hasTopBorder() );
+                border[ index ] = cell->hasTopBorder();
                 if( ! cell->hasTopBorder() )
                         fullLine = false;
@@ -304,5 +304,5 @@ void Table::generateTopLineBorder(QTextS
                                 int end;
                                 index = index + 1;
-                                while(border[index] == true && index < getMaxColumn())
+                                while(border[index] && index < getMaxColumn())
                                 {
                                         index = index + 1;
@@ -327,5 +327,5 @@ void Table::generateBottomLineBorder(QTe
 {
         Cell* cell = 0;
-        QValueVector<bool> border;
+        QBitArray border( getMaxColumn() );
         bool fullLine = true;
 
@@ -339,5 +339,5 @@ void Table::generateBottomLineBorder(QTe
 
                 /* If the element has a border display it here */
-                border.push_back( cell->hasBottomBorder() );
+                border[ index ] = cell->hasBottomBorder();
                 if( ! cell->hasBottomBorder() )
                         fullLine = false;
@@ -360,5 +360,5 @@ void Table::generateBottomLineBorder(QTe
                                 int end;
                                 index = index + 1;
-                                while(border[index] == true && index < getMaxColumn())
+                                while(border[index] && index < getMaxColumn())
                                 {
                                         index = index + 1;