Version: 2.4.7 (using KDE KDE 3.5.7) Installed from: Fedora RPMs Compiler: Fedora default compiler (application is from Fedora RPMs) OS: Linux When browsing CVS repository several warnings are printed to log: QDate::setYMD: Invalid date 2007-05-00 QDate::setYMD: Invalid date 2007-05-00 QDate::setYMD: Invalid date 2007-03-00 QDate::setYMD: Invalid date 2007-07-00 QDate::setYMD: Invalid date 2007-04-00 QDate::setYMD: Invalid date 2007-04-00 ... Seems that the date is parsed incorrectly. Actual dates are like: -rwxr-xr-x 1 x x 624 2007-07-24 12:12 a drwxrwxr-x 3 x x 4096 2007-07-24 12:14 b -rw-rw-r-- 1 x x 756 2007-05-14 09:23 c -rw-rw-r-- 1 x x 1163 2007-04-23 12:01 d -rw-rw-r-- 1 x x 229 2007-04-23 12:01 e -rw-rw-r-- 1 x x 868 2007-05-08 15:59 f The CVS/Entries also looks ok: /F1/1.9/Mon Apr 23 10:01:13 2007// /F2/1.3/Mon Apr 23 10:01:13 2007// /F3/1.6/Mon Apr 23 10:01:13 2007// /F4/1.4/Mon May 14 07:23:51 2007// /F5/1.6/Tue May 8 13:59:46 2007// /F6/1.24/Mon Jun 25 08:38:17 2007//
SVN commit 711210 by mkoller: BUG: 148162 Qt-3.3.8 changed the parsing in QDateTime::fromString() but introduced a bug which leads to the problem that days with 1 digit will incorrectly being parsed as day 0 - which is invalid. workaround with the implementation from Qt-3.3.6 M +51 -1 updateview_items.cpp --- branches/KDE/3.5/kdesdk/cervisia/updateview_items.cpp #711209:711210 @@ -24,6 +24,7 @@ #include <qdir.h> #include <qpainter.h> +#include <qregexp.h> #include <kdebug.h> #include <kglobalsettings.h> @@ -246,7 +247,54 @@ return (it != m_itemsByName.end()) ? *it : 0; } +// Qt-3.3.8 changed the parsing in QDateTime::fromString() but introduced +// a bug which leads to the problem that days with 1 digit will incorrectly being +// parsed as day 0 - which is invalid. +// workaround with the implementation from Qt-3.3.6 +QDateTime parseDateTime(const QString &s) +{ + static const char * const qt_shortMonthNames[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; + QString monthName( s.mid( 4, 3 ) ); + int month = -1; + // Assume that English monthnames are the default + for ( int i = 0; i < 12; ++i ) { + if ( monthName == qt_shortMonthNames[i] ) { + month = i + 1; + break; + } + } + // If English names can't be found, search the localized ones + if ( month == -1 ) { + for ( int i = 1; i <= 12; ++i ) { + if ( monthName == QDate::shortMonthName( i ) ) { + month = i; + break; + } + } + } + if ( month < 1 || month > 12 ) { + qWarning( "QDateTime::fromString: Parameter out of range" ); + QDateTime dt; + return dt; + } + int day = s.mid( 8, 2 ).simplifyWhiteSpace().toInt(); + int year = s.right( 4 ).toInt(); + QDate date( year, month, day ); + QTime time; + int hour, minute, second; + int pivot = s.find( QRegExp(QString::fromLatin1("[0-9][0-9]:[0-9][0-9]:[0-9][0-9]")) ); + if ( pivot != -1 ) { + hour = s.mid( pivot, 2 ).toInt(); + minute = s.mid( pivot+3, 2 ).toInt(); + second = s.mid( pivot+6, 2 ).toInt(); + time.setHMS( hour, minute, second ); + } + return QDateTime( date, time ); +} + // Format of the CVS/Entries file: // /NAME/REVISION/[CONFLICT+]TIMESTAMP/OPTIONS/TAGDATE @@ -304,7 +352,9 @@ } else { - const QDateTime date(QDateTime::fromString(timestamp)); // UTC Time + // workaround Qt-3.3.8 bug with our own function (see function above) + // const QDateTime date(QDateTime::fromString(timestamp)); // UTC Time + const QDateTime date(parseDateTime(timestamp)); // UTC Time QDateTime fileDateUTC; fileDateUTC.setTime_t(entry.m_dateTime.toTime_t(), Qt::UTC); if (date != fileDateUTC)