[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: qt-copy
From: David Faure <faure () kde ! org>
Date: 2009-02-19 17:18:27
Message-ID: 1235063907.800498.2795.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 928628 by dfaure:
Fix for the toLocal8Bit() regression (broken if used once before QCoreApplication), provided by Thiago
A patches/0272-qiconvcodec-fix.diff
M +1 -1 patches/README
M +12 -4 src/corelib/codecs/qiconvcodec.cpp
M +3 -0 src/corelib/kernel/qcoreapplication.cpp
--- trunk/qt-copy/patches/README #928627:928628
@@ -1,5 +1,5 @@
Please assign the numbers incrementally, and don't reuse them. The next one:
-#0272
+#0273
This directory contains patches for Qt that haven't been accepted by TrollTech
yet. All patches in this directory itself shouldn't make qt-copy incompatible
--- trunk/qt-copy/src/corelib/codecs/qiconvcodec.cpp #928627:928628
@@ -83,6 +83,8 @@
QT_BEGIN_NAMESPACE
+extern bool qt_locale_initialized;
+
QIconvCodec::QIconvCodec()
: utf16Codec(0)
{
@@ -182,8 +184,9 @@
}
} else {
QThreadStorage<QIconvCodec::IconvState *> *ts = toUnicodeState();
- if (!ts) {
+ if (!qt_locale_initialized || !ts) {
// we're running after the Q_GLOBAL_STATIC has been deleted
+ // or before the QCoreApplication initialization
// bad programmer, no cookie for you
return QString::fromLatin1(chars, len);
}
@@ -305,9 +308,14 @@
#endif
QThreadStorage<QIconvCodec::IconvState *> *ts = fromUnicodeState();
- if (!ts) {
+ if (!qt_locale_initialized || !ts) {
// we're running after the Q_GLOBAL_STATIC has been deleted
+ // or before the QCoreApplication initialization
// bad programmer, no cookie for you
+ if (!len)
+ // this is a special case - zero-sized string should be
+ // translated to empty but not-null QByteArray.
+ return QByteArray("");
return QString::fromRawData(uc, len).toLatin1();
}
IconvState *&state = ts->localData();
@@ -384,8 +392,8 @@
// fall through
case EINVAL:
{
- ++inBytes;
- --inBytesLeft;
+ inBytes += sizeof(QChar);
+ inBytesLeft -= sizeof(QChar);
break;
}
case E2BIG:
--- trunk/qt-copy/src/corelib/kernel/qcoreapplication.cpp #928627:928628
@@ -163,6 +163,8 @@
bool QCoreApplicationPrivate::is_app_running = false;
// app closing down if true
bool QCoreApplicationPrivate::is_app_closing = false;
+// initialized in qcoreapplication and in qtextstream autotest when setlocale is called.
+Q_AUTOTEST_EXPORT bool qt_locale_initialized = false;
Q_CORE_EXPORT uint qGlobalPostedEventsCount()
@@ -440,6 +442,7 @@
#ifdef Q_OS_UNIX
setlocale(LC_ALL, ""); // use correct char set mapping
+ qt_locale_initialized = true;
#endif
#ifdef Q_WS_WIN
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic