[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: qt-copy
From: Alexis_Ménard <menard () kde ! org>
Date: 2009-02-23 21:51:30
Message-ID: 81941aea0902231351w6885993ao7c13b633b15c737d () mail ! gmail ! com
[Download RAW message or body]
Same why patching the src file directly? It can be a big mess especially if
i don't want to apply the patch or write another one that doesn't need this
one to work...
On Thu, Feb 19, 2009 at 6:18 PM, David Faure <faure@kde.org> wrote:
> 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
>
[Attachment #3 (text/html)]
Same why patching the src file directly? It can be a big mess especially if i \
don't want to apply the patch or write another one that doesn't need this one \
to work...<br><br><div class="gmail_quote">On Thu, Feb 19, 2009 at 6:18 PM, David \
Faure <span dir="ltr"><<a href="mailto:faure@kde.org">faure@kde.org</a>></span> \
wrote:<br> <blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">SVN commit 928628 by \
dfaure:<br> <br>
Fix for the toLocal8Bit() regression (broken if used once before QCoreApplication), \
provided by Thiago<br> <br>
<br>
A \
patches/0272-qiconvcodec-fix.diff<br> M +1 -1 \
patches/README<br> M +12 -4 \
src/corelib/codecs/qiconvcodec.cpp<br> M +3 -0 \
src/corelib/kernel/qcoreapplication.cpp<br> <br>
<br>
--- trunk/qt-copy/patches/README #928627:928628<br>
@@ -1,5 +1,5 @@<br>
Please assign the numbers incrementally, and don't reuse them. The next \
one:<br>
-#0272<br>
+#0273<br>
<br>
This directory contains patches for Qt that haven't been accepted by \
TrollTech<br> yet. All patches in this directory itself shouldn't make \
qt-copy incompatible<br>
--- trunk/qt-copy/src/corelib/codecs/qiconvcodec.cpp #928627:928628<br>
@@ -83,6 +83,8 @@<br>
<br>
QT_BEGIN_NAMESPACE<br>
<br>
+extern bool qt_locale_initialized;<br>
+<br>
QIconvCodec::QIconvCodec()<br>
: utf16Codec(0)<br>
{<br>
@@ -182,8 +184,9 @@<br>
}<br>
} else {<br>
QThreadStorage<QIconvCodec::IconvState *> *ts = \
toUnicodeState();<br>
- if (!ts) {<br>
+ if (!qt_locale_initialized || !ts) {<br>
// we're running after the \
Q_GLOBAL_STATIC has been deleted<br> + // or \
before the QCoreApplication initialization<br> \
// bad programmer, no cookie for you<br> \
return QString::fromLatin1(chars, len);<br> }<br>
@@ -305,9 +308,14 @@<br>
#endif<br>
<br>
QThreadStorage<QIconvCodec::IconvState *> *ts = \
fromUnicodeState();<br>
- if (!ts) {<br>
+ if (!qt_locale_initialized || !ts) {<br>
// we're running after the Q_GLOBAL_STATIC has been \
deleted<br> + // or before the QCoreApplication \
initialization<br> // bad programmer, no cookie for \
you<br> + if (!len)<br>
+ // this is a special case - zero-sized \
string should be<br> + // translated to \
empty but not-null QByteArray.<br> + return \
QByteArray("");<br> return \
QString::fromRawData(uc, len).toLatin1();<br> }<br>
IconvState *&state = ts->localData();<br>
@@ -384,8 +392,8 @@<br>
// fall through<br>
case EINVAL:<br>
{<br>
- ++inBytes;<br>
- \
--inBytesLeft;<br> + \
inBytes += sizeof(QChar);<br> + \
inBytesLeft -= sizeof(QChar);<br> \
break;<br> \
}<br> \
case E2BIG:<br>
--- trunk/qt-copy/src/corelib/kernel/qcoreapplication.cpp #928627:928628<br>
@@ -163,6 +163,8 @@<br>
bool QCoreApplicationPrivate::is_app_running = false;<br>
// app closing down if true<br>
bool QCoreApplicationPrivate::is_app_closing = false;<br>
+// initialized in qcoreapplication and in qtextstream autotest when setlocale is \
called.<br> +Q_AUTOTEST_EXPORT bool qt_locale_initialized = false;<br>
<br>
<br>
Q_CORE_EXPORT uint qGlobalPostedEventsCount()<br>
@@ -440,6 +442,7 @@<br>
<br>
#ifdef Q_OS_UNIX<br>
setlocale(LC_ALL, ""); \
// use correct char set mapping<br> + \
qt_locale_initialized = true;<br> #endif<br>
<br>
#ifdef Q_WS_WIN<br>
</blockquote></div><br>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic