summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-05 17:09:35 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-05 17:09:35 (GMT)
commit930c6554022cd30149912c92e88a7884609b44ba (patch)
treecc8cc506a4f7ff70fe459c0b38d4c07b71989bb4 /src/corelib
parent420fa181ed9f3947e257dc84f5cf3c8f7c94b9ba (diff)
parente0534e6cb81894e1fb69ab5c1855aee09db31ead (diff)
downloadQt-930c6554022cd30149912c92e88a7884609b44ba.zip
Qt-930c6554022cd30149912c92e88a7884609b44ba.tar.gz
Qt-930c6554022cd30149912c92e88a7884609b44ba.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Fix build with Mesa 7.8's EGL implementatioon Reset the byte order in the iconv codec after using it. fix "using namespace" recursion crash Fixed key mappings on X11 QDom: prevent infinite loop when cloning a DTD QPrintPreviewDialog number of pages is partially blocked from view in OSX Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( f3110d2f94c825477afac054ed448e45d47f5670 )
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/codecs/qiconvcodec.cpp41
-rw-r--r--src/corelib/global/qnamespace.qdoc34
2 files changed, 46 insertions, 29 deletions
diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp
index 0f73d9b..0fcdf96 100644
--- a/src/corelib/codecs/qiconvcodec.cpp
+++ b/src/corelib/codecs/qiconvcodec.cpp
@@ -299,6 +299,32 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState
Q_GLOBAL_STATIC(QThreadStorage<QIconvCodec::IconvState *>, fromUnicodeState)
+static bool setByteOrder(iconv_t cd)
+{
+#if !defined(NO_BOM)
+ // give iconv() a BOM
+ char buf[4];
+ ushort bom[] = { QChar::ByteOrderMark };
+
+ char *outBytes = buf;
+ char *inBytes = reinterpret_cast<char *>(bom);
+ size_t outBytesLeft = sizeof buf;
+ size_t inBytesLeft = sizeof bom;
+
+#if defined(GNU_LIBICONV)
+ const char **inBytesPtr = const_cast<const char **>(&inBytes);
+#else
+ char **inBytesPtr = &inBytes;
+#endif
+
+ if (iconv(cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) {
+ return false;
+ }
+#endif // NO_BOM
+
+ return true;
+}
+
QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterState *convState) const
{
char *inBytes;
@@ -325,17 +351,8 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
IconvState *&state = ts->localData();
if (!state) {
state = new IconvState(QIconvCodec::createIconv_t(0, UTF16));
- if (state->cd != reinterpret_cast<iconv_t>(-1)) {
- size_t outBytesLeft = len + 3; // +3 for the BOM
- QByteArray ba(outBytesLeft, Qt::Uninitialized);
- outBytes = ba.data();
-
-#if !defined(NO_BOM)
- // give iconv() a BOM
- QChar bom[] = { QChar(QChar::ByteOrderMark) };
- inBytes = reinterpret_cast<char *>(bom);
- inBytesLeft = sizeof(bom);
- if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) {
+ if (state->cd == reinterpret_cast<iconv_t>(-1)) {
+ if (!setByteOrder(state->cd)) {
perror("QIconvCodec::convertFromUnicode: using ASCII for conversion, iconv failed for BOM");
iconv_close(state->cd);
@@ -343,7 +360,6 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
return QString(uc, len).toAscii();
}
-#endif // NO_BOM
}
}
if (state->cd == reinterpret_cast<iconv_t>(-1)) {
@@ -422,6 +438,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt
// reset to initial state
iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft);
+ setByteOrder(state->cd);
ba.resize(ba.size() - outBytesLeft);
diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc
index 6968773..a756565 100644
--- a/src/corelib/global/qnamespace.qdoc
+++ b/src/corelib/global/qnamespace.qdoc
@@ -1622,22 +1622,22 @@
\value Key_OpenUrl
\value Key_LaunchMail
\value Key_LaunchMedia
- \value Key_Launch0
- \value Key_Launch1
- \value Key_Launch2
- \value Key_Launch3
- \value Key_Launch4
- \value Key_Launch5
- \value Key_Launch6
- \value Key_Launch7
- \value Key_Launch8
- \value Key_Launch9
- \value Key_LaunchA
- \value Key_LaunchB
- \value Key_LaunchC
- \value Key_LaunchD
- \value Key_LaunchE
- \value Key_LaunchF
+ \value Key_Launch0 On X11 this key is mapped to "My Computer" (XF86XK_MyComputer) key for legacy reasons.
+ \value Key_Launch1 On X11 this key is mapped to "Calculator" (XF86XK_Calculator) key for legacy reasons.
+ \value Key_Launch2 On X11 this key is mapped to XF86XK_Launch0 key for legacy reasons.
+ \value Key_Launch3 On X11 this key is mapped to XF86XK_Launch1 key for legacy reasons.
+ \value Key_Launch4 On X11 this key is mapped to XF86XK_Launch2 key for legacy reasons.
+ \value Key_Launch5 On X11 this key is mapped to XF86XK_Launch3 key for legacy reasons.
+ \value Key_Launch6 On X11 this key is mapped to XF86XK_Launch4 key for legacy reasons.
+ \value Key_Launch7 On X11 this key is mapped to XF86XK_Launch5 key for legacy reasons.
+ \value Key_Launch8 On X11 this key is mapped to XF86XK_Launch6 key for legacy reasons.
+ \value Key_Launch9 On X11 this key is mapped to XF86XK_Launch7 key for legacy reasons.
+ \value Key_LaunchA On X11 this key is mapped to XF86XK_Launch8 key for legacy reasons.
+ \value Key_LaunchB On X11 this key is mapped to XF86XK_Launch9 key for legacy reasons.
+ \value Key_LaunchC On X11 this key is mapped to XF86XK_LaunchA key for legacy reasons.
+ \value Key_LaunchD On X11 this key is mapped to XF86XK_LaunchB key for legacy reasons.
+ \value Key_LaunchE On X11 this key is mapped to XF86XK_LaunchC key for legacy reasons.
+ \value Key_LaunchF On X11 this key is mapped to XF86XK_LaunchD key for legacy reasons.
\value Key_MonBrightnessUp
\value Key_MonBrightnessDown
\value Key_KeyboardLightOnOff
@@ -1663,7 +1663,7 @@
\value Key_ApplicationRight
\value Key_Book
\value Key_CD
- \value Key_Calculator
+ \value Key_Calculator On X11 this key is not mapped for legacy reasons. Use Qt::Key_Launch1 instead.
\value Key_ToDoList
\value Key_ClearGrab
\value Key_Close