summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp9
-rw-r--r--src/corelib/codecs/qutfcodec.cpp8
-rw-r--r--src/corelib/global/qglobal.h1
-rw-r--r--src/corelib/io/qdir.cpp6
-rw-r--r--src/corelib/io/qsettings.cpp14
-rw-r--r--src/corelib/tools/qlist.h31
-rw-r--r--src/gui/kernel/qkeysequence.cpp16
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/text/qfontengine.cpp3
-rw-r--r--src/gui/text/qfontengine_ft.cpp13
-rw-r--r--src/gui/text/qfontengine_qpa.cpp13
-rw-r--r--src/gui/text/qfontengine_qpf.cpp13
-rw-r--r--src/gui/text/qfontenginedirectwrite.cpp13
-rw-r--r--src/gui/text/qtextcursor.cpp4
-rw-r--r--src/gui/text/qtextengine.cpp3
-rw-r--r--src/gui/text/qtexthtmlparser.cpp12
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp20
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp3
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h4
-rw-r--r--src/plugins/codecs/cn/qgb18030codec.cpp14
-rw-r--r--src/plugins/platforms/directfb/qdirectfbglcontext.cpp2
-rw-r--r--src/plugins/plugins.pro1
-rw-r--r--src/sql/kernel/qsqlresult.cpp4
-rw-r--r--src/tools/moc/moc.cpp4
-rw-r--r--src/v8/v8.pri5
-rw-r--r--src/widgets/platforms/mac/qfontengine_mac.mm23
-rw-r--r--src/widgets/platforms/s60/qfontengine_s60.cpp13
-rw-r--r--src/widgets/platforms/win/qcursor_win.cpp1
-rw-r--r--src/widgets/platforms/win/qfontengine_win.cpp13
-rw-r--r--src/widgets/styles/qcommonstyle.cpp18
-rw-r--r--src/widgets/widgets/qtabbar.cpp2
31 files changed, 135 insertions, 155 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 944be3620f..f28133be77 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -213,12 +213,13 @@ QTextCodecCleanup::~QTextCodecCleanup()
destroying_is_ok = true;
#endif
- for (QList<QTextCodec *>::const_iterator it = all->constBegin()
- ; it != all->constEnd(); ++it) {
+ QList<QTextCodec *> *myAll = all;
+ all = 0; // Otherwise the d'tor destroys the iterator
+ for (QList<QTextCodec *>::const_iterator it = myAll->constBegin()
+ ; it != myAll->constEnd(); ++it) {
delete *it;
}
- delete all;
- all = 0;
+ delete myAll;
localeMapper = 0;
#ifdef Q_DEBUG_TEXTCODEC
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index f59f40430a..aaebec3c25 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -90,8 +90,8 @@ QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::Conve
while (ch < end) {
uint u = ch->unicode();
if (surrogate_high >= 0) {
- if (u >= 0xdc00 && u < 0xe000) {
- u = (surrogate_high - 0xd800)*0x400 + (u - 0xdc00) + 0x10000;
+ if (ch->isLowSurrogate()) {
+ u = QChar::surrogateToUcs4(surrogate_high, u);
surrogate_high = -1;
} else {
// high surrogate without low
@@ -101,13 +101,13 @@ QByteArray QUtf8::convertFromUnicode(const QChar *uc, int len, QTextCodec::Conve
surrogate_high = -1;
continue;
}
- } else if (u >= 0xdc00 && u < 0xe000) {
+ } else if (ch->isLowSurrogate()) {
// low surrogate without high
*cursor = replacement;
++ch;
++invalid;
continue;
- } else if (u >= 0xd800 && u < 0xdc00) {
+ } else if (ch->isHighSurrogate()) {
surrogate_high = u;
++ch;
continue;
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 71d0c720e6..1cfd70112f 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1420,6 +1420,7 @@ class QDataStream;
# define Q_QTQUICK1_EXPORT
# define Q_OPENGL_EXPORT
# define Q_MULTIMEDIA_EXPORT
+# define Q_OPENVG_EXPORT
# define Q_XML_EXPORT
# define Q_XMLPATTERNS_EXPORT
# define Q_SCRIPT_EXPORT
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 731c485b34..9faa9f17b3 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -1970,7 +1970,7 @@ QString QDir::cleanPath(const QString &path)
const QChar *p = name.unicode();
for (int i = 0, last = -1, iwrite = 0; i < len; ++i) {
if (p[i] == QLatin1Char('/')) {
- while (i < len-1 && p[i+1] == QLatin1Char('/')) {
+ while (i+1 < len && p[i+1] == QLatin1Char('/')) {
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) //allow unc paths
if (!i)
break;
@@ -1978,9 +1978,9 @@ QString QDir::cleanPath(const QString &path)
i++;
}
bool eaten = false;
- if (i < len - 1 && p[i+1] == QLatin1Char('.')) {
+ if (i+1 < len && p[i+1] == QLatin1Char('.')) {
int dotcount = 1;
- if (i < len - 2 && p[i+2] == QLatin1Char('.'))
+ if (i+2 < len && p[i+2] == QLatin1Char('.'))
dotcount++;
if (i == len - dotcount - 1) {
if (dotcount == 1) {
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 7e40e5f73b..6d3fbfb592 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -66,13 +66,12 @@
#ifndef QT_NO_QOBJECT
#include "qcoreapplication.h"
+#endif
#ifdef Q_OS_WIN // for homedirpath reading from registry
#include "qt_windows.h"
#include <private/qsystemlibrary_p.h>
-
-#endif // Q_OS_WIN
-#endif // QT_NO_QOBJECT
+#endif
#ifdef Q_OS_VXWORKS
# include <ioLib.h>
@@ -1024,9 +1023,6 @@ static QString windowsConfigPath(int type)
{
QString result;
-#ifndef QT_NO_QOBJECT
- // We can't use QLibrary if there is QT_NO_QOBJECT is defined
- // This only happens when bootstrapping qmake.
#ifndef Q_OS_WINCE
QSystemLibrary library(QLatin1String("shell32"));
#else
@@ -1040,8 +1036,6 @@ static QString windowsConfigPath(int type)
result = QString::fromWCharArray(path);
}
-#endif // QT_NO_QOBJECT
-
if (result.isEmpty()) {
switch (type) {
#ifndef Q_OS_WINCE
@@ -1114,11 +1108,11 @@ static void initDefaultPaths(QMutexLocker *locker)
userPath += QLatin1String(".config");
#endif
} else if (*env == '/') {
- userPath = QLatin1String(env);
+ userPath = QFile::decodeName(env);
} else {
userPath = homePath;
userPath += QLatin1Char('/');
- userPath += QLatin1String(env);
+ userPath += QFile::decodeName(env);
}
userPath += QLatin1Char('/');
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index b4c35b8d35..a215cc689a 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -750,25 +750,32 @@ Q_OUTOFLINE_TEMPLATE void QList<T>::clear()
template <typename T>
Q_OUTOFLINE_TEMPLATE int QList<T>::removeAll(const T &_t)
{
- detachShared();
+ int index = indexOf(_t);
+ if (index == -1)
+ return 0;
+
const T t = _t;
- int removedCount=0, i=0;
- Node *n;
- while (i < p.size())
- if ((n = reinterpret_cast<Node *>(p.at(i)))->t() == t) {
- node_destruct(n);
- p.remove(i);
- ++removedCount;
- } else {
- ++i;
- }
+ detach();
+
+ Node *i = reinterpret_cast<Node *>(p.at(index));
+ Node *e = reinterpret_cast<Node *>(p.end());
+ Node *n = i;
+ node_destruct(i);
+ while (++i != e) {
+ if (i->t() == t)
+ node_destruct(i);
+ else
+ *n++ = *i;
+ }
+
+ int removedCount = e - n;
+ d->end -= removedCount;
return removedCount;
}
template <typename T>
Q_OUTOFLINE_TEMPLATE bool QList<T>::removeOne(const T &_t)
{
- detachShared();
int index = indexOf(_t);
if (index != -1) {
removeAt(index);
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 58ac03e92b..0c7af19d34 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1380,11 +1380,11 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
QString p;
if (key && key < Qt::Key_Escape && key != Qt::Key_Space) {
- if (key < 0x10000) {
- p = QChar(key & 0xffff).toUpper();
+ if (!QChar::requiresSurrogates(key)) {
+ p = QChar(ushort(key)).toUpper();
} else {
- p = QChar((key-0x10000)/0x400+0xd800);
- p += QChar((key-0x10000)%400+0xdc00);
+ p += QChar(QChar::highSurrogate(key));
+ p += QChar(QChar::lowSurrogate(key));
}
} else if (key >= Qt::Key_F1 && key <= Qt::Key_F35) {
p = nativeText ? QCoreApplication::translate("QShortcut", "F%1").arg(key - Qt::Key_F1 + 1)
@@ -1417,11 +1417,11 @@ NonSymbol:
// Or else characters like Qt::Key_aring may not get displayed
// (Really depends on you locale)
if (!keyname[i].name) {
- if (key < 0x10000) {
- p = QChar(key & 0xffff).toUpper();
+ if (!QChar::requiresSurrogates(key)) {
+ p = QChar(ushort(key)).toUpper();
} else {
- p = QChar((key-0x10000)/0x400+0xd800);
- p += QChar((key-0x10000)%400+0xdc00);
+ p += QChar(QChar::highSurrogate(key));
+ p += QChar(QChar::lowSurrogate(key));
}
}
}
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 566b4d5f61..4d4b88b229 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -3405,7 +3405,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
spans[n].y = y;
spans[n].coverage = 255;
int len = 1;
- while (src_x < w-1 && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) {
+ while (src_x+1 < w && src[(src_x+1) >> 3] & (0x1 << ((src_x+1) & 7))) {
++src_x;
++len;
}
@@ -3431,7 +3431,7 @@ void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSp
spans[n].y = y;
spans[n].coverage = 255;
int len = 1;
- while (src_x < w-1 && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) {
+ while (src_x+1 < w && src[(src_x+1) >> 3] & (0x80 >> ((src_x+1) & 7))) {
++src_x;
++len;
}
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index a89bb18e94..f7f3b0e900 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1344,8 +1344,7 @@ bool QFontEngineMulti::stringToCMap(const QChar *str, int len,
int glyph_pos = 0;
for (int i = 0; i < len; ++i) {
- bool surrogate = (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00 && i < len-1
- && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000);
+ bool surrogate = (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate());
if (glyphs->glyphs[glyph_pos] == 0 && str[i].category() != QChar::Separator_Line) {
QGlyphLayoutInstance tmp = glyphs->instance(glyph_pos);
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 25c7268a9c..0755d9d22f 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1417,15 +1417,12 @@ void QFontEngineFT::getUnscaledGlyph(glyph_t glyph, QPainterPath *path, glyph_me
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
+ uint ucs4 = str[i].unicode();
+ if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
+ ++i;
+ ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
}
- return uc;
+ return ucs4;
}
bool QFontEngineFT::canRender(const QChar *string, int len)
diff --git a/src/gui/text/qfontengine_qpa.cpp b/src/gui/text/qfontengine_qpa.cpp
index 6fd85150e3..7c09ae7cf8 100644
--- a/src/gui/text/qfontengine_qpa.cpp
+++ b/src/gui/text/qfontengine_qpa.cpp
@@ -225,15 +225,12 @@ QVariant QFontEngineQPA::extractHeaderField(const uchar *data, HeaderTag request
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
+ uint ucs4 = str[i].unicode();
+ if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
+ ++i;
+ ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
}
- return uc;
+ return ucs4;
}
QFontEngineQPA::QFontEngineQPA(const QFontDef &def, const QByteArray &data)
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index 4c1045e2d5..584cdc0d66 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -278,15 +278,12 @@ QList<QByteArray> QFontEngineQPF::cleanUpAfterClientCrash(const QList<int> &cras
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
+ uint ucs4 = str[i].unicode();
+ if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
+ ++i;
+ ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
}
- return uc;
+ return ucs4;
}
#ifdef QT_FONTS_ARE_RESOURCES
QFontEngineQPF::QFontEngineQPF(const QFontDef &def, const uchar *bytes, int size)
diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp
index d6932738f5..5bac1172fa 100644
--- a/src/gui/text/qfontenginedirectwrite.cpp
+++ b/src/gui/text/qfontenginedirectwrite.cpp
@@ -269,15 +269,12 @@ QFixed QFontEngineDirectWrite::emSquareSize() const
inline unsigned int getChar(const QChar *str, int &i, const int len)
{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
+ uint ucs4 = str[i].unicode();
+ if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
+ ++i;
+ ucs4 = QChar::surrogateToUcs4( ucs4, str[i].unicode());
}
- return uc;
+ return ucs4;
}
bool QFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs,
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 8bbe86c4f3..2bebf4c861 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1511,11 +1511,11 @@ void QTextCursor::deletePreviousChar()
const QTextFragmentData * const frag = fragIt.value();
int fpos = fragIt.position();
QChar uc = d->priv->buffer().at(d->anchor - fpos + frag->stringPosition);
- if (d->anchor > fpos && uc.unicode() >= 0xdc00 && uc.unicode() < 0xe000) {
+ if (d->anchor > fpos && uc.isLowSurrogate()) {
// second half of a surrogate, check if we have the first half as well,
// if yes delete both at once
uc = d->priv->buffer().at(d->anchor - 1 - fpos + frag->stringPosition);
- if (uc.unicode() >= 0xd800 && uc.unicode() < 0xdc00)
+ if (uc.isHighSurrogate())
--d->anchor;
}
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 91c96fce80..97d5a3baaf 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -993,8 +993,7 @@ static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayou
int glyph_pos = 0;
for (int i = 0; i < length; i++) {
- if (uc[i].unicode() >= 0xd800 && uc[i].unicode() < 0xdc00 && i < length-1
- && uc[i+1].unicode() >= 0xdc00 && uc[i+1].unicode() < 0xe000) {
+ if (uc[i].isHighSurrogate() && i < length-1 && uc[i+1].isLowSurrogate()) {
logClusters[i] = glyph_pos;
logClusters[++i] = glyph_pos;
} else {
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index 41dc1130ee..ced71f5c60 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -820,15 +820,11 @@ QString QTextHtmlParser::parseEntity()
if (uc >= 0x80 && uc < 0x80 + (sizeof(windowsLatin1ExtendedCharacters)/sizeof(windowsLatin1ExtendedCharacters[0])))
uc = windowsLatin1ExtendedCharacters[uc - 0x80];
QString str;
- if (uc > 0xffff) {
- // surrogate pair
- uc -= 0x10000;
- ushort high = uc/0x400 + 0xd800;
- ushort low = uc%0x400 + 0xdc00;
- str.append(QChar(high));
- str.append(QChar(low));
+ if (QChar::requiresSurrogates(uc)) {
+ str += QChar(QChar::highSurrogate(uc));
+ str += QChar(QChar::lowSurrogate(uc));
} else {
- str.append(QChar(uc));
+ str = QChar(uc);
}
return str;
}
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index fc4eccc761..c368785226 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -49,6 +49,7 @@
#include "private/qhostinfo_p.h"
#include <qnetworkproxy.h>
#include <qauthenticator.h>
+#include <qcoreapplication.h>
#include <qbuffer.h>
#include <qpair.h>
@@ -720,32 +721,31 @@ QString QHttpNetworkConnectionPrivate::errorDetail(QNetworkReply::NetworkError e
QString errorString;
switch (errorCode) {
case QNetworkReply::HostNotFoundError:
- errorString = QString::fromLatin1(QT_TRANSLATE_NOOP("QHttp", "Host %1 not found"))
- .arg(socket->peerName());
+ errorString = QCoreApplication::translate("QHttp", "Host %1 not found").arg(socket->peerName());
break;
case QNetworkReply::ConnectionRefusedError:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Connection refused"));
+ errorString = QCoreApplication::translate("QHttp", "Connection refused");
break;
case QNetworkReply::RemoteHostClosedError:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Connection closed"));
+ errorString = QCoreApplication::translate("QHttp", "Connection closed");
break;
case QNetworkReply::TimeoutError:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QAbstractSocket", "Socket operation timed out"));
+ errorString = QCoreApplication::translate("QAbstractSocket", "Socket operation timed out");
break;
case QNetworkReply::ProxyAuthenticationRequiredError:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Proxy requires authentication"));
+ errorString = QCoreApplication::translate("QHttp", "Proxy requires authentication");
break;
case QNetworkReply::AuthenticationRequiredError:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Host requires authentication"));
+ errorString = QCoreApplication::translate("QHttp", "Host requires authentication");
break;
case QNetworkReply::ProtocolFailure:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Data corrupted"));
+ errorString = QCoreApplication::translate("QHttp", "Data corrupted");
break;
case QNetworkReply::ProtocolUnknownError:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "Unknown protocol specified"));
+ errorString = QCoreApplication::translate("QHttp", "Unknown protocol specified");
break;
case QNetworkReply::SslHandshakeFailedError:
- errorString = QLatin1String(QT_TRANSLATE_NOOP("QHttp", "SSL handshake failed"));
+ errorString = QCoreApplication::translate("QHttp", "SSL handshake failed");
break;
default:
// all other errors are treated as QNetworkReply::UnknownNetworkError
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index d7eeb1c619..9c361e0cf4 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -51,6 +51,7 @@
#include "private/qnetworkaccesscache_p.h"
#include "private/qnoncontiguousbytedevice_p.h"
+#ifndef QT_NO_HTTP
QT_BEGIN_NAMESPACE
@@ -576,4 +577,6 @@ void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNet
#endif
+#endif // QT_NO_HTTP
+
QT_END_NAMESPACE
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index 15c76b13fd..d97193d7c7 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -68,6 +68,8 @@
#include "private/qnoncontiguousbytedevice_p.h"
#include "qnetworkaccessauthenticationmanager_p.h"
+#ifndef QT_NO_HTTP
+
QT_BEGIN_NAMESPACE
class QAuthenticator;
@@ -285,4 +287,6 @@ signals:
QT_END_NAMESPACE
+#endif // QT_NO_HTTP
+
#endif // QHTTPTHREADDELEGATE_H
diff --git a/src/plugins/codecs/cn/qgb18030codec.cpp b/src/plugins/codecs/cn/qgb18030codec.cpp
index 0a45eeb1ab..d12f5d91f6 100644
--- a/src/plugins/codecs/cn/qgb18030codec.cpp
+++ b/src/plugins/codecs/cn/qgb18030codec.cpp
@@ -108,10 +108,10 @@ QByteArray QGb18030Codec::convertFromUnicode(const QChar *uc, int len, Converter
int len;
uchar buf[4];
if (high >= 0) {
- if (ch >= 0xdc00 && ch < 0xe000) {
+ if (uc[i].isLowSurrogate()) {
// valid surrogate pair
++i;
- uint u = (high-0xd800)*0x400+(ch-0xdc00)+0x10000;
+ uint u = QChar::surrogateToUcs4(high, uc[i].unicode());
len = qt_UnicodeToGb18030(u, buf);
if (len >= 2) {
for (int j=0; j<len; j++)
@@ -129,10 +129,10 @@ QByteArray QGb18030Codec::convertFromUnicode(const QChar *uc, int len, Converter
}
}
- if (ch < 0x80) {
+ if (IsLatin(ch)) {
// ASCII
*cursor++ = ch;
- } else if ((ch >= 0xd800 && ch < 0xdc00)) {
+ } else if (uc[i].isHighSurrogate()) {
// surrogates area. check for correct encoding
// we need at least one more character, first the high surrogate, then the low one
high = ch;
@@ -181,7 +181,7 @@ QString QGb18030Codec::convertToUnicode(const char* chars, int len, ConverterSta
uchar ch = chars[i];
switch (nbuf) {
case 0:
- if (ch < 0x80) {
+ if (IsLatin(ch)) {
// ASCII
resultData[unicodeLen] = ch;
++unicodeLen;
@@ -339,7 +339,7 @@ QString QGbkCodec::convertToUnicode(const char* chars, int len, ConverterState *
uchar ch = chars[i];
switch (nbuf) {
case 0:
- if (ch < 0x80) {
+ if (IsLatin(ch)) {
// ASCII
resultData[unicodeLen] = ch;
++unicodeLen;
@@ -487,7 +487,7 @@ QString QGb2312Codec::convertToUnicode(const char* chars, int len, ConverterStat
uchar ch = chars[i];
switch (nbuf) {
case 0:
- if (ch < 0x80) {
+ if (IsLatin(ch)) {
// ASCII
resultData[unicodeLen] = ch;
++unicodeLen;
diff --git a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
index c187ec7f66..1121a42944 100644
--- a/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbglcontext.cpp
@@ -41,7 +41,7 @@
#include "qdirectfbglcontext.h"
-#include <directfb/directfbgl.h>
+#include <directfbgl.h>
#include <QDebug>
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 5203daccdf..f47c000dfb 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -8,6 +8,7 @@ unix:!symbian {
}
!contains(QT_CONFIG, no-gui): SUBDIRS *= imageformats
!symbian:!contains(QT_CONFIG, no-gui):SUBDIRS += accessible
+
symbian:SUBDIRS += s60
qpa: {
SUBDIRS += platforms
diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp
index f2b2ccf779..71a81c0a8d 100644
--- a/src/sql/kernel/qsqlresult.cpp
+++ b/src/sql/kernel/qsqlresult.cpp
@@ -183,7 +183,7 @@ QString QSqlResultPrivate::namedToPositionalBinding()
QChar ch = sql.at(i);
if (ch == QLatin1Char(':') && !inQuote
&& (i == 0 || sql.at(i - 1) != QLatin1Char(':'))
- && (i < n - 1 && qIsAlnum(sql.at(i + 1)))) {
+ && (i + 1 < n && qIsAlnum(sql.at(i + 1)))) {
int pos = i + 2;
while (pos < n && qIsAlnum(sql.at(pos)))
++pos;
@@ -618,7 +618,7 @@ bool QSqlResult::prepare(const QString& query)
QChar ch = query.at(i);
if (ch == QLatin1Char(':') && !inQuote
&& (i == 0 || query.at(i - 1) != QLatin1Char(':'))
- && (i < n - 1 && qIsAlnum(query.at(i + 1)))) {
+ && (i + 1 < n && qIsAlnum(query.at(i + 1)))) {
int pos = i + 2;
while (pos < n && qIsAlnum(query.at(pos)))
++pos;
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 13f57f592d..9309db1c90 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -216,8 +216,8 @@ Type Moc::parseType()
QByteArray templ = lexemUntil(RANGLE);
for (int i = 0; i < templ.size(); ++i) {
type.name += templ.at(i);
- if ((templ.at(i) == '<' && i < templ.size()-1 && templ.at(i+1) == ':')
- || (templ.at(i) == '>' && i < templ.size()-1 && templ.at(i+1) == '>')) {
+ if ((templ.at(i) == '<' && i+1 < templ.size() && templ.at(i+1) == ':')
+ || (templ.at(i) == '>' && i+1 < templ.size() && templ.at(i+1) == '>')) {
type.name += ' ';
}
}
diff --git a/src/v8/v8.pri b/src/v8/v8.pri
index 6300ca989e..1d1abc85c0 100644
--- a/src/v8/v8.pri
+++ b/src/v8/v8.pri
@@ -18,7 +18,10 @@ else:error("Couldn't detect supported architecture ($$QMAKE_HOST.arch/$$QT_ARCH)
include($$PWD/v8base.pri)
-V8_GENERATED_SOURCES_DIR = generated
+# In debug-and-release builds, generated sources must not go to the same
+# directory, or they could clobber each other in highly parallelized builds
+CONFIG(debug, debug|release):V8_GENERATED_SOURCES_DIR = generated-debug
+else: V8_GENERATED_SOURCES_DIR = generated-release
!contains(QT_CONFIG, static): DEFINES += V8_SHARED BUILDING_V8_SHARED
diff --git a/src/widgets/platforms/mac/qfontengine_mac.mm b/src/widgets/platforms/mac/qfontengine_mac.mm
index 9d9eaed058..6186b2f514 100644
--- a/src/widgets/platforms/mac/qfontengine_mac.mm
+++ b/src/widgets/platforms/mac/qfontengine_mac.mm
@@ -257,10 +257,8 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS
#if !defined(QT_NO_DEBUG)
int surrogates = 0;
const QChar *str = item->string;
- for (int i = item->from; i < item->from + item->length - 1; ++i) {
- surrogates += (str[i].unicode() >= 0xd800 && str[i].unicode() < 0xdc00
- && str[i+1].unicode() >= 0xdc00 && str[i+1].unicode() < 0xe000);
- }
+ for (int i = item->from; i < item->from + item->length - 1; ++i)
+ surrogates += (str[i].isHighSurrogate() && str[i+1].isLowSurrogate());
#endif
for (nextCharStop = item->from; nextCharStop < item->from + item->length; ++nextCharStop)
if (item->charAttributes[nextCharStop].charStop)
@@ -328,10 +326,8 @@ static OSStatus atsuPostLayoutCallback(ATSULayoutOperationSelector selector, ATS
if (charOffset < item->length - 1) {
QChar current = item->string[item->from + charOffset];
QChar next = item->string[item->from + charOffset + 1];
- if (current.unicode() >= 0xd800 && current.unicode() < 0xdc00
- && next.unicode() >= 0xdc00 && next.unicode() < 0xe000) {
+ if (current.isHighSurrogate() && next.isLowSurrogate())
item->log_clusters[charOffset + 1] = currentClusterGlyph;
- }
}
}
}
@@ -738,15 +734,12 @@ QFontEngineMac::~QFontEngineMac()
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
+ uint ucs4 = str[i].unicode();
+ if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
+ ++i;
+ ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
}
- return uc;
+ return ucs4;
}
// Not used directly for shaping, only used to calculate m_averageCharWidth
diff --git a/src/widgets/platforms/s60/qfontengine_s60.cpp b/src/widgets/platforms/s60/qfontengine_s60.cpp
index 2bcee0157c..b4de066306 100644
--- a/src/widgets/platforms/s60/qfontengine_s60.cpp
+++ b/src/widgets/platforms/s60/qfontengine_s60.cpp
@@ -233,15 +233,12 @@ bool QSymbianTypeFaceExtras::symbianFontTableApiAvailable()
// duplicated from qfontengine_xyz.cpp
static inline unsigned int getChar(const QChar *str, int &i, const int len)
{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
+ uint ucs4 = str[i].unicode();
+ if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
+ ++i;
+ ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
}
- return uc;
+ return ucs4;
}
extern QString qt_symbian_fontNameWithAppFontMarker(const QString &fontName); // qfontdatabase_s60.cpp
diff --git a/src/widgets/platforms/win/qcursor_win.cpp b/src/widgets/platforms/win/qcursor_win.cpp
index 9f0c516f8b..cef83f5a1b 100644
--- a/src/widgets/platforms/win/qcursor_win.cpp
+++ b/src/widgets/platforms/win/qcursor_win.cpp
@@ -477,6 +477,7 @@ void QCursorData::update()
QPixmap pixmap = QApplicationPrivate::instance()->getPixmapCursor(cshape);
hcurs = create32BitCursor(pixmap, hx, hy);
}
+ break;
default:
qWarning("QCursor::update: Invalid cursor shape %d", cshape);
return;
diff --git a/src/widgets/platforms/win/qfontengine_win.cpp b/src/widgets/platforms/win/qfontengine_win.cpp
index aef2145e5e..fc11387367 100644
--- a/src/widgets/platforms/win/qfontengine_win.cpp
+++ b/src/widgets/platforms/win/qfontengine_win.cpp
@@ -224,15 +224,12 @@ void QFontEngineWin::getCMap()
inline unsigned int getChar(const QChar *str, int &i, const int len)
{
- unsigned int uc = str[i].unicode();
- if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) {
- uint low = str[i+1].unicode();
- if (low >= 0xdc00 && low < 0xe000) {
- uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000;
- ++i;
- }
+ uint ucs4 = str[i].unicode();
+ if (str[i].isHighSurrogate() && i < len-1 && str[i+1].isLowSurrogate()) {
+ ++i;
+ ucs4 = QChar::surrogateToUcs4(ucs4, str[i].unicode());
}
- return uc;
+ return ucs4;
}
int QFontEngineWin::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs, bool mirrored) const
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index ad0e151051..327bedfdba 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -837,14 +837,12 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut
QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const
{
- Q_Q(const QCommonStyle);
-
const QWidget *widget = option->widget;
switch (role) {
case Qt::CheckStateRole:
if (option->features & QStyleOptionViewItemV2::HasCheckIndicator)
- return QSize(q->pixelMetric(QStyle::PM_IndicatorWidth, option, widget),
- q->pixelMetric(QStyle::PM_IndicatorHeight, option, widget));
+ return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget),
+ proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget));
break;
case Qt::DisplayRole:
if (option->features & QStyleOptionViewItemV2::HasDisplay) {
@@ -855,7 +853,7 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, in
textLayout.setFont(option->font);
textLayout.setText(option->text);
const bool wrapText = option->features & QStyleOptionViewItemV2::WrapText;
- const int textMargin = q->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1;
+ const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1;
QRect bounds = option->rect;
switch (option->decorationPosition) {
case QStyleOptionViewItem::Left:
@@ -919,9 +917,8 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect) const
{
- Q_Q(const QCommonStyle);
const QWidget *widget = option->widget;
- const int textMargin = q->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1;
+ const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, widget) + 1;
QRect textRect = rect.adjusted(textMargin, 0, -textMargin, 0); // remove width padding
const bool wrapText = option->features & QStyleOptionViewItemV2::WrapText;
@@ -999,7 +996,6 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt
void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRect *checkRect,
QRect *pixmapRect, QRect *textRect, bool sizehint) const
{
- Q_Q(const QCommonStyle);
Q_ASSERT(checkRect && pixmapRect && textRect);
*pixmapRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DecorationRole));
*textRect = QRect(QPoint(0, 0), viewItemSize(opt, Qt::DisplayRole));
@@ -1009,9 +1005,9 @@ void QCommonStylePrivate::viewItemLayout(const QStyleOptionViewItemV4 *opt, QRe
const bool hasCheck = checkRect->isValid();
const bool hasPixmap = pixmapRect->isValid();
const bool hasText = textRect->isValid();
- const int textMargin = hasText ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
- const int pixmapMargin = hasPixmap ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
- const int checkMargin = hasCheck ? q->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
+ const int textMargin = hasText ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
+ const int pixmapMargin = hasPixmap ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
+ const int checkMargin = hasCheck ? proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, opt, widget) + 1 : 0;
int x = opt->rect.left();
int y = opt->rect.top();
int w, h;
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index 16e4aad6d0..8faf156608 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -171,7 +171,7 @@ void QTabBar::initStyleOption(QStyleOptionTab *option, int tabIndex) const
if (tabIndex > 0 && tabIndex - 1 == d->currentIndex)
option->selectedPosition = QStyleOptionTab::PreviousIsSelected;
- else if (tabIndex < totalTabs - 1 && tabIndex + 1 == d->currentIndex)
+ else if (tabIndex + 1 < totalTabs && tabIndex + 1 == d->currentIndex)
option->selectedPosition = QStyleOptionTab::NextIsSelected;
else
option->selectedPosition = QStyleOptionTab::NotAdjacent;