Subject: patches for koffice for gcc 3.3.1
To: koffice maintainer <tech-pkg@netbsd.org>
From: Jeremy C. Reed <reed@reedmedia.net>
List: tech-pkg
Date: 09/29/2003 14:27:14
I needed some patches to build koffice with gcc 3.3.1. (I am using
gcc3-c++-3.3.1 from pkgsrc.)
Examples of errors:
formula.cc:4:23: strstream.h: No such file or directory
formula.cc: In member function `void QpFormula::floatFuncReal(const char*)':
formula.cc:477: error: `ostrstream' undeclared (first use this function)
and
table.cc: In member function `void
Table::generateTopLineBorder(QTextStream&, int)':
table.cc:171: error: ISO C++ forbids variable-size array `border'
I assume these patches are fine for older gcc too. Can someone
test and confirm?
If these are fine, may I add them?
The first four patches come directly from KDE's cvs for KOFFICE_1_2_BRANCH
and the last patch comes from a KDE bug report.
patch-aa through patch-ae follow:
formula.cc:4:23: strstream.h: No such file or directory
formula.cc:477: error: `ostrstream' undeclared (first use this function)
--- filters/kspread/qpro/libqpro/src/formula.cc.orig 2003-09-29 16:37:17.000000000 +0000
+++ filters/kspread/qpro/libqpro/src/formula.cc 2003-09-29 16:37:41.000000000 +0000
@@ -1,7 +1,7 @@
#include <qpro/common.h>
-#include <iostream.h>
-#include <strstream.h>
+#include <iostream>
+#include <strstream>
#include <string.h>
@@ -474,7 +474,7 @@
QpFormula::floatFuncReal(const char*)
{
QP_INT64 lFloat;
- ostrstream lNum;
+ std::ostrstream lNum;
cFormula >> lFloat;
@@ -489,7 +489,7 @@
QpFormula::intFuncReal(const char*)
{
QP_INT16 lInt;
- ostrstream lNum;
+ std::ostrstream lNum;
cFormula >> lInt;
--- filters/kspread/qpro/libqpro/src/record.cc.orig 2003-09-29 16:45:05.000000000 +0000
+++ filters/kspread/qpro/libqpro/src/record.cc 2003-09-29 16:46:18.000000000 +0000
@@ -2,7 +2,7 @@
#include <string.h>
-#include <iostream.h>
+#include <iostream>
#include <qpro/record.h>
#include <qpro/formula.h>
@@ -10,7 +10,7 @@
// -----------------------------------------------------------------------
#include <iomanip.h>
-#include <strstream.h>
+#include <strstream>
void
Charout(ostream& pOut, unsigned char pChar)
@@ -32,7 +32,7 @@
int
Hexout(char* pChar, int pLen)
{
- ostrstream* lOStr = new ostrstream;
+ std::ostrstream* lOStr = new std::ostrstream;
while( pLen )
{
@@ -57,7 +57,7 @@
cerr << lOStr->rdbuf() << endl;
delete lOStr;
- lOStr = new ostrstream;
+ lOStr = new std::ostrstream;
}
delete lOStr;
@@ -200,7 +200,7 @@
{
//??? cope with relative/absolute references
- strstream lOut(pText, 20, ios::out); // ??? ard coded len
+ std::strstream lOut(pText, 20, ios::out); // ??? ard coded len
int lPageRelative = pRow & 0x8000;
int lColRelative = pRow & 0x4000;
int lRowRelative = pRow & 0x2000;
--- filters/kspread/qpro/libqpro/src/stream.cc.orig 2003-09-29 16:48:06.000000000 +0000
+++ filters/kspread/qpro/libqpro/src/stream.cc 2003-09-29 16:48:38.000000000 +0000
@@ -31,7 +31,7 @@
#else
#include <string.h>
#include <fstream.h>
-#include <strstream.h>
+#include <strstream>
// For IRIX
namespace std {}
@@ -60,7 +60,7 @@
, cOffset(0L)
, cStreamBuf(0)
{
- cStreamBuf = new strstreambuf (pBuffer, pLen);
+ cStreamBuf = new std::strstreambuf (pBuffer, pLen);
cIn = new istream(cStreamBuf);
}
--- filters/kspread/qpro/qproimport.cc.orig 2003-09-29 16:51:50.000000000 +0000
+++ filters/kspread/qpro/qproimport.cc 2003-09-29 16:51:57.000000000 +0000
@@ -18,7 +18,7 @@
Boston, MA 02111-1307, USA.
*/
-#include <strstream.h>
+#include <strstream>
#include <kdebug.h>
#include <kmessagebox.h>
table.cc:171: error: ISO C++ forbids variable-size array `border'
http://bugs.kde.org/show_bug.cgi?id=62906
--- filters/kword/latex/export/table.cc~ 2002-05-25 03:16:02.000000000 -0700
+++ filters/kword/latex/export/table.cc 2003-08-19 14:03:48.000000000 -0700
@@ -20,6 +20,7 @@
*/
#include <kdebug.h> /* for kdDebug stream */
+#include <qbitarray.h>
#include "listtable.h"
#include "texte.h"
@@ -168,7 +169,7 @@
void Table::generateTopLineBorder(QTextStream& out, int row)
{
Element* elt = 0;
- bool border[getMaxCol()];
+ QBitArray border(getMaxCol());
bool fullLine = true;
for(int index = 0; index <= getMaxCol(); index++)
{
@@ -179,11 +180,11 @@
/* If the element has a border display it here */
if(elt->hasTopBorder())
{
- border[index] = true;
+ border[index] = 1;
}
else
{
- border[index] = false;
+ border[index] = 0;
fullLine = false;
}
}
@@ -221,7 +222,7 @@
void Table::generateBottomLineBorder(QTextStream& out, int row)
{
Element* elt = 0;
- bool border[getMaxCol()];
+ QBitArray border(getMaxCol());
bool fullLine = true;
for(int index = 0; index <= getMaxCol(); index++)
@@ -232,11 +233,11 @@
/* If the element has a border display it here */
if(elt->hasBottomBorder())
{
- border[index] = true;
+ border[index] = 1;
}
else
{
- border[index] = false;
+ border[index] = 0;
fullLine = false;
}
}
@@ -256,7 +257,7 @@
{
int begin = index;
int end = index;
- while(border[index] == true && index <= getMaxCol())
+ while(border[index] && index <= getMaxCol())
{
index = index + 1;
}
Jeremy C. Reed
http://bsd.reedmedia.net/