| Summary: | filter_oe/filter_pmail compilation fails with gcc-3.2.x | ||
|---|---|---|---|
| Product: | [Unmaintained] kmail | Reporter: | Rex Dieter <rdieter> |
| Component: | kmailcvt | Assignee: | kdepim bugs <pim-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | mefoster |
| Priority: | NOR | ||
| Version First Reported In: | 1.8.2 | ||
| Target Milestone: | --- | ||
| Platform: | RedHat Enterprise Linux | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | naive/quick-n-dirty fix | ||
|
Description
Rex Dieter
2005-05-25 16:07:59 UTC
Created attachment 11195 [details]
naive/quick-n-dirty fix
replace
QString tmp[x] = *it
with
QString tmp[x];
tmp = *it;
Produces compiler warning: ISO C++ forbids assignment of arrays
But this fix don't work with newer compiler versions, on gcc 3.3.5 this is a error and not a warning. I never said it was a correct fix, just that it allowed the compilation to continue w/gcc-3.2.x. Do you have a better suggestion? I never said it was a correct fix, just that it allowed the compilation to continue w/gcc-3.2.x. Do you have a better suggestion? SVN commit 427876 by dkukawka: * Applying slightly adopted patches by Adriaan de Groot <groot@kde.org>, fixing bug #106274 * changed some code documetation BUG: 106274 M +7 -7 filter_oe.cxx M +10 -1 filter_oe.hxx M +2 -2 filter_pmail.cxx M +12 -2 filter_pmail.hxx M +52 -1 filters.hxx Nope, not fixed, using gcc-3.2.3, RedHat Enterprise 3: make[3]: Entering directory `/home/rdieter/BUILD/kdepim-3.4.2/kmailcvt' if g++ -DHAVE_CONFIG_H -I. -I. -I.. -I../libkdepim -I/usr/include/kde -I/usr/lib/qt-3.3/include -I/usr/X11R6/include -DQT_THREAD_SUPPORT -D_REENTRANT -D_FILE_OFFSET_BITS=64 -DNDEBUG -DNO_DEBUG -O2 -O2 -pipe -march=i386 -mcpu=i686 -fno-exceptions -fno-check-new -fno-common -DQT_CLEAN_NAMESPACE -DQT_NO_ASCII_CAST -DQT_NO_STL -DQT_NO_COMPAT -DQT_NO_TRANSLATION -MT kmailcvt.all_cxx.o -MD -MP -MF ".deps/kmailcvt.all_cxx.Tpo" \ -c -o kmailcvt.all_cxx.o `test -f 'kmailcvt.all_cxx.cxx' || echo './'`kmailcvt.all_cxx.cxx; \ then mv -f ".deps/kmailcvt.all_cxx.Tpo" ".deps/kmailcvt.all_cxx.Po"; \ else rm -f ".deps/kmailcvt.all_cxx.Tpo"; exit 1; \ fi In file included from kmailcvt.all_cxx.cxx:3: filter_oe.cxx: In member function `QString FilterOE::getFolderName(QString)': filter_oe.cxx:400: invalid initializer In file included from kmailcvt.all_cxx.cxx:4: filter_pmail.cxx: In member function `QString FilterPMail::getFolderName(QString)': filter_pmail.cxx:329: invalid initializer make[3]: *** [kmailcvt.all_cxx.o] Error 1 make[3]: Leaving directory `/home/rdieter/BUILD/kdepim-3.4.2/kmailcvt' o.k. I have forgotten to backport the patch to kde 3.4.2. Did you tried SVN_HEAD? Did this version works for you? I backport this tomorrow. I'm building kdepim-3.4.2 as released to packagers. SVN commit 438561 by dkukawka:
- backport from trunk to prevent failure with older gcc (< gcc 3.3)
BUG: 106274
M +5 -5 filter_oe.cxx
M +10 -1 filter_oe.hxx
M +2 -2 filter_pmail.cxx
M +12 -2 filter_pmail.hxx
M +52 -1 filters.hxx
--- branches/KDE/3.4/kdepim/kmailcvt/filter_oe.cxx #438560:438561
@@ -389,15 +389,15 @@
{
bool found = false;
bool foundFilename = false;
- QString folder = "";
+ QString folder;
// we must do this because folder with more than one upper letter
// at start have maybe not a file named like the folder !!!
QString search = filename.lower();
while (!found)
{
- for ( QValueList<QString[4]>::Iterator it = folderStructure.begin(); it != folderStructure.end(); it++) {
- QString tmp[4] = *it;
+ for ( FolderStructureIterator it = folderStructure.begin(); it != folderStructure.end(); it++) {
+ FolderStructure tmp = *it;
if(foundFilename == false) {
QString _tmpFileName = tmp[1];
_tmpFileName = _tmpFileName.lower();
@@ -410,7 +410,7 @@
QString _currentID = tmp[2];
QString _parentID = tmp[3];
if(_currentID == search) {
- if(_parentID == "") { // this is the root of the folder
+ if(_parentID.isEmpty()) { // this is the root of the folder
found = true;
break;
} else {
@@ -421,7 +421,7 @@
}
}
// need to break the while loop maybe in some cases
- if((foundFilename == false) && (folder == "")) return folder;
+ if((foundFilename == false) && (folder.isEmpty())) return folder;
}
return folder;
}
--- branches/KDE/3.4/kdepim/kmailcvt/filter_oe.hxx #438560:438561
@@ -61,8 +61,17 @@
bool parsedFolder;
/** true if the current parsing file is the folder file */
bool currentIsFolderFile;
+
+ /** Folder structure with following 4 entries:
+ 1. descriptive folder name
+ 2. filename
+ 3. ID of current folder
+ 4. ID of parent folder
+ */
+ typedef FolderStructureBase<4> FolderStructure;
/** matrix with information about the folder structure*/
- QValueList<QString[4]> folderStructure;
+ QValueList<FolderStructure> folderStructure;
+ typedef QValueList<FolderStructure>::Iterator FolderStructureIterator;
/** name of the current folder */
QString folderName;
--- branches/KDE/3.4/kdepim/kmailcvt/filter_pmail.cxx #438560:438561
@@ -325,8 +325,8 @@
while (!found)
{
- for ( QValueList<QString[5]>::Iterator it = folderMatrix.begin(); it != folderMatrix.end(); it++) {
- QString tmp[5] = *it;
+ for ( FolderStructureIterator it = folderMatrix.begin(); it != folderMatrix.end(); it++) {
+ FolderStructure tmp = *it;
QString _ID = tmp[2];
if(_ID == search) {
--- branches/KDE/3.4/kdepim/kmailcvt/filter_pmail.hxx #438560:438561
@@ -50,8 +50,18 @@
QDir dir;
/** pointer to the info */
FilterInfo * inf;
- /** QStringList with the foldernames, First String contains the ID, the second the folder */
- QValueList<QString[5]> folderMatrix;
+
+ /** Folder structure here has 5 entries. */
+ typedef FolderStructureBase<5> FolderStructure;
+ /** List with the folder matrix, which contains following strings:
+ 1. type (2 for root-folder, 1 for folder, 0 for mailarchiv)
+ 2. type (1 for root-folder, 3 for folder, 0 for mailarchiv)
+ 3. "ID:flag:filename" of folder/archiv
+ 4. "ID:name" of parent folder
+ 5. name of folder/archiv
+ */
+ QValueList<FolderStructure> folderMatrix;
+ typedef QValueList<FolderStructure>::Iterator FolderStructureIterator;
/** true, if the folderfile is parsed **/
bool folderParsed;
--- branches/KDE/3.4/kdepim/kmailcvt/filters.hxx #438560:438561
@@ -85,6 +85,57 @@
};
+
+/**
+* Glorified QString[N] for (a) understandability (b) older gcc compatibility.
+*/
+template <unsigned int size> class FolderStructureBase
+{
+public:
+ typedef QString NString[size];
+ /** Constructor. Need a default constructor for QValueList. */
+ FolderStructureBase() {} ;
+
+ /** Constructor. Turn N QStrings into a folder structure
+ * description.
+ */
+ FolderStructureBase(const NString &s)
+ {
+ for(unsigned int i=0; i<size; i++) d[i]=s[i];
+ } ;
+
+ /** Copy Constructor. */
+ FolderStructureBase(const FolderStructureBase &s)
+ {
+ for(unsigned int i=0; i<size; i++) d[i]=s[i];
+ } ;
+
+ /** Assignment operator. Does the same thing as
+ * the copy constructor.
+ */
+ FolderStructureBase &operator =(const FolderStructureBase &s)
+ {
+ for(unsigned int i=0; i<size; i++) d[i]=s[i];
+ return *this;
+ } ;
+
+ /** Access the different fields. There doesn't seem to
+ * be a real semantics for the fields.
+ */
+ const QString operator [](unsigned int i) const
+ {
+ if (i<size) return d[i]; else return QString::null;
+ } ;
+
+ /** Access the different fields, for writing. */
+ QString &operator [](unsigned int i)
+ {
+ Q_ASSERT(i<size);
+ if (i<size) return d[i]; else return d[0];
+ } ;
+private:
+ QString d[size];
+} ;
+
#endif
-// vim: ts=2 sw=2 et
please try to compile with this patch from branches/KDE/3.4/kdepim/kmailcvt/ Verified patch to be mmm, mmm good. Thanks. |