summaryrefslogtreecommitdiffstats
path: root/src/corelib/codecs/qtextcodec.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2012-02-22 16:17:30 +0100
committerQt by Nokia <qt-info@nokia.com>2012-02-26 09:14:11 +0100
commit8397a44bedf542b53284674c87268819f4911d31 (patch)
treecb3dd1025c99aaac9716d62a39ad3a6a5a17babf /src/corelib/codecs/qtextcodec.cpp
parentddf4b378f1e7eac62bd504a1e453cb7b894e21f2 (diff)
QByteArray: deprecate QT_NO_CAST_FROM_BYTEARRAY-protected operators
The QByteArray::operator const {char,void}*() implicit conversions are a source of subtle bugs, so they right- fully can be disabled with QT_NO_CAST_FROM_BYTEARRAY. const char *d = qstring.toLatin1(); // implicit conversion while ( d ) // oops: d points to freed memory // ... But almost no-one ever enabled this macros in the wild and many were bitten by these implicit conversions, so this patch deprecates them. I would have liked to remove them completely, but there are just too many occurrences even in Qt itself to hope to find all conditionally-compiled code that uses these. Also fixes all code that needs to compile under QT_NO_DEPRECATED (in qmake/, src/tools/). I984706452db7d0841620a0f64e179906123f3849 separately deals with the bulk of changes in src/ and examples/. Depends on I5ea1ad3c96d9e64167be53c0c418c7b7dba51f68. Change-Id: I8d47e6c293c80f61c6288c9f8d42fda41afe2267 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src/corelib/codecs/qtextcodec.cpp')
-rw-r--r--src/corelib/codecs/qtextcodec.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp
index 82e5c9a1c3..e49ebfb844 100644
--- a/src/corelib/codecs/qtextcodec.cpp
+++ b/src/corelib/codecs/qtextcodec.cpp
@@ -111,7 +111,7 @@ static bool qisalnum(register char c)
static bool nameMatch(const QByteArray &name, const QByteArray &test)
{
// if they're the same, return a perfect score
- if (qstricmp(name, test) == 0)
+ if (qstricmp(name.constData(), test.constData()) == 0)
return true;
const char *n = name.constData();
@@ -510,7 +510,7 @@ static QTextCodec * ru_RU_hack(const char * i) {
koi8r, latin5, i);
}
#if !defined(QT_NO_SETLOCALE)
- setlocale(LC_CTYPE, origlocale);
+ setlocale(LC_CTYPE, origlocale.constData());
#endif
return ru_RU_codec;
@@ -648,7 +648,7 @@ static void setupLocaleMapper()
else if (try_locale_list(pt_154locales, lang))
localeMapper = QTextCodec::codecForName("PT 154");
else if (try_locale_list(probably_koi8_rlocales, lang))
- localeMapper = ru_RU_hack(lang);
+ localeMapper = ru_RU_hack(lang.constData());
}
}