From a788f7e3a04ec741d59ef458a40e39d918dc1df0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 1 Feb 2010 10:28:00 +0100 Subject: Designer/uic/related examples: Fix source code scanning issues II. Fix spelling errors, foreach()/QString usage, explicit constructors. Reviewed-By: Joerg Bornemann --- examples/designer/taskmenuextension/tictactoedialog.h | 2 +- examples/uitools/textfinder/textfinder.cpp | 2 +- src/tools/uic/cpp/cppwriteinitialization.cpp | 6 +++--- src/tools/uic3/converter.cpp | 6 +++--- src/tools/uic3/main.cpp | 4 ++-- tools/designer/src/designer/qdesigner_server.h | 2 +- tools/designer/src/designer/versiondialog.cpp | 5 ++--- tools/designer/src/lib/shared/qdesigner_taskmenu.cpp | 2 +- tools/designer/src/plugins/widgets/q3table/q3table_plugin.h | 2 +- tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h | 2 +- tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h | 6 +++--- .../src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h | 2 +- tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h | 2 +- tools/shared/findwidget/abstractfindwidget.h | 2 +- tools/shared/findwidget/itemviewfindwidget.h | 2 +- 15 files changed, 23 insertions(+), 24 deletions(-) diff --git a/examples/designer/taskmenuextension/tictactoedialog.h b/examples/designer/taskmenuextension/tictactoedialog.h index aeaaaf4..3d810dd 100644 --- a/examples/designer/taskmenuextension/tictactoedialog.h +++ b/examples/designer/taskmenuextension/tictactoedialog.h @@ -55,7 +55,7 @@ class TicTacToeDialog : public QDialog Q_OBJECT public: - TicTacToeDialog(TicTacToe *plugin = 0, QWidget *parent = 0); + explicit TicTacToeDialog(TicTacToe *plugin = 0, QWidget *parent = 0); QSize sizeHint() const; diff --git a/examples/uitools/textfinder/textfinder.cpp b/examples/uitools/textfinder/textfinder.cpp index 855f11f..1b7c14b 100644 --- a/examples/uitools/textfinder/textfinder.cpp +++ b/examples/uitools/textfinder/textfinder.cpp @@ -116,7 +116,7 @@ void TextFinder::on_findButton_clicked() if (isFirstTime == false) document->undo(); - if (searchString == "") { + if (searchString.isEmpty()) { QMessageBox::information(this, tr("Empty Search Field"), "The search field is empty. Please enter a word and click Find."); } else { diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index d9aff1b..8099ffa 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -2787,8 +2787,8 @@ static void generateMultiDirectiveBegin(QTextStream &outputStream, const QSet map; // bool is dummy. The idea is to sort that (always generate in the same order) by putting a set into a map - foreach (QString str, directives) - map[str] = true; + foreach (const QString &str, directives) + map.insert(str, true); if (map.size() == 1) { outputStream << "#ifndef " << map.constBegin().key() << endl; @@ -2797,7 +2797,7 @@ static void generateMultiDirectiveBegin(QTextStream &outputStream, const QSet *prop if (prop->kind() == DomProperty::Set) { QStringList flags = prop->elementSet().split(QLatin1Char('|')); QStringList v; - foreach (QString fl, flags) { + foreach (const QString &fl, flags) { QString e = WidgetInfo::resolveEnumerator(className, fl); if (e.isEmpty()) { e = m_porting->renameEnumerator(className + QLatin1String("::") + fl); @@ -1283,7 +1283,7 @@ QString Ui3Reader::fixType(const QString &t) const QString newText = t; //split type name on <>*& and whitespace QStringList typeNames = t.split(QRegExp(QLatin1String("<|>|\\*|&| ")), QString::SkipEmptyParts); - foreach(QString typeName , typeNames) { + foreach(const QString &typeName , typeNames) { QString newName = fixClassName(typeName); if( newName != typeName ) { newText.replace(typeName, newName); diff --git a/src/tools/uic3/main.cpp b/src/tools/uic3/main.cpp index 6acc94f..1ebb76a 100644 --- a/src/tools/uic3/main.cpp +++ b/src/tools/uic3/main.cpp @@ -338,10 +338,10 @@ int runUic3(int argc, char * argv[]) QStringList globalIncludes, localIncludes; ui3.computeDeps(e, globalIncludes, localIncludes, impl); - foreach (QString i, globalIncludes) + foreach (const QString &i, globalIncludes) printf("%s\n", i.toLatin1().constData()); - foreach (QString i, localIncludes) + foreach (const QString &i, localIncludes) printf("%s\n", i.toLatin1().constData()); if (impl) diff --git a/tools/designer/src/designer/qdesigner_server.h b/tools/designer/src/designer/qdesigner_server.h index d522056..90cc624 100644 --- a/tools/designer/src/designer/qdesigner_server.h +++ b/tools/designer/src/designer/qdesigner_server.h @@ -74,7 +74,7 @@ class QDesignerClient: public QObject { Q_OBJECT public: - QDesignerClient(quint16 port, QObject *parent = 0); + explicit QDesignerClient(quint16 port, QObject *parent = 0); virtual ~QDesignerClient(); private slots: diff --git a/tools/designer/src/designer/versiondialog.cpp b/tools/designer/src/designer/versiondialog.cpp index 51f546d..d9b03aa 100644 --- a/tools/designer/src/designer/versiondialog.cpp +++ b/tools/designer/src/designer/versiondialog.cpp @@ -113,15 +113,14 @@ void VersionLabel::mouseReleaseEvent(QMouseEvent *me) if (!secondStage) { m_path.lineTo(me->pos()); bool gotIt = true; - QPoint pt; - foreach(pt, hitPoints) { + foreach(const QPoint &pt, hitPoints) { if (!m_path.contains(pt)) { gotIt = false; break; } } if (gotIt) { - foreach(pt, missPoints) { + foreach(const QPoint &pt, missPoints) { if (m_path.contains(pt)) { gotIt = false; break; diff --git a/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp b/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp index 608ecd7..cd95f5b 100644 --- a/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp +++ b/tools/designer/src/lib/shared/qdesigner_taskmenu.cpp @@ -675,7 +675,7 @@ void QDesignerTaskMenu::navigateToSlot(QDesignerFormEditorInterface *core, const QString signalSignature = selectedItem->text(0); const QStringList parameterNames = qVariantValue(selectedItem->data(0, Qt::UserRole)); - // TODO: Check wether signal is connected to slot + // TODO: Check whether signal is connected to slot integr->emitNavigateToSlot(objectName, signalSignature, parameterNames); } } diff --git a/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h b/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h index 9c02467..0df5e0a 100644 --- a/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h +++ b/tools/designer/src/plugins/widgets/q3table/q3table_plugin.h @@ -51,7 +51,7 @@ class Q3TablePlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3TablePlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3TablePlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h index 3b47f74..3a2ffe0 100644 --- a/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h +++ b/tools/designer/src/plugins/widgets/q3toolbar/q3toolbar_plugin.h @@ -51,7 +51,7 @@ class Q3ToolBarPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3ToolBarPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3ToolBarPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h index c750cfe..f4695de 100644 --- a/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h +++ b/tools/designer/src/plugins/widgets/q3widgets/q3widget_plugins.h @@ -133,7 +133,7 @@ class Q3DateTimeEditPlugin: public QObject, public QDesignerCustomWidgetInterfac Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3DateTimeEditPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3DateTimeEditPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; @@ -186,7 +186,7 @@ class Q3GroupBoxPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3GroupBoxPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3GroupBoxPlugin(const QIcon &icon, QObject *parent = 0); virtual ~Q3GroupBoxPlugin(); virtual QString name() const; @@ -239,7 +239,7 @@ class Q3TextBrowserPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3TextBrowserPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3TextBrowserPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h index 56dd7fb..d61b4a1 100644 --- a/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h +++ b/tools/designer/src/plugins/widgets/q3widgetstack/q3widgetstack_plugin.h @@ -51,7 +51,7 @@ class Q3WidgetStackPlugin: public QObject, public QDesignerCustomWidgetInterface Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: - Q3WidgetStackPlugin(const QIcon &icon, QObject *parent = 0); + explicit Q3WidgetStackPlugin(const QIcon &icon, QObject *parent = 0); virtual QString name() const; virtual QString group() const; diff --git a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h index e8cf4fa..f96ba74 100644 --- a/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h +++ b/tools/designer/src/plugins/widgets/q3wizard/q3wizard_container.h @@ -71,7 +71,7 @@ class Q3WizardExtraInfo: public QObject, public QDesignerExtraInfoExtension Q_OBJECT Q_INTERFACES(QDesignerExtraInfoExtension) public: - Q3WizardExtraInfo(Q3Wizard *wizard, QDesignerFormEditorInterface *core, QObject *parent); + explicit Q3WizardExtraInfo(Q3Wizard *wizard, QDesignerFormEditorInterface *core, QObject *parent); virtual QWidget *widget() const; virtual Q3Wizard *wizard() const; diff --git a/tools/shared/findwidget/abstractfindwidget.h b/tools/shared/findwidget/abstractfindwidget.h index 6cc7c94..089947d 100644 --- a/tools/shared/findwidget/abstractfindwidget.h +++ b/tools/shared/findwidget/abstractfindwidget.h @@ -70,7 +70,7 @@ public: }; Q_DECLARE_FLAGS(FindFlags, FindFlag) - AbstractFindWidget(FindFlags flags = FindFlags(), QWidget *parent = 0); + explicit AbstractFindWidget(FindFlags flags = FindFlags(), QWidget *parent = 0); virtual ~AbstractFindWidget(); bool eventFilter(QObject *object, QEvent *e); diff --git a/tools/shared/findwidget/itemviewfindwidget.h b/tools/shared/findwidget/itemviewfindwidget.h index 9d63d62..2d06df8 100644 --- a/tools/shared/findwidget/itemviewfindwidget.h +++ b/tools/shared/findwidget/itemviewfindwidget.h @@ -55,7 +55,7 @@ class ItemViewFindWidget : public AbstractFindWidget Q_OBJECT public: - ItemViewFindWidget(FindFlags flags = FindFlags(), QWidget *parent = 0); + explicit ItemViewFindWidget(FindFlags flags = FindFlags(), QWidget *parent = 0); QAbstractItemView *itemView() const { return m_itemView; } -- cgit v0.12 From c830656616977d417972e2497ff3135bc562a660 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 28 Jan 2010 21:32:20 +0100 Subject: optimize qhash() on any modern architecture, an 1 out of 16 times needlessly executed shift (even if a long one) and xor are less expensive than a pretty much randomly 1 out of 16 times differently taken conditional jump. so simply remove the conditional. ~15% faster on Core2. Reviewed-by: joao --- src/corelib/tools/qhash.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index d758325..6231471 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -68,8 +68,8 @@ static uint hash(const uchar *p, int n) while (n--) { h = (h << 4) + *p++; - if ((g = (h & 0xf0000000)) != 0) - h ^= g >> 23; + g = h & 0xf0000000; + h ^= g >> 23; h &= ~g; } return h; @@ -82,8 +82,8 @@ static uint hash(const QChar *p, int n) while (n--) { h = (h << 4) + (*p++).unicode(); - if ((g = (h & 0xf0000000)) != 0) - h ^= g >> 23; + g = h & 0xf0000000; + h ^= g >> 23; h &= ~g; } return h; -- cgit v0.12 From 0d772fe5d362861c0b59374a25ec4d0e0ba05181 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 28 Jan 2010 17:38:17 +0100 Subject: micro-optimization move up the headerdone setting, so the compiler can do tail-merging of the branches --- src/corelib/codecs/qutfcodec.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index f7d3b06..f88fa8d 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -326,6 +326,7 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert ch.setCell(*chars++); } if (!headerdone) { + headerdone = true; if (endian == DetectEndianness) { if (ch == QChar::ByteOrderSwapped && endian != BigEndianness) { endian = LittleEndianness; @@ -344,7 +345,6 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert } else if (ch != QChar::ByteOrderMark) { *qch++ = ch; } - headerdone = true; } else { *qch++ = ch; } -- cgit v0.12 From 3c0370bd3d0ee83b84ea7c1cc579be51768df183 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 28 Jan 2010 17:41:13 +0100 Subject: remove pointless conditionals we already know that (endian == DetectEndianness) - we tested it 1 resp 3 lines above ... Reviewed-By: denis --- src/corelib/codecs/qutfcodec.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp index f88fa8d..7655c51 100644 --- a/src/corelib/codecs/qutfcodec.cpp +++ b/src/corelib/codecs/qutfcodec.cpp @@ -328,10 +328,9 @@ QString QUtf16::convertToUnicode(const char *chars, int len, QTextCodec::Convert if (!headerdone) { headerdone = true; if (endian == DetectEndianness) { - if (ch == QChar::ByteOrderSwapped && endian != BigEndianness) { + if (ch == QChar::ByteOrderSwapped) { endian = LittleEndianness; - } else if (ch == QChar::ByteOrderMark && endian != LittleEndianness) { - // ignore BOM + } else if (ch == QChar::ByteOrderMark) { endian = BigEndianness; } else { if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { -- cgit v0.12 From 984689f01ce31cade5452633dd43f676bdb75b73 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 28 Jan 2010 18:01:47 +0100 Subject: remove duplicated calculation of length --- src/corelib/tools/qlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qlist.cpp b/src/corelib/tools/qlist.cpp index f1df9bd..c302857 100644 --- a/src/corelib/tools/qlist.cpp +++ b/src/corelib/tools/qlist.cpp @@ -208,7 +208,7 @@ void **QListData::append2(const QListData& l) int n = l.d->end - l.d->begin; if (n) { if (e + n > d->alloc) - realloc(grow(e + l.d->end - l.d->begin)); + realloc(grow(e + n)); d->end += n; } return d->array + e; -- cgit v0.12 From 45591e13862963fb29c13e0c5bfe39330883c579 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 29 Jan 2010 13:07:28 +0100 Subject: document QString::fromUtf16() slowness --- src/corelib/tools/qstring.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index b9dd4d1..44e4d16 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -3857,6 +3857,12 @@ QString QString::fromUtf8(const char *str, int size) If \a size is -1 (default), \a unicode must be terminated with a 0. + This function checks for a Byte Order Mark (BOM). If it is missing, + host byte order is assumed. + + This function is comparatively slow. + Use QString(const ushort *, int) if possible. + QString makes a deep copy of the Unicode data. \sa utf16(), setUtf16() @@ -3923,6 +3929,9 @@ QString& QString::setUnicode(const QChar *unicode, int size) If \a unicode is 0, nothing is copied, but the string is still resized to \a size. + Note that unlike fromUtf16(), this function does not consider BOMs and + possibly differing byte ordering. + \sa utf16(), setUnicode() */ @@ -4669,6 +4678,8 @@ int QString::localeAwareCompare_helper(const QChar *data1, int length1, Returns the QString as a '\\0\'-terminated array of unsigned shorts. The result remains valid until the string is modified. + The returned string is in host byte order. + \sa unicode() */ -- cgit v0.12 From e0fda52fde32458c4a42f04bd62b5e37f14c4bfd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 29 Jan 2010 16:44:12 +0100 Subject: optimization: get rid of QString::fromUtf16() usage QString::fromUtf16() is slow - it does a BOM check and optionally byte swapping, which is utterly pointless when converting internal data structures which are raw utf16 in host byte order anyway. so replace it with QString::fromRawData() (for short-lived strings) or QString(const QChar *, int) (otherwise) if possible. Reviewed-by: axis Reviewed-by: mariusSO Reviewed-by: Bill King --- examples/network/qftp/sym_iap_util.h | 2 +- src/corelib/io/qprocess_unix.cpp | 2 +- src/corelib/kernel/qcore_symbian_p.cpp | 2 +- src/corelib/kernel/qcoreapplication.cpp | 3 ++- src/corelib/kernel/qtranslator.cpp | 2 +- src/corelib/tools/qstring.cpp | 4 ++-- src/gui/itemviews/qitemdelegate.cpp | 2 +- src/gui/kernel/qclipboard_s60.cpp | 3 ++- src/gui/kernel/qdnd_x11.cpp | 2 +- src/gui/kernel/qmime_mac.cpp | 4 ++-- src/sql/drivers/sqlite/qsql_sqlite.cpp | 4 ++-- src/sql/kernel/qsqlresult.cpp | 2 +- tools/linguist/shared/qm.cpp | 2 +- 13 files changed, 18 insertions(+), 16 deletions(-) diff --git a/examples/network/qftp/sym_iap_util.h b/examples/network/qftp/sym_iap_util.h index 8079d2c..41e43a9 100644 --- a/examples/network/qftp/sym_iap_util.h +++ b/examples/network/qftp/sym_iap_util.h @@ -298,7 +298,7 @@ QString qt_TDesC2QStringL(const TDesC& aDescriptor) #ifdef QT_NO_UNICODE return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length()); #else - return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length()); + return QString((const QChar *)aDescriptor.Ptr(), aDescriptor.Length()); #endif } diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 0bf7d3f..5119ec0 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -783,7 +783,7 @@ bool QProcessPrivate::processStarted() // did we read an error message? if (i > 0) - q_func()->setErrorString(QString::fromUtf16(buf, i / sizeof(QChar))); + q_func()->setErrorString(QString((const QChar *)buf, i / sizeof(QChar))); return i <= 0; } diff --git a/src/corelib/kernel/qcore_symbian_p.cpp b/src/corelib/kernel/qcore_symbian_p.cpp index 5d2a6a5..0257ac4 100644 --- a/src/corelib/kernel/qcore_symbian_p.cpp +++ b/src/corelib/kernel/qcore_symbian_p.cpp @@ -71,7 +71,7 @@ Q_CORE_EXPORT QString qt_TDesC2QString(const TDesC& aDescriptor) #ifdef QT_NO_UNICODE return QString::fromLocal8Bit(aDescriptor.Ptr(), aDescriptor.Length()); #else - return QString::fromUtf16(aDescriptor.Ptr(), aDescriptor.Length()); + return QString(reinterpret_cast(aDescriptor.Ptr()), aDescriptor.Length()); #endif } diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 005dedc..5c65416 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2219,7 +2219,8 @@ QStringList QCoreApplication::libraryPaths() TFindFile finder(fs); TInt err = finder.FindByDir(tempPathPtr, tempPathPtr); while (err == KErrNone) { - QString foundDir = QString::fromUtf16(finder.File().Ptr(), finder.File().Length()); + QString foundDir(reinterpret_cast(finder.File().Ptr()), + finder.File().Length()); foundDir = QDir(foundDir).canonicalPath(); if (!app_libpaths->contains(foundDir)) app_libpaths->append(foundDir); diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index b7e6ea0..7d1e1d3 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -633,7 +633,7 @@ static QString getMessage(const uchar *m, const uchar *end, const char *context, end: if (!tn) return QString(); - QString str = QString::fromUtf16((const ushort *)tn, tn_length/2); + QString str = QString((const QChar *)tn, tn_length/2); if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) { for (int i = 0; i < str.length(); ++i) str[i] = QChar((str.at(i).unicode() >> 8) + ((str.at(i).unicode() << 8) & 0xff00)); diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 44e4d16..3388500 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -885,7 +885,7 @@ int QString::grow(int size) QString QString::fromWCharArray(const wchar_t *string, int size) { if (sizeof(wchar_t) == sizeof(QChar)) { - return fromUtf16((ushort *)string, size); + return QString((const QChar *)string, size); } else { return fromUcs4((uint *)string, size); } @@ -7751,7 +7751,7 @@ QString QStringRef::toString() const { return QString(); if (m_size && m_position == 0 && m_size == m_string->size()) return *m_string; - return QString::fromUtf16(reinterpret_cast(m_string->unicode() + m_position), m_size); + return QString(m_string->unicode() + m_position, m_size); } diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index 6fd26a7..9069ce4 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -1033,7 +1033,7 @@ static QString qPixmapSerial(quint64 i, bool enabled) i >>= 4; } - return QString::fromUtf16(ptr, int(&arr[sizeof(arr) / sizeof(ushort)] - ptr)); + return QString((const QChar *)ptr, int(&arr[sizeof(arr) / sizeof(ushort)] - ptr)); } /*! diff --git a/src/gui/kernel/qclipboard_s60.cpp b/src/gui/kernel/qclipboard_s60.cpp index 71c355b..f07e066 100644 --- a/src/gui/kernel/qclipboard_s60.cpp +++ b/src/gui/kernel/qclipboard_s60.cpp @@ -164,7 +164,8 @@ void readFromStreamLX(QMimeData* aData,RReadStream& aStream) TCardinality mimeTypeSize; aStream >> mimeTypeSize; HBufC* mimeTypeBuf = HBufC::NewLC(aStream,mimeTypeSize); - QString mimeType = QString::fromUtf16(mimeTypeBuf->Des().Ptr(),mimeTypeBuf->Length()); + QString mimeType = QString(reinterpret_cast(mimeTypeBuf->Des().Ptr()), + mimeTypeBuf->Length()); CleanupStack::PopAndDestroy(mimeTypeBuf); // mime data TCardinality dataSize; diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index edab6a0..33968bd 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -617,7 +617,7 @@ QVariant QX11Data::xdndMimeConvertToFormat(Atom a, const QByteArray &data, const // so it should be safe to check that the second char is 0 // to verify that it is utf16 if (data.size() > 1 && data.at(1) == 0) - return QString::fromUtf16(reinterpret_cast(data.constData()), + return QString::fromRawData((const QChar *)data.constData(), data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); } } diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp index 0431f2f..071f80d 100644 --- a/src/gui/kernel/qmime_mac.cpp +++ b/src/gui/kernel/qmime_mac.cpp @@ -431,8 +431,8 @@ QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, Q firstData.size(), CFStringGetSystemEncoding(), false)); ret = QString(str); } else if (flavor == QLatin1String("public.utf16-plain-text")) { - ret = QString::fromUtf16(reinterpret_cast(firstData.constData()), - firstData.size() / sizeof(ushort)); + ret = QString(reinterpret_cast(firstData.constData()), + firstData.size() / sizeof(QChar)); } else { qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype)); } diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp index 9dbefaf..9fff552 100644 --- a/src/sql/drivers/sqlite/qsql_sqlite.cpp +++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp @@ -245,9 +245,9 @@ bool QSQLiteResultPrivate::fetchNext(QSqlCachedResult::ValueCache &values, int i values[i + idx] = QVariant(QVariant::String); break; default: - values[i + idx] = QString::fromUtf16(static_cast( + values[i + idx] = QString(reinterpret_cast( sqlite3_column_text16(stmt, i)), - sqlite3_column_bytes16(stmt, i) / sizeof(ushort)); + sqlite3_column_bytes16(stmt, i) / sizeof(QChar)); break; } } diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 5f12b55..3d63f88 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -136,7 +136,7 @@ static QString qFieldSerial(int i) i >>= 4; } - return QString::fromUtf16(arr, int(ptr - arr) + 1); + return QString(reinterpret_cast(arr), int(ptr - arr) + 1); } static bool qIsAlnum(QChar ch) diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 8118576..de1284f 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -594,7 +594,7 @@ bool loadQM(Translator &translator, QIODevice &dev, ConversionData &cd) return false; } m += 4; - QString str = QString::fromUtf16((const ushort *)m, len/2); + QString str = QString((const QChar *)m, len/2); if (QSysInfo::ByteOrder == QSysInfo::LittleEndian) { for (int i = 0; i < str.length(); ++i) str[i] = QChar((str.at(i).unicode() >> 8) + -- cgit v0.12 From ff8e8af2c16362ab0bbf7ea14bcdd83b711ebd46 Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 1 Feb 2010 17:41:13 +0100 Subject: Assistant: Use const references in foreach loops. Reviewed-by: kh1 --- examples/assistant/simpletextviewer/findfiledialog.cpp | 4 ++-- tools/assistant/lib/qhelpcollectionhandler.cpp | 10 +++++----- tools/assistant/lib/qhelpcontentwidget.cpp | 2 +- tools/assistant/lib/qhelpdbreader.cpp | 6 +++--- tools/assistant/lib/qhelpenginecore.cpp | 6 +++--- tools/assistant/lib/qhelpgenerator.cpp | 16 ++++++++-------- tools/assistant/lib/qhelpindexwidget.cpp | 8 ++++---- tools/assistant/lib/qhelpsearchindexreader_default.cpp | 16 ++++++++-------- tools/assistant/lib/qhelpsearchindexwriter_default.cpp | 10 +++++----- tools/assistant/lib/qhelpsearchquerywidget.cpp | 12 ++++++------ tools/assistant/lib/qhelpsearchresultwidget.cpp | 4 ++-- tools/assistant/tools/assistant/centralwidget.cpp | 2 +- 12 files changed, 48 insertions(+), 48 deletions(-) diff --git a/examples/assistant/simpletextviewer/findfiledialog.cpp b/examples/assistant/simpletextviewer/findfiledialog.cpp index 939d90a..0f7bbae 100644 --- a/examples/assistant/simpletextviewer/findfiledialog.cpp +++ b/examples/assistant/simpletextviewer/findfiledialog.cpp @@ -119,7 +119,7 @@ void FindFileDialog::update() void FindFileDialog::findFiles() { - QRegExp filePattern(fileNameComboBox->currentText() + "*"); + QRegExp filePattern(fileNameComboBox->currentText() + '*'); filePattern.setPatternSyntax(QRegExp::Wildcard); QDir directory(directoryComboBox->currentText()); @@ -127,7 +127,7 @@ void FindFileDialog::findFiles() QStringList allFiles = directory.entryList(QDir::Files | QDir::NoSymLinks); QStringList matchingFiles; - foreach (QString file, allFiles) { + foreach (const QString &file, allFiles) { if (filePattern.exactMatch(file)) matchingFiles << file; } diff --git a/tools/assistant/lib/qhelpcollectionhandler.cpp b/tools/assistant/lib/qhelpcollectionhandler.cpp index fe0c417..cb7e457 100644 --- a/tools/assistant/lib/qhelpcollectionhandler.cpp +++ b/tools/assistant/lib/qhelpcollectionhandler.cpp @@ -252,7 +252,7 @@ bool QHelpCollectionHandler::createTables(QSqlQuery *query) "Key TEXT PRIMARY KEY, " "Value BLOB )"); - foreach (QString q, tables) { + foreach (const QString &q, tables) { if (!query->exec(q)) return false; } @@ -323,7 +323,7 @@ bool QHelpCollectionHandler::addCustomFilter(const QString &filterName, idsToInsert.removeAll(m_query.value(1).toString()); } - foreach (QString id, idsToInsert) { + foreach (const QString &id, idsToInsert) { m_query.prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)")); m_query.bindValue(0, id); m_query.exec(); @@ -346,7 +346,7 @@ bool QHelpCollectionHandler::addCustomFilter(const QString &filterName, m_query.bindValue(0, nameId); m_query.exec(); - foreach (QString att, attributes) { + foreach (const QString &att, attributes) { m_query.prepare(QLatin1String("INSERT INTO FilterTable VALUES(?, ?)")); m_query.bindValue(0, nameId); m_query.bindValue(1, attributeMap[att]); @@ -400,7 +400,7 @@ bool QHelpCollectionHandler::registerDocumentation(const QString &fileName) return false; addFilterAttributes(reader.filterAttributes()); - foreach (QString filterName, reader.customFilters()) + foreach (const QString &filterName, reader.customFilters()) addCustomFilter(filterName, reader.filterAttributes(filterName)); optimizeDatabase(fileName); @@ -499,7 +499,7 @@ bool QHelpCollectionHandler::addFilterAttributes(const QStringList &attributes) while (m_query.next()) atts.insert(m_query.value(0).toString()); - foreach (QString s, attributes) { + foreach (const QString &s, attributes) { if (!atts.contains(s)) { m_query.prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)")); m_query.bindValue(0, s); diff --git a/tools/assistant/lib/qhelpcontentwidget.cpp b/tools/assistant/lib/qhelpcontentwidget.cpp index 3986afb..a80dc39 100644 --- a/tools/assistant/lib/qhelpcontentwidget.cpp +++ b/tools/assistant/lib/qhelpcontentwidget.cpp @@ -253,7 +253,7 @@ void QHelpContentProvider::run() const QStringList fileNames = m_helpEngine->orderedFileNameList; m_mutex.unlock(); - foreach (QString dbFileName, fileNames) { + foreach (const QString &dbFileName, fileNames) { m_mutex.lock(); if (m_abort) { m_abort = false; diff --git a/tools/assistant/lib/qhelpdbreader.cpp b/tools/assistant/lib/qhelpdbreader.cpp index 904124b..6dd949a 100644 --- a/tools/assistant/lib/qhelpdbreader.cpp +++ b/tools/assistant/lib/qhelpdbreader.cpp @@ -515,7 +515,7 @@ QVariant QHelpDBReader::metaData(const QString &name) const QString QHelpDBReader::mergeList(const QStringList &list) const { QString str; - foreach (QString s, list) + foreach (const QString &s, list) str.append(QLatin1Char('\'') + quote(s) + QLatin1String("\', ")); if (str.endsWith(QLatin1String(", "))) str = str.left(str.length()-2); @@ -567,14 +567,14 @@ bool QHelpDBReader::createAttributesCache(const QStringList &attributes, bool needUpdate = !m_viewAttributes.count(); - foreach (QString s, attributes) + foreach (const QString &s, attributes) m_viewAttributes.remove(s); if (m_viewAttributes.count() || needUpdate) { m_viewAttributes.clear(); m_indicesCache = indexIds; } - foreach (QString s, attributes) + foreach (const QString &s, attributes) m_viewAttributes.insert(s); m_useAttributesCache = true; return true; diff --git a/tools/assistant/lib/qhelpenginecore.cpp b/tools/assistant/lib/qhelpenginecore.cpp index 0911d59..b651aa3 100644 --- a/tools/assistant/lib/qhelpenginecore.cpp +++ b/tools/assistant/lib/qhelpenginecore.cpp @@ -362,7 +362,7 @@ QString QHelpEngineCore::documentationFileName(const QString &namespaceName) if (d->setup()) { const QHelpCollectionHandler::DocInfoList docList = d->collectionHandler->registeredDocumentations(); - foreach(const QHelpCollectionHandler::DocInfo info, docList) { + foreach(const QHelpCollectionHandler::DocInfo &info, docList) { if (info.namespaceName == namespaceName) { if (QDir::isAbsolutePath(info.fileName)) return QDir::cleanPath(info.fileName); @@ -386,7 +386,7 @@ QStringList QHelpEngineCore::registeredDocumentations() const if (!d->setup()) return list; const QHelpCollectionHandler::DocInfoList docList = d->collectionHandler->registeredDocumentations(); - foreach(const QHelpCollectionHandler::DocInfo info, docList) { + foreach(const QHelpCollectionHandler::DocInfo &info, docList) { list.append(info.namespaceName); } return list; @@ -531,7 +531,7 @@ QList QHelpEngineCore::files(const QString namespaceName, url.setAuthority(namespaceName); const QStringList files = reader->files(filterAttributes, extensionFilter); - foreach (const QString file, files) { + foreach (const QString &file, files) { url.setPath(QLatin1String("/") + file); res.append(url); } diff --git a/tools/assistant/lib/qhelpgenerator.cpp b/tools/assistant/lib/qhelpgenerator.cpp index 324f67d..4b94ebf 100644 --- a/tools/assistant/lib/qhelpgenerator.cpp +++ b/tools/assistant/lib/qhelpgenerator.cpp @@ -203,7 +203,7 @@ bool QHelpGenerator::generate(QHelpDataInterface *helpData, addProgress(1.0); emit statusChanged(tr("Insert custom filters...")); - foreach (QHelpDataCustomFilter f, helpData->customFilters()) { + foreach (const QHelpDataCustomFilter &f, helpData->customFilters()) { if (!registerCustomFilter(f.name, f.filterAttributes, true)) { cleanupDB(); return false; @@ -367,7 +367,7 @@ bool QHelpGenerator::createTables() "Name Text, " "Value BLOB )"); - foreach (QString q, tables) { + foreach (const QString &q, tables) { if (!d->query->exec(q)) { d->error = tr("Cannot create tables!"); return false; @@ -629,7 +629,7 @@ bool QHelpGenerator::registerCustomFilter(const QString &filterName, idsToInsert.removeAll(d->query->value(1).toString()); } - foreach (QString id, idsToInsert) { + foreach (const QString &id, idsToInsert) { d->query->prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)")); d->query->bindValue(0, id); d->query->exec(); @@ -664,7 +664,7 @@ bool QHelpGenerator::registerCustomFilter(const QString &filterName, d->query->bindValue(0, nameId); d->query->exec(); - foreach (QString att, filterAttribs) { + foreach (const QString &att, filterAttribs) { d->query->prepare(QLatin1String("INSERT INTO FilterTable VALUES(?, ?)")); d->query->bindValue(0, nameId); d->query->bindValue(1, attributeMap[att]); @@ -687,7 +687,7 @@ bool QHelpGenerator::insertKeywords(const QList keywords, indexId = d->query->value(0).toInt() + 1; QList filterAtts; - foreach (QString filterAtt, filterAttributes) { + foreach (const QString &filterAtt, filterAttributes) { d->query->prepare(QLatin1String("SELECT Id FROM FilterAttributeTable WHERE Name=?")); d->query->bindValue(0, filterAtt); d->query->exec(); @@ -704,7 +704,7 @@ bool QHelpGenerator::insertKeywords(const QList keywords, int i = 0; d->query->exec(QLatin1String("BEGIN")); - foreach (QHelpDataIndexItem itm, keywords) { + foreach (const QHelpDataIndexItem &itm, keywords) { pos = itm.reference.indexOf(QLatin1Char('#')); fileName = itm.reference.left(pos); if (pos > -1) @@ -773,7 +773,7 @@ bool QHelpGenerator::insertContents(const QByteArray &ba, } // associate the filter attributes - foreach (QString filterAtt, filterAttributes) { + foreach (const QString &filterAtt, filterAttributes) { d->query->prepare(QLatin1String("INSERT INTO ContentsFilterTable (FilterAttributeId, ContentsId) " "SELECT Id, ? FROM FilterAttributeTable WHERE Name=?")); d->query->bindValue(0, contentId); @@ -798,7 +798,7 @@ bool QHelpGenerator::insertFilterAttributes(const QStringList &attributes) while (d->query->next()) atts.insert(d->query->value(0).toString()); - foreach (QString s, attributes) { + foreach (const QString &s, attributes) { if (!atts.contains(s)) { d->query->prepare(QLatin1String("INSERT INTO FilterAttributeTable VALUES(NULL, ?)")); d->query->bindValue(0, s); diff --git a/tools/assistant/lib/qhelpindexwidget.cpp b/tools/assistant/lib/qhelpindexwidget.cpp index 6757805..270bcdd 100644 --- a/tools/assistant/lib/qhelpindexwidget.cpp +++ b/tools/assistant/lib/qhelpindexwidget.cpp @@ -162,7 +162,7 @@ void QHelpIndexProvider::run() QSet indicesSet; m_mutex.unlock(); - foreach (QString dbFileName, m_helpEngine->fileNameReaderMap.keys()) { + foreach (const QString &dbFileName, m_helpEngine->fileNameReaderMap.keys()) { m_mutex.lock(); if (m_abort) { m_mutex.unlock(); @@ -178,7 +178,7 @@ void QHelpIndexProvider::run() QStringList lst = reader.indicesForFilter(atts); if (!lst.isEmpty()) { m_mutex.lock(); - foreach (QString s, lst) + foreach (const QString &s, lst) indicesSet.insert(s); if (m_abort) { m_mutex.unlock(); @@ -317,7 +317,7 @@ QModelIndex QHelpIndexModel::filter(const QString &filter, const QString &wildca if (!wildcard.isEmpty()) { QRegExp regExp(wildcard, Qt::CaseInsensitive); regExp.setPatternSyntax(QRegExp::Wildcard); - foreach (QString index, d->indices) { + foreach (const QString &index, d->indices) { if (index.contains(regExp)) { lst.append(index); if (perfectMatch == -1 && index.startsWith(filter, Qt::CaseInsensitive)) { @@ -332,7 +332,7 @@ QModelIndex QHelpIndexModel::filter(const QString &filter, const QString &wildca } } } else { - foreach (QString index, d->indices) { + foreach (const QString &index, d->indices) { if (index.contains(filter, Qt::CaseInsensitive)) { lst.append(index); if (perfectMatch == -1 && index.startsWith(filter, Qt::CaseInsensitive)) { diff --git a/tools/assistant/lib/qhelpsearchindexreader_default.cpp b/tools/assistant/lib/qhelpsearchindexreader_default.cpp index 1bc5feb..d08efc3 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_default.cpp +++ b/tools/assistant/lib/qhelpsearchindexreader_default.cpp @@ -166,7 +166,7 @@ void Reader::filterFilesForAttributes(const QStringList &attributes) const QString fileName = it.key(); bool containsAll = true; QStringList split = fileName.split(QLatin1String("@")); - foreach (const QString attribute, attributes) { + foreach (const QString &attribute, attributes) { if (!split.contains(attribute, Qt::CaseInsensitive)) { containsAll = false; break; @@ -235,7 +235,7 @@ bool Reader::splitSearchTerm(const QString &searchTerm, QStringList *terms, void Reader::searchInIndex(const QStringList &terms) { - foreach (const QString term, terms) { + foreach (const QString &term, terms) { QVector documents; for(IndexTable::ConstIterator it = searchIndexTable.begin(); @@ -254,7 +254,7 @@ void Reader::searchInIndex(const QStringList &terms) DocumentInfo info; QString title, url; QVector documentsInfo; - foreach(const Document doc, documents) { + foreach(const Document &doc, documents) { info.docNumber = doc.docNumber; info.frequency = doc.frequency; info.documentUrl = documentList.at(doc.docNumber).at(1); @@ -519,7 +519,7 @@ void QHelpSearchIndexReaderDefault::run() mutex.unlock(); QString queryTerm; - foreach (const QHelpSearchQuery query, queryList) { + foreach (const QHelpSearchQuery &query, queryList) { if (query.fieldName == QHelpSearchQuery::DEFAULT) { queryTerm = query.wordList.at(0); break; @@ -541,7 +541,7 @@ void QHelpSearchIndexReaderDefault::run() // setup the reader m_reader.setIndexPath(indexPath); - foreach(const QString namespaceName, registeredDocs) { + foreach(const QString &namespaceName, registeredDocs) { mutex.lock(); if (m_cancel) { mutex.unlock(); @@ -553,7 +553,7 @@ void QHelpSearchIndexReaderDefault::run() const QList attributeSets = engine.filterAttributeSets(namespaceName); - foreach (QStringList attributes, attributeSets) { + foreach (const QStringList &attributes, attributeSets) { // read all index files m_reader.setIndexFile(namespaceName, attributes.join(QLatin1String("@"))); if (!m_reader.readIndex()) { @@ -577,7 +577,7 @@ void QHelpSearchIndexReaderDefault::run() QVector hits = m_reader.hits(); if (!hits.isEmpty()) { if (termSeq.isEmpty()) { - foreach (const DocumentInfo docInfo, hits) { + foreach (const DocumentInfo &docInfo, hits) { mutex.lock(); if (m_cancel) { mutex.unlock(); @@ -588,7 +588,7 @@ void QHelpSearchIndexReaderDefault::run() hitList.append(qMakePair(docInfo.documentTitle, docInfo.documentUrl)); } } else { - foreach (const DocumentInfo docInfo, hits) { + foreach (const DocumentInfo &docInfo, hits) { mutex.lock(); if (m_cancel) { mutex.unlock(); diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp index 108be97..70999e5 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp @@ -104,7 +104,7 @@ bool Writer::writeIndex() const return status; QDataStream docStream(&docFile); - foreach(const QStringList list, documentList) { + foreach(const QStringList &list, documentList) { docStream << list.at(0); docStream << list.at(1); } @@ -226,7 +226,7 @@ void QHelpSearchIndexWriter::run() QStringList namespaces; Writer writer(indexPath); - foreach(const QString namespaceName, registeredDocs) { + foreach(const QString &namespaceName, registeredDocs) { mutex.lock(); if (m_cancel) { mutex.unlock(); @@ -242,7 +242,7 @@ void QHelpSearchIndexWriter::run() const QList attributeSets = engine.filterAttributeSets(namespaceName); - foreach (QStringList attributes, attributeSets) { + foreach (const QStringList &attributes, attributeSets) { // cleanup maybe old or unfinished files writer.setIndexFile(namespaceName, attributes.join(QLatin1String("@"))); writer.removeIndex(); @@ -266,7 +266,7 @@ void QHelpSearchIndexWriter::run() int docNum = 0; const QStringList documentsList(documentsSet.toList()); - foreach(const QString url, documentsList) { + foreach(const QString &url, documentsList) { if (m_cancel) return; @@ -347,7 +347,7 @@ void QHelpSearchIndexWriter::run() const QList attributeSets = engine.filterAttributeSets(namespaceName); - foreach (QStringList attributes, attributeSets) { + foreach (const QStringList &attributes, attributeSets) { writer.setIndexFile(namespaceName, attributes.join(QLatin1String("@"))); writer.removeIndex(); } diff --git a/tools/assistant/lib/qhelpsearchquerywidget.cpp b/tools/assistant/lib/qhelpsearchquerywidget.cpp index f2bb816..5782c12 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.cpp +++ b/tools/assistant/lib/qhelpsearchquerywidget.cpp @@ -148,7 +148,7 @@ private: << QLatin1String("}") << QLatin1String("~"); // make sure we won't end up with an empty string - foreach (const QString escapeChar, escapableCharsList) { + foreach (const QString &escapeChar, escapableCharsList) { if (retValue.contains(escapeChar)) retValue.replace(escapeChar, QLatin1String("")); } @@ -156,7 +156,7 @@ private: return retValue; retValue = text; // now realy escape the string... - foreach (const QString escapeChar, escapableCharsList) { + foreach (const QString &escapeChar, escapableCharsList) { if (retValue.contains(escapeChar)) retValue.replace(escapeChar, escape + escapeChar); } @@ -317,7 +317,7 @@ private slots: QStringList lst = similarQuery->text().split(exp, QString::SkipEmptyParts); if (!lst.isEmpty()) { QStringList fuzzy; - foreach (const QString term, lst) + foreach (const QString &term, lst) fuzzy += buildTermList(escapeString(term)); queryList.append(QHelpSearchQuery(QHelpSearchQuery::FUZZY, fuzzy)); } @@ -325,7 +325,7 @@ private slots: lst = withoutQuery->text().split(exp, QString::SkipEmptyParts); if (!lst.isEmpty()) { QStringList without; - foreach (const QString term, lst) + foreach (const QString &term, lst) without.append(escapeString(term)); queryList.append(QHelpSearchQuery(QHelpSearchQuery::WITHOUT, without)); } @@ -339,7 +339,7 @@ private slots: lst = allQuery->text().split(exp, QString::SkipEmptyParts); if (!lst.isEmpty()) { QStringList all; - foreach (const QString term, lst) + foreach (const QString &term, lst) all.append(escapeString(term)); queryList.append(QHelpSearchQuery(QHelpSearchQuery::ALL, all)); } @@ -347,7 +347,7 @@ private slots: lst = atLeastQuery->text().split(exp, QString::SkipEmptyParts); if (!lst.isEmpty()) { QStringList atLeast; - foreach (const QString term, lst) + foreach (const QString &term, lst) atLeast += buildTermList(escapeString(term)); queryList.append(QHelpSearchQuery(QHelpSearchQuery::ATLEAST, atLeast)); } diff --git a/tools/assistant/lib/qhelpsearchresultwidget.cpp b/tools/assistant/lib/qhelpsearchresultwidget.cpp index a3f5aed..ad540c6 100644 --- a/tools/assistant/lib/qhelpsearchresultwidget.cpp +++ b/tools/assistant/lib/qhelpsearchresultwidget.cpp @@ -73,7 +73,7 @@ public: void showResultPage(const QList hits) { - foreach (const QHelpSearchEngine::SearchHit hit, hits) + foreach (const QHelpSearchEngine::SearchHit &hit, hits) new QTreeWidgetItem(this, QStringList(hit.first) << hit.second); } @@ -118,7 +118,7 @@ public: .arg(tr("The search results may not be complete since the " "documentation is still being indexed!")); - foreach (const QHelpSearchEngine::SearchHit hit, hits) { + foreach (const QHelpSearchEngine::SearchHit &hit, hits) { htmlFile += QString(QLatin1String("
%2
%1

")) diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index 055fa1c..0e4096b 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -1118,7 +1118,7 @@ CentralWidget::highlightSearchTerms() QList queryList = searchEngine->query(); QStringList terms; - foreach (QHelpSearchQuery query, queryList) { + foreach (const QHelpSearchQuery &query, queryList) { switch (query.fieldName) { default: break; case QHelpSearchQuery::ALL: { -- cgit v0.12 From 4a22fb03ff1ab5d63e51dca791155b249321bedb Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 1 Feb 2010 17:57:17 +0100 Subject: Assistant: Fix spelling mistakes. --- tools/assistant/lib/fulltextsearch/qclucene-config_p.h | 2 +- tools/assistant/lib/qhelpenginecore.cpp | 2 +- tools/assistant/lib/qhelpsearchengine.cpp | 12 ++++++------ tools/assistant/lib/qhelpsearchindexreader_default.cpp | 6 +++--- tools/assistant/lib/qhelpsearchindexwriter_default.cpp | 6 +++--- tools/assistant/lib/qhelpsearchquerywidget.cpp | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tools/assistant/lib/fulltextsearch/qclucene-config_p.h b/tools/assistant/lib/fulltextsearch/qclucene-config_p.h index 729ae72..0c70718 100644 --- a/tools/assistant/lib/fulltextsearch/qclucene-config_p.h +++ b/tools/assistant/lib/fulltextsearch/qclucene-config_p.h @@ -529,7 +529,7 @@ configure. /* Conditional Debugging */ /* #undef _CL__CND_DEBUG */ -/* debuging option */ +/* debugging option */ /* #undef _DEBUG */ /* Number of bits in a file offset, on hosts where this is settable. */ diff --git a/tools/assistant/lib/qhelpenginecore.cpp b/tools/assistant/lib/qhelpenginecore.cpp index b651aa3..066e4d5 100644 --- a/tools/assistant/lib/qhelpenginecore.cpp +++ b/tools/assistant/lib/qhelpenginecore.cpp @@ -168,7 +168,7 @@ void QHelpEngineCorePrivate::errorReceived(const QString &msg) it is removed by calling removeCustomFilter(). customFilters() returns all defined filters. - The help engine also offers the possiblity to set and read values + The help engine also offers the possibility to set and read values in a persistant way comparable to ini files or Windows registry entries. For more information see setValue() or value(). diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp index c28947b..7c2635d 100644 --- a/tools/assistant/lib/qhelpsearchengine.cpp +++ b/tools/assistant/lib/qhelpsearchengine.cpp @@ -214,7 +214,7 @@ private: search term The QHelpSearchQuery class contains the field name and the associated search - term. Depending on the field the search term might get split up into seperate + term. Depending on the field the search term might get split up into separate terms to be parsed differently by the search engine. \sa QHelpSearchQueryWidget @@ -238,15 +238,15 @@ private: \value DEFAULT the default field provided by the search widget, several terms should be split and stored in the word list except search terms enclosed in quotes. - \value FUZZY a field only provided in use with clucene. Terms should be split in seperate + \value FUZZY a field only provided in use with clucene. Terms should be split in separate words and passed to the search engine. - \value WITHOUT a field only provided in use with clucene. Terms should be split in seperate + \value WITHOUT a field only provided in use with clucene. Terms should be split in separate words and passed to the search engine. - \value PHRASE a field only provided in use with clucene. Terms should not be split in seperate + \value PHRASE a field only provided in use with clucene. Terms should not be split in separate words. - \value ALL a field only provided in use with clucene. Terms should be split in seperate + \value ALL a field only provided in use with clucene. Terms should be split in separate words and passed to the search engine - \value ATLEAST a field only provided in use with clucene. Terms should be split in seperate + \value ATLEAST a field only provided in use with clucene. Terms should be split in separate words and passed to the search engine */ diff --git a/tools/assistant/lib/qhelpsearchindexreader_default.cpp b/tools/assistant/lib/qhelpsearchindexreader_default.cpp index d08efc3..d2241a5 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_default.cpp +++ b/tools/assistant/lib/qhelpsearchindexreader_default.cpp @@ -180,9 +180,9 @@ void Reader::filterFilesForAttributes(const QStringList &attributes) void Reader::setIndexFile(const QString &namespaceName, const QString &attributes) { - QString extention = namespaceName + QLatin1String("@") + attributes; - indexFile = indexPath + QLatin1String("/indexdb40.") + extention; - documentFile = indexPath + QLatin1String("/indexdoc40.") + extention; + QString extension = namespaceName + QLatin1String("@") + attributes; + indexFile = indexPath + QLatin1String("/indexdb40.") + extension; + documentFile = indexPath + QLatin1String("/indexdoc40.") + extension; } bool Reader::splitSearchTerm(const QString &searchTerm, QStringList *terms, diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp index 70999e5..6d09fb8 100644 --- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp +++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp @@ -126,9 +126,9 @@ void Writer::removeIndex() const void Writer::setIndexFile(const QString &namespaceName, const QString &attributes) { - QString extention = namespaceName + QLatin1String("@") + attributes; - indexFile = indexPath + QLatin1String("/indexdb40.") + extention; - documentFile = indexPath + QLatin1String("/indexdoc40.") + extention; + QString extension = namespaceName + QLatin1String("@") + attributes; + indexFile = indexPath + QLatin1String("/indexdb40.") + extension; + documentFile = indexPath + QLatin1String("/indexdoc40.") + extension; } void Writer::insertInIndex(const QString &string, int docNum) diff --git a/tools/assistant/lib/qhelpsearchquerywidget.cpp b/tools/assistant/lib/qhelpsearchquerywidget.cpp index 5782c12..3c3919e 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.cpp +++ b/tools/assistant/lib/qhelpsearchquerywidget.cpp @@ -155,7 +155,7 @@ private: if (retValue.trimmed().isEmpty()) return retValue; - retValue = text; // now realy escape the string... + retValue = text; // now really escape the string... foreach (const QString &escapeChar, escapableCharsList) { if (retValue.contains(escapeChar)) retValue.replace(escapeChar, escape + escapeChar); @@ -533,7 +533,7 @@ QHelpSearchQueryWidget::~QHelpSearchQueryWidget() } /*! - Returns a list of querys to use in combination with the search engines + Returns a list of queries to use in combination with the search engines search(QList &query) function. */ QList QHelpSearchQueryWidget::query() const -- cgit v0.12 From bbe1a089c43f0b706d33bb08fbeae256b6e34d30 Mon Sep 17 00:00:00 2001 From: ck Date: Mon, 1 Feb 2010 18:10:50 +0100 Subject: Fix missing namespace. --- src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index fed1658..6cb76ee 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -42,6 +42,8 @@ #include "qtextureglyphcache_gl_p.h" #include "qpaintengineex_opengl2_p.h" +QT_BEGIN_NAMESPACE + #ifdef Q_WS_WIN extern Q_GUI_EXPORT bool qt_cleartype_enabled; #endif @@ -243,3 +245,5 @@ int QGLTextureGlyphCache::glyphMargin() const return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; #endif } + +QT_END_NAMESPACE -- cgit v0.12 From 55ca7d36d35c8ecac27b6866f40a5f2de799debd Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 9 Dec 2009 17:22:06 +0100 Subject: qmake: use isActiveConfig() instead of hand-crafting comparisons ensures consistent handling of CONFIG values. this is incompatible with 4.6.1, as it removes case-insentitivity from some of the config keys, but those pro files wouldn't be portable beyond symbian anyway, and symbian compatibility guarantees start with 4.6.2. Reviewed-by: mariusSO --- qmake/generators/symbian/symmake.cpp | 26 +++++++++++++------------- qmake/generators/symbian/symmake_abld.cpp | 2 +- qmake/generators/symbian/symmake_sbsv2.cpp | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 20e2d0e..63676d1 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -261,7 +261,7 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) writeMmpFile(mmpFilename, symbianLangCodes); if (targetType == TypeExe) { - if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + if (!project->isActiveConfig("no_icon")) { writeRegRssFile(userRssRules); writeRssFile(numberOfIcons, iconFile); writeLocFile(symbianLangCodes); @@ -375,7 +375,7 @@ void SymbianMakefileGenerator::generatePkgFile(const QString &iconFile, Deployme .arg(exeFile) << endl; // deploy rsc & reg_rsc file - if (!project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + if (!project->isActiveConfig("no_icon")) { t << QString("\"%1epoc32/data/z/resource/apps/%2\" - \"%3\\%4\"") .arg(epocRoot()) .arg(fixedTarget + ".rsc") @@ -444,7 +444,7 @@ bool SymbianMakefileGenerator::containsStartWithItem(const QChar &c, const QStri void SymbianMakefileGenerator::writeCustomDefFile() { - if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { // Create custom def file for plugin QFile ft(QLatin1String(PLUGIN_COMMON_DEF_FILE_ACTUAL)); @@ -509,9 +509,9 @@ void SymbianMakefileGenerator::init() targetType = TypeExe; else if ((project->values("TEMPLATE")).contains("lib")) { // Check CONFIG to see if we are to build staticlib or dll - if (project->values("CONFIG").contains("staticlib") || project->values("CONFIG").contains("static")) + if (project->isActiveConfig("staticlib") || project->isActiveConfig("static")) targetType = TypeLib; - else if (project->values("CONFIG").contains("plugin")) + else if (project->isActiveConfig("plugin")) targetType = TypePlugin; else targetType = TypeDll; @@ -521,7 +521,7 @@ void SymbianMakefileGenerator::init() if (0 != project->values("TARGET.UID2").size()) { uid2 = project->first("TARGET.UID2"); - } else if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + } else if (project->isActiveConfig("stdbinary")) { uid2 = "0x20004C45"; } else { if (targetType == TypeExe) { @@ -788,7 +788,7 @@ void SymbianMakefileGenerator::writeMmpFile(QString &filename, QStringList &symb } t << endl; - if (!project->values("CONFIG").contains("static") && !project->values("CONFIG").contains("staticlib")) { + if (!project->isActiveConfig("static") && !project->isActiveConfig("staticlib")) { writeMmpFileLibraryPart(t); } @@ -841,7 +841,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) if (targetType == TypeExe) { t << MMP_TARGET "\t\t" << fixedTarget << ".exe" << endl; if (!skipTargetType) { - if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + if (project->isActiveConfig("stdbinary")) t << MMP_TARGETTYPE "\t\tSTDEXE" << endl; else t << MMP_TARGETTYPE "\t\tEXE" << endl; @@ -849,7 +849,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) } else if (targetType == TypeDll || targetType == TypePlugin) { t << MMP_TARGET "\t\t" << fixedTarget << ".dll" << endl; if (!skipTargetType) { - if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + if (project->isActiveConfig("stdbinary")) t << MMP_TARGETTYPE "\t\tSTDDLL" << endl; else t << MMP_TARGETTYPE "\t\tDLL" << endl; @@ -857,7 +857,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) } else if (targetType == TypeLib) { t << MMP_TARGET "\t\t" << fixedTarget << ".lib" << endl; if (!skipTargetType) { - if (project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) + if (project->isActiveConfig("stdbinary")) t << MMP_TARGETTYPE "\t\tSTDLIB" << endl; else t << MMP_TARGETTYPE "\t\tLIB" << endl; @@ -893,7 +893,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) if (0 != project->values("TARGET.EPOCALLOWDLLDATA").size()) t << MMP_EPOCALLOWDLLDATA << endl; - if (targetType == TypePlugin && !project->values("CONFIG").contains("stdbinary", Qt::CaseInsensitive)) { + if (targetType == TypePlugin && !project->isActiveConfig("stdbinary")) { // Use custom def file for Qt plugins t << "DEFFILE " PLUGIN_COMMON_DEF_FILE_FOR_MMP << endl; } @@ -909,7 +909,7 @@ void SymbianMakefileGenerator::writeMmpFileTargetPart(QTextStream& t) void SymbianMakefileGenerator::writeMmpFileResourcePart(QTextStream& t, QStringList &symbianLangCodes) { if ((targetType == TypeExe) && - !project->values("CONFIG").contains("no_icon", Qt::CaseInsensitive)) { + !project->isActiveConfig("no_icon")) { QString locTarget = fixedTarget; locTarget.append(".rss"); @@ -1267,7 +1267,7 @@ void SymbianMakefileGenerator::writeBldInfContent(QTextStream &t, bool addDeploy // Add project mmps and old style extension makefiles QString mmpTag; - if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) + if (project->isActiveConfig("symbian_test")) mmpTag = QLatin1String(BLD_INF_TAG_TESTMMPFILES); else mmpTag = QLatin1String(BLD_INF_TAG_MMPFILES); diff --git a/qmake/generators/symbian/symmake_abld.cpp b/qmake/generators/symbian/symmake_abld.cpp index d1e63cb..033bcbe 100644 --- a/qmake/generators/symbian/symmake_abld.cpp +++ b/qmake/generators/symbian/symmake_abld.cpp @@ -172,7 +172,7 @@ void SymbianAbldMakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, bool releasePlatforms.removeAll("winscw"); // No release for emulator QString testClause; - if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) + if (project->isActiveConfig("symbian_test")) testClause = QLatin1String(" test"); else testClause = QLatin1String(""); diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index 5adf30d..e081b19 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -106,7 +106,7 @@ void SymbianSbsv2MakefileGenerator::writeWrapperMakefile(QFile& wrapperFile, boo releasePlatforms.removeAll("winscw"); // No release for emulator QString testClause; - if (project->values("CONFIG").contains("symbian_test", Qt::CaseInsensitive)) + if (project->isActiveConfig("symbian_test")) testClause = QLatin1String(".test"); else testClause = QLatin1String(""); -- cgit v0.12 From ac323ef4e9d018aa9df41d8f7e81b58a3e373dbf Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 9 Dec 2009 18:37:04 +0100 Subject: qmake: Remove macro and simplify string expression previously using it also fixes a warning Reviewed-by: mariusSO --- qmake/generators/symbian/symmake.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index 63676d1..caee2db 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -54,7 +54,6 @@ #define REGISTRATION_RESOURCE_DIRECTORY_HW "/private/10003a3f/import/apps" #define PLUGIN_COMMON_DEF_FILE_FOR_MMP "./plugin_common.def" #define PLUGIN_COMMON_DEF_FILE_ACTUAL "plugin_commonU.def" -#define BLD_INF_FILENAME_LEN (sizeof(BLD_INF_FILENAME) - 1) #define BLD_INF_RULES_BASE "BLD_INF_RULES." #define BLD_INF_TAG_PLATFORMS "prj_platforms" @@ -227,7 +226,9 @@ bool SymbianMakefileGenerator::writeMakefile(QTextStream &t) QString wrapperFileName("Makefile"); QString outputFileName = fileInfo(Option::output.fileName()).fileName(); if (outputFileName != BLD_INF_FILENAME) { - wrapperFileName.append(".").append((outputFileName.size() > BLD_INF_FILENAME_LEN && outputFileName.left(BLD_INF_FILENAME_LEN) == BLD_INF_FILENAME) ? outputFileName.mid(8) : outputFileName); + wrapperFileName.append(".").append(outputFileName.startsWith(BLD_INF_FILENAME) + ? outputFileName.mid(sizeof(BLD_INF_FILENAME)) + : outputFileName); isPrimaryMakefile = false; } -- cgit v0.12 From ec69e5ab5b74064feb88bc1f1096673227f51caa Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 9 Dec 2009 18:37:45 +0100 Subject: qmake: fix warnings missing braces, parens and spaces denoting empty loop bodies Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 3 ++- qmake/generators/makefiledeps.cpp | 34 +++++++++++++++++----------------- qmake/generators/symbian/symmake.cpp | 2 +- qmake/generators/win32/winmakefile.cpp | 3 ++- qmake/meta.cpp | 5 +++-- qmake/option.cpp | 4 ++-- 6 files changed, 27 insertions(+), 24 deletions(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 7424d1d..f1f2503 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -1824,11 +1824,12 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) cleans.append(files); } } - if(!cleans.isEmpty()) + if(!cleans.isEmpty()) { if (isForSymbian()) t << valGlue(cleans, "\n\t" + del_statement, " 2> NUL\n\t" + del_statement, " 2> NUL"); else t << valGlue(cleans, "\n\t" + del_statement, "\n\t" + del_statement, ""); + } if(!wrote_clean_cmds) { for(QStringList::ConstIterator input = tmp_inputs.begin(); input != tmp_inputs.end(); ++input) { t << "\n\t" << replaceExtraCompilerVariables(tmp_clean_cmds, (*input), diff --git a/qmake/generators/makefiledeps.cpp b/qmake/generators/makefiledeps.cpp index 40304a6..21e1273 100644 --- a/qmake/generators/makefiledeps.cpp +++ b/qmake/generators/makefiledeps.cpp @@ -397,7 +397,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) buffer = getBuffer(fst.st_size); for(int have_read = 0; (have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len)); - buffer_len += have_read); + buffer_len += have_read) ; QT_CLOSE(fd); } if(!buffer) @@ -418,22 +418,22 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) ++x; if(buffer_len >= x + 12 && !strncmp(buffer + x, "includehint", 11) && (*(buffer + x + 11) == ' ' || *(buffer + x + 11) == '>')) { - for(x += 11; *(buffer + x) != '>'; ++x); + for(x += 11; *(buffer + x) != '>'; ++x) ; int inc_len = 0; - for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len); + for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len) ; *(buffer + x + inc_len) = '\0'; inc = buffer + x; } else if(buffer_len >= x + 13 && !strncmp(buffer + x, "customwidget", 12) && (*(buffer + x + 12) == ' ' || *(buffer + x + 12) == '>')) { - for(x += 13; *(buffer + x) != '>'; ++x); //skip up to > + for(x += 13; *(buffer + x) != '>'; ++x) ; //skip up to > while(x < buffer_len) { - for(x++; *(buffer + x) != '<'; ++x); //skip up to < + for(x++; *(buffer + x) != '<'; ++x) ; //skip up to < x++; if(buffer_len >= x + 7 && !strncmp(buffer+x, "header", 6) && (*(buffer + x + 6) == ' ' || *(buffer + x + 6) == '>')) { - for(x += 7; *(buffer + x) != '>'; ++x); //skip up to > + for(x += 7; *(buffer + x) != '>'; ++x) ; //skip up to > int inc_len = 0; - for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len); + for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len) ; *(buffer + x + inc_len) = '\0'; inc = buffer + x; break; @@ -448,10 +448,10 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) for(x += 8; *(buffer + x) != '>'; ++x) { if(buffer_len >= x + 9 && *(buffer + x) == 'i' && !strncmp(buffer + x, "impldecl", 8)) { - for(x += 8; *(buffer + x) != '='; ++x); + for(x += 8; *(buffer + x) != '='; ++x) ; if(*(buffer + x) != '=') continue; - for(++x; *(buffer+x) == '\t' || *(buffer+x) == ' '; ++x); + for(++x; *(buffer+x) == '\t' || *(buffer+x) == ' '; ++x) ; char quote = 0; if(*(buffer+x) == '\'' || *(buffer+x) == '"') { quote = *(buffer + x); @@ -475,13 +475,13 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) } } int inc_len = 0; - for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len); + for(x += 1 ; *(buffer + x + inc_len) != '<'; ++inc_len) ; *(buffer + x + inc_len) = '\0'; inc = buffer + x; } } //read past new line now.. - for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x); + for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x) ; ++line_count; } else if(file->type == QMakeSourceFileInfo::TYPE_QRC) { } else if(file->type == QMakeSourceFileInfo::TYPE_C) { @@ -494,7 +494,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) ++x; if(buffer_len >= x) { if(*(buffer+x) == '/') { //c++ style comment - for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x); + for(; x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x) ; beginning = 1; } else if(*(buffer+x) == '*') { //c style comment for(++x; x < buffer_len; ++x) { @@ -558,7 +558,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) *(buffer+x+keyword_len) != '_') { for(x+=keyword_len; //skip spaces after keyword x < buffer_len && (*(buffer+x) == ' ' || *(buffer+x) == '\t'); - x++); + x++) ; break; } else if(qmake_endOfLine(*(buffer+x+keyword_len))) { x += keyword_len-1; @@ -579,7 +579,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) x++; int inc_len; - for(inc_len = 0; *(buffer + x + inc_len) != term && !qmake_endOfLine(*(buffer + x + inc_len)); ++inc_len); + for(inc_len = 0; *(buffer + x + inc_len) != term && !qmake_endOfLine(*(buffer + x + inc_len)); ++inc_len) ; *(buffer + x + inc_len) = '\0'; inc = buffer + x; x += inc_len; @@ -594,7 +594,7 @@ bool QMakeSourceFileInfo::findDeps(SourceFile *file) int msg_len; for(msg_len = 0; (term && *(buffer + x + msg_len) != term) && - !qmake_endOfLine(*(buffer + x + msg_len)); ++msg_len); + !qmake_endOfLine(*(buffer + x + msg_len)); ++msg_len) ; *(buffer + x + msg_len) = '\0'; debug_msg(0, "%s:%d %s -- %s", file->file.local().toLatin1().constData(), line_count, keyword, buffer+x); x += msg_len; @@ -706,7 +706,7 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) buffer = getBuffer(fst.st_size); for(int have_read = buffer_len = 0; (have_read = QT_READ(fd, buffer + buffer_len, fst.st_size - buffer_len)); - buffer_len += have_read); + buffer_len += have_read) ; QT_CLOSE(fd); } @@ -720,7 +720,7 @@ bool QMakeSourceFileInfo::findMocs(SourceFile *file) ++x; if(buffer_len >= x) { if(*(buffer + x) == '/') { //c++ style comment - for(;x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x); + for(;x < buffer_len && !qmake_endOfLine(*(buffer + x)); ++x) ; } else if(*(buffer + x) == '*') { //c style comment for(++x; x < buffer_len; ++x) { if(*(buffer + x) == 't' || *(buffer + x) == 'q') { //ignore diff --git a/qmake/generators/symbian/symmake.cpp b/qmake/generators/symbian/symmake.cpp index caee2db..4d610af 100644 --- a/qmake/generators/symbian/symmake.cpp +++ b/qmake/generators/symbian/symmake.cpp @@ -1515,7 +1515,7 @@ void SymbianMakefileGenerator::readRssRules(QString &numberOfIcons, QString &ico if (!numberOfIcons.isEmpty()) { bool ok; numberOfIcons = numberOfIcons.simplified(); - int tmp = numberOfIcons.toInt(&ok); + numberOfIcons.toInt(&ok); if (!ok) { numberOfIcons.clear(); iconFile.clear(); diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp index efdf8ac..9d3b4c6 100644 --- a/qmake/generators/win32/winmakefile.cpp +++ b/qmake/generators/win32/winmakefile.cpp @@ -467,11 +467,12 @@ void Win32MakefileGenerator::processRcFileVar() resFile.replace(".rc", Option::res_ext); project->values("RES_FILE").prepend(fileInfo(resFile).fileName()); - if (!project->values("OBJECTS_DIR").isEmpty()) + if (!project->values("OBJECTS_DIR").isEmpty()) { if(project->isActiveConfig("staticlib")) project->values("RES_FILE").first().prepend(fileInfo(project->values("DESTDIR").first()).absoluteFilePath() + Option::dir_sep); else project->values("RES_FILE").first().prepend(project->values("OBJECTS_DIR").first() + Option::dir_sep); + } project->values("RES_FILE").first() = Option::fixPathToTargetOS(project->values("RES_FILE").first(), false, false); project->values("POST_TARGETDEPS") += project->values("RES_FILE"); project->values("CLEAN_FILES") += project->values("RES_FILE"); diff --git a/qmake/meta.cpp b/qmake/meta.cpp index 1c71d60..5b36682 100644 --- a/qmake/meta.cpp +++ b/qmake/meta.cpp @@ -119,10 +119,11 @@ QMakeMetaInfo::findLib(QString lib) } } } - if(ret.isNull()) + if(ret.isNull()) { debug_msg(2, "QMakeMetaInfo: Cannot find info file for %s", lib.toLatin1().constData()); - else + } else { debug_msg(2, "QMakeMetaInfo: Found info file %s for %s", ret.toLatin1().constData(), lib.toLatin1().constData()); + } return ret; } diff --git a/qmake/option.cpp b/qmake/option.cpp index 9577a28..5522a80 100644 --- a/qmake/option.cpp +++ b/qmake/option.cpp @@ -630,8 +630,8 @@ Option::fixString(QString string, uchar flags) string = string.replace('/', Option::dir_sep).replace('\\', Option::dir_sep); } - if (string.startsWith("\"") && string.endsWith("\"") || - string.startsWith("\'") && string.endsWith("\'")) + if ((string.startsWith("\"") && string.endsWith("\"")) || + (string.startsWith("\'") && string.endsWith("\'"))) string = string.mid(1, string.length()-2); //cache -- cgit v0.12 From 470b2de3e24b8eca056a31728a5e1039a9a25d79 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 18 Dec 2009 15:22:42 +0100 Subject: qmake: subdirs template: make distclean target use QMAKE_DISTCLEAN patch by David Faure Reviewed-by: mariusSO --- qmake/generators/makefile.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index f1f2503..69e1d8a 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -2536,6 +2536,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QListisActiveConfig("no_empty_targets")) { t << "\t" << "@cd ." << endl; } -- cgit v0.12