summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp4
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp6
-rw-r--r--src/corelib/tools/qstring.h10
-rw-r--r--src/corelib/tools/qstringbuilder.h40
-rw-r--r--src/qbase.pri1
-rw-r--r--src/qt3support/text/q3textedit.cpp2
7 files changed, 53 insertions, 12 deletions
diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
index 7a1bfd5..5fbc876 100644
--- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/InspectorClientQt.cpp
@@ -179,7 +179,7 @@ void InspectorClientQt::populateSetting(const String& key, InspectorController::
return;
}
- QString settingKey(settingStoragePrefix + key);
+ QString settingKey(settingStoragePrefix + QString(key));
QString storedValueType = qsettings.value(settingKey + settingStorageTypeSuffix).toString();
QVariant storedValue = qsettings.value(settingKey);
storedValue.convert(QVariant::nameToType(storedValueType.toAscii().data()));
@@ -196,7 +196,7 @@ void InspectorClientQt::storeSetting(const String& key, const InspectorControlle
}
QVariant valueToStore = settingToVariant(setting);
- QString settingKey(settingStoragePrefix + key);
+ QString settingKey(settingStoragePrefix + QString(key));
qsettings.setValue(settingKey, valueToStore);
qsettings.setValue(settingKey + settingStorageTypeSuffix, QVariant::typeToName(valueToStore.type()));
}
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 076cc33..0290fb8 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -6348,7 +6348,7 @@ QUrl QUrl::fromUserInput(const QString &userInput)
return QUrl::fromLocalFile(trimmedString);
QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
- QUrl urlPrepended = QUrl::fromEncoded((QLatin1String("http://") + trimmedString).toUtf8(), QUrl::TolerantMode);
+ QUrl urlPrepended = QUrl::fromEncoded("http://" + trimmedString.toUtf8(), QUrl::TolerantMode);
// Check the most common case of a valid url with scheme and host
// We check if the port would be valid by adding the scheme to handle the case host:port
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index b1a7caa..58e3ba8 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -841,7 +841,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
return symbianTimeFormat();
case DateTimeFormatLong:
case DateTimeFormatShort:
- return symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat();
+ return QString(symbianDateFormat( (type == DateTimeFormatShort) ) + QLatin1Char(' ') + symbianTimeFormat());
case DateToStringShort:
case DateToStringLong:
return symbianDateToString(in.toDate(), (type == DateToStringShort) );
@@ -851,8 +851,8 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
case DateTimeToStringShort:
case DateTimeToStringLong: {
const QDateTime dt = in.toDateTime();
- return symbianDateToString(dt.date(), (type == DateTimeToStringShort) )
- + QLatin1Char(' ') + symbianTimeToString(dt.time());
+ return QString(symbianDateToString(dt.date(), (type == DateTimeToStringShort) )
+ + QLatin1Char(' ') + symbianTimeToString(dt.time()));
}
case MeasurementSystem:
return static_cast<int>(symbianMeasurementSystem());
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 8de3c7d..a59c0bd 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -73,6 +73,16 @@ typedef std::basic_string<wchar_t> QStdWString;
#error qstring.h must be included before any header file that defines truncate
#endif
+#if defined(Q_CC_GNU) && (__GNUC__ == 4 && __GNUC_MINOR__ == 0)
+//There is a bug in GCC 4.0 that tries to instantiate template of annonymous enum
+# ifdef QT_USE_FAST_OPERATOR_PLUS
+# undef QT_USE_FAST_OPERATOR_PLUS
+# endif
+# ifdef QT_USE_FAST_CONCATENATION
+# undef QT_USE_FAST_CONCATENATION
+# endif
+#endif
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 74661c2..9fe3fd7 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -100,14 +100,18 @@ public:
operator QString() const
{
- QString s(QConcatenable< QStringBuilder<A, B> >::size(*this),
- Qt::Uninitialized);
+ const uint size = QConcatenable< QStringBuilder<A, B> >::size(*this);
+ QString s(size, Qt::Uninitialized);
QChar *d = s.data();
+ const QChar * const start = d;
QConcatenable< QStringBuilder<A, B> >::appendTo(*this, d);
- // this resize is necessary since we allocate a bit too much
- // when dealing with variable sized 8-bit encodings
- s.resize(d - s.data());
+
+ if (!QConcatenable< QStringBuilder<A, B> >::ExactSize && size != d - start) {
+ // this resize is necessary since we allocate a bit too much
+ // when dealing with variable sized 8-bit encodings
+ s.resize(d - start);
+ }
return s;
}
QByteArray toLatin1() const { return QString(*this).toLatin1(); }
@@ -116,10 +120,24 @@ public:
const B &b;
};
+template <>
+class QStringBuilder <QString, QString>
+{
+ public:
+ QStringBuilder(const QString &a_, const QString &b_) : a(a_), b(b_) {}
+
+ operator QString() const
+ { QString r(a); r += b; return r; }
+ QByteArray toLatin1() const { return QString(*this).toLatin1(); }
+
+ const QString &a;
+ const QString &b;
+};
template <> struct QConcatenable<char> : private QAbstractConcatenable
{
typedef char type;
+ enum { ExactSize = true };
static int size(const char) { return 1; }
static inline void appendTo(const char c, QChar *&out)
{
@@ -130,6 +148,7 @@ template <> struct QConcatenable<char> : private QAbstractConcatenable
template <> struct QConcatenable<QLatin1Char>
{
typedef QLatin1Char type;
+ enum { ExactSize = true };
static int size(const QLatin1Char) { return 1; }
static inline void appendTo(const QLatin1Char c, QChar *&out)
{
@@ -140,6 +159,7 @@ template <> struct QConcatenable<QLatin1Char>
template <> struct QConcatenable<QChar>
{
typedef QChar type;
+ enum { ExactSize = true };
static int size(const QChar) { return 1; }
static inline void appendTo(const QChar c, QChar *&out)
{
@@ -150,6 +170,7 @@ template <> struct QConcatenable<QChar>
template <> struct QConcatenable<QCharRef>
{
typedef QCharRef type;
+ enum { ExactSize = true };
static int size(const QCharRef &) { return 1; }
static inline void appendTo(const QCharRef &c, QChar *&out)
{
@@ -160,6 +181,7 @@ template <> struct QConcatenable<QCharRef>
template <> struct QConcatenable<QLatin1String>
{
typedef QLatin1String type;
+ enum { ExactSize = true };
static int size(const QLatin1String &a) { return qstrlen(a.latin1()); }
static inline void appendTo(const QLatin1String &a, QChar *&out)
{
@@ -172,6 +194,7 @@ template <> struct QConcatenable<QLatin1String>
template <> struct QConcatenable<QLatin1Literal>
{
typedef QLatin1Literal type;
+ enum { ExactSize = true };
static int size(const QLatin1Literal &a) { return a.size(); }
static inline void appendTo(const QLatin1Literal &a, QChar *&out)
{
@@ -183,6 +206,7 @@ template <> struct QConcatenable<QLatin1Literal>
template <> struct QConcatenable<QString>
{
typedef QString type;
+ enum { ExactSize = true };
static int size(const QString &a) { return a.size(); }
static inline void appendTo(const QString &a, QChar *&out)
{
@@ -195,6 +219,7 @@ template <> struct QConcatenable<QString>
template <> struct QConcatenable<QStringRef>
{
typedef QStringRef type;
+ enum { ExactSize = true };
static int size(const QStringRef &a) { return a.size(); }
static inline void appendTo(QStringRef a, QChar *&out)
{
@@ -208,6 +233,7 @@ template <> struct QConcatenable<QStringRef>
template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
{
typedef char type[N];
+ enum { ExactSize = false };
static int size(const char[N])
{
return N - 1;
@@ -221,6 +247,7 @@ template <int N> struct QConcatenable<char[N]> : private QAbstractConcatenable
template <int N> struct QConcatenable<const char[N]> : private QAbstractConcatenable
{
typedef const char type[N];
+ enum { ExactSize = false };
static int size(const char[N]) { return N - 1; }
static inline void appendTo(const char a[N], QChar *&out)
{
@@ -231,6 +258,7 @@ template <int N> struct QConcatenable<const char[N]> : private QAbstractConcaten
template <> struct QConcatenable<const char *> : private QAbstractConcatenable
{
typedef char const *type;
+ enum { ExactSize = false };
static int size(const char *a) { return qstrlen(a); }
static inline void appendTo(const char *a, QChar *&out)
{
@@ -241,6 +269,7 @@ template <> struct QConcatenable<const char *> : private QAbstractConcatenable
template <> struct QConcatenable<QByteArray> : private QAbstractConcatenable
{
typedef QByteArray type;
+ enum { ExactSize = false };
static int size(const QByteArray &ba) { return qstrnlen(ba.constData(), ba.size()); }
static inline void appendTo(const QByteArray &ba, QChar *&out)
{
@@ -253,6 +282,7 @@ template <typename A, typename B>
struct QConcatenable< QStringBuilder<A, B> >
{
typedef QStringBuilder<A, B> type;
+ enum { ExactSize = QConcatenable<A>::ExactSize && QConcatenable<B>::ExactSize };
static int size(const type &p)
{
return QConcatenable<A>::size(p.a) + QConcatenable<B>::size(p.b);
diff --git a/src/qbase.pri b/src/qbase.pri
index ef5d9e5..835ed0e 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -157,6 +157,7 @@ contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE
DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
contains(QT_CONFIG, qt3support):DEFINES *= QT3_SUPPORT
DEFINES *= QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
+DEFINES *= QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end
diff --git a/src/qt3support/text/q3textedit.cpp b/src/qt3support/text/q3textedit.cpp
index 7f51bea..d4f75ed 100644
--- a/src/qt3support/text/q3textedit.cpp
+++ b/src/qt3support/text/q3textedit.cpp
@@ -6238,7 +6238,7 @@ void Q3TextEdit::optimParseTags(QString * line, int lineNo, int indexOffset)
} else {
tmp = tagStack.isEmpty() ? 0 : tagStack.pop();
if (!tmp) {
- if (((QLatin1Char('/') + cur->tag) == tag->tag) ||
+ if ((QString(QLatin1Char('/') + cur->tag) == tag->tag) ||
(tag->tag == QLatin1String("/font") && cur->tag.left(4) == QLatin1String("font"))) {
// set up the left and parent of this tag
tag->leftTag = cur;