[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-pim
Subject: [Kde-pim] filter_oe compile failure with older gcc
From: Adriaan de Groot <groot () kde ! org>
Date: 2005-06-20 21:54:38
Message-ID: 200506202354.38415.groot () kde ! org
[Download RAW message or body]
It's been reported before
( http://mail.kde.org/pipermail/kmail-devel/2005-April/017690.html ) that the
oe filter in kmailcvt doesn't compile with some gcc versions. The same
applies now to FreeBSD 4. I've hacked up a patch that might help by wrapping
QString[4] into a class with all the needed operators. Patch attached.
Side effect of the patch is to make it (more) compilable with QT_NO_CAST_ASCII
and replace comparisons with "" by calls to .isEmpty().
Look OK?
--
These are your friends - Adem
GPG: FEA2 A3FE Adriaan de Groot
["filter_oe.diff" (text/x-diff)]
Index: filter_oe.cxx
===================================================================
--- filter_oe.cxx (revision 427509)
+++ filter_oe.cxx (working copy)
@@ -392,20 +392,20 @@
{
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();
if(_tmpFileName == search) {
- folder.prepend( tmp[0] + "/");
+ folder.prepend( tmp[0] + QString::fromLatin1("/") );
search = tmp[3];
foundFilename = true;
}
@@ -413,18 +413,18 @@
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 {
- folder.prepend( tmp[0] + "/");
+ folder.prepend( tmp[0] + QString::fromLatin1("/") );
search = tmp[3];
}
}
}
}
// 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;
}
Index: filter_oe.hxx
===================================================================
--- filter_oe.hxx (revision 427509)
+++ filter_oe.hxx (working copy)
@@ -63,9 +63,63 @@
bool parsedFolder;
/** true if the current parsing file is the folder file */
bool currentIsFolderFile;
+
+ /** Glorified QString[4] for (a) understandability (b) older gcc
+ * compatibility, see for instance
+ * http://mail.kde.org/pipermail/kmail-devel/2005-April/017690.html
+ */
+ class FolderStructure
+ {
+ public:
+ typedef QString FourString[4];
+ /** Constructor. Need a default constructor for QValueList. */
+ FolderStructure() {} ;
+
+ /** Constructor. Turn four QStrings into a folder structure
+ * description.
+ */
+ FolderStructure(const FourString &s)
+ {
+ for(unsigned int i=0; i<4; i++) d[i]=s[i];
+ } ;
+
+ /** Copy Constructor. */
+ FolderStructure(const FolderStructure &s)
+ {
+ for(unsigned int i=0; i<4; i++) d[i]=s[i];
+ } ;
+
+ /** Assignment operator. Does the same thing as
+ * the copy constructor.
+ */
+ FolderStructure &operator =(const FolderStructure &s)
+ {
+ for(unsigned int i=0; i<4; 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<4) return d[i]; else return QString::null;
+ } ;
+
+ /** Access the different fields, for writing. */
+ QString &operator [](unsigned int i)
+ {
+ Q_ASSERT(i<4);
+ if (i<4) return d[i]; else return d[0];
+ } ;
+ private:
+ QString d[4];
+ } ;
/** 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;
/** name of the chosen folder */
_______________________________________________
kde-pim mailing list
kde-pim@kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic