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/codecs/qtextcodec.cpp | 30 +----------------------------- src/corelib/codecs/qtextcodec.h | 5 ----- 2 files changed, 1 insertion(+), 34 deletions(-) (limited to 'src/corelib/codecs') diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 82e5c9a1c3..68866b9000 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -1495,35 +1495,7 @@ QString QTextDecoder::toUnicode(const QByteArray &ba) files to be loaded. For details of internationalization, see \l{Internationalization with Qt}. - \sa codecForTr(), setCodecForCStrings() -*/ - - -/*! - \fn QTextCodec* QTextCodec::codecForCStrings() - - Returns the codec used by QString to convert to and from \c{const - char *} and QByteArrays. If this function returns 0 (the default), - QString assumes Latin-1. - - \sa setCodecForCStrings() -*/ - -/*! - \fn void QTextCodec::setCodecForCStrings(QTextCodec *codec) - \nonreentrant - - Sets the codec used by QString to convert to and from \c{const - char *} and QByteArrays. If the \a codec is 0 (the default), - QString assumes Latin-1. - - \warning Some codecs do not preserve the characters in the ASCII - range (0x00 to 0x7F). For example, the Japanese Shift-JIS - encoding maps the backslash character (0x5A) to the Yen - character. To avoid undesirable side-effects, we recommend - avoiding such codecs with setCodecsForCString(). - - \sa codecForCStrings(), setCodecForTr() + \sa codecForTr() */ /*! diff --git a/src/corelib/codecs/qtextcodec.h b/src/corelib/codecs/qtextcodec.h index 9e46863964..ad37005e92 100644 --- a/src/corelib/codecs/qtextcodec.h +++ b/src/corelib/codecs/qtextcodec.h @@ -75,9 +75,6 @@ public: static QTextCodec* codecForTr(); static void setCodecForTr(QTextCodec *c); - static QTextCodec* codecForCStrings(); - static void setCodecForCStrings(QTextCodec *c); - static QTextCodec *codecForHtml(const QByteArray &ba); static QTextCodec *codecForHtml(const QByteArray &ba, QTextCodec *defaultCodec); @@ -139,8 +136,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QTextCodec::ConversionFlags) inline QTextCodec* QTextCodec::codecForTr() { return validCodecs() ? cftr : 0; } inline void QTextCodec::setCodecForTr(QTextCodec *c) { cftr = c; } -inline QTextCodec* QTextCodec::codecForCStrings() { return validCodecs() ? QString::codecForCStrings : 0; } -inline void QTextCodec::setCodecForCStrings(QTextCodec *c) { QString::codecForCStrings = c; } class Q_CORE_EXPORT QTextEncoder { Q_DISABLE_COPY(QTextEncoder) -- cgit v1.2.3