From 186692f81f2612c3cf3a4090cbf949f2fb1558f8 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Mon, 30 Jan 2012 14:23:22 +0200 Subject: Remove custom text codec for C strings. This setting is extremely harmful, as code cannot know whether or not to expect it. It also made the behaviour of QString::fromAscii and ::toAscii unintuitive, and caused a lot of people to make mistakes with it. Change-Id: I2f429fa7ef93bd75bb93a7f64c56db15b7283388 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/corelib/tools/qstring.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/corelib/tools/qstring.h') diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index f1bad5c028..f49d989e9d 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -605,9 +605,6 @@ private: Data *d; inline QString(Data *dd, int /*dummy*/) : d(dd) {} -#ifndef QT_NO_TEXTCODEC - static QTextCodec *codecForCStrings; -#endif static int grow(int); static void free(Data *); void realloc(); @@ -927,9 +924,6 @@ inline bool operator!=(const QString &s, QString::Null) { return !s.isNull(); } #ifndef QT_NO_CAST_FROM_ASCII inline bool qStringComparisonHelper(const QString &s1, const char *s2) { -# ifndef QT_NO_TEXTCODEC - if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2, s2 ? int(strlen(s2)) : -1)); -# endif return (s1 == QLatin1String(s2)); } inline bool QString::operator==(const char *s) const @@ -1216,9 +1210,6 @@ inline bool operator>=(const QStringRef &s1, const QStringRef &s2) inline bool qStringComparisonHelper(const QStringRef &s1, const char *s2) { -# ifndef QT_NO_TEXTCODEC - if (QString::codecForCStrings) return (s1 == QString::fromAscii(s2, s2 ? int(strlen(s2)) : -1)); -# endif return (s1 == QLatin1String(s2)); } -- cgit v1.2.3 From 52c253fa33162c1db2d0cb0916e0de188b9a0aae Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 23 Feb 2012 00:22:59 +0100 Subject: Remove QT_ASCII_CAST_WARN_CONSTRUCTOR GCC version < 3 which it was created for is not supported anymore. Change-Id: I0b4df4c99600cacbaafbf0bc4270cd4978600956 Reviewed-by: Thiago Macieira --- src/corelib/tools/qstring.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/tools/qstring.h') diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index f49d989e9d..b1ade85a30 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -498,10 +498,10 @@ public: // ASCII compatibility #ifndef QT_NO_CAST_FROM_ASCII - inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const char *ch) + inline QT_ASCII_CAST_WARN QString(const char *ch) : d(fromAscii_helper(ch, ch ? int(strlen(ch)) : -1)) {} - inline QT_ASCII_CAST_WARN_CONSTRUCTOR QString(const QByteArray &a) + inline QT_ASCII_CAST_WARN QString(const QByteArray &a) : d(fromAscii_helper(a.constData(), qstrnlen(a.constData(), a.size()))) {} inline QT_ASCII_CAST_WARN QString &operator=(const char *ch) -- cgit v1.2.3