Remove Qt 4.3 binary compatibility for MSVC
When we removed the useless "const" in the return type, we broke compatibility with a few compilers that include the return type in the mangling. We don't need that anymore in Qt 5. This change should have had a ### Qt5 mark everywhere, not just in a comment in qstring.cpp. Change-Id: I8839f8dc540b34e57a3efdb160a1c015f7328422 Merge-request: 13 Reviewed-by: Olivier Goffart <olivier.goffart@nokia.com> Reviewed-on: http://codereview.qt.nokia.com/1385 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
This commit is contained in:
parent
8cc3b1a426
commit
d9bec0a1d2
@ -172,15 +172,9 @@ public:
|
|||||||
inline bool isSharedWith(const QByteArray &other) const { return d == other.d; }
|
inline bool isSharedWith(const QByteArray &other) const { return d == other.d; }
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char at(int i) const;
|
|
||||||
const char operator[](int i) const;
|
|
||||||
const char operator[](uint i) const;
|
|
||||||
#else
|
|
||||||
char at(int i) const;
|
char at(int i) const;
|
||||||
char operator[](int i) const;
|
char operator[](int i) const;
|
||||||
char operator[](uint i) const;
|
char operator[](uint i) const;
|
||||||
#endif
|
|
||||||
QByteRef operator[](int i);
|
QByteRef operator[](int i);
|
||||||
QByteRef operator[](uint i);
|
QByteRef operator[](uint i);
|
||||||
|
|
||||||
@ -359,21 +353,12 @@ inline QByteArray::~QByteArray() { if (!d->ref.deref()) qFree(d); }
|
|||||||
inline int QByteArray::size() const
|
inline int QByteArray::size() const
|
||||||
{ return d->size; }
|
{ return d->size; }
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline const char QByteArray::at(int i) const
|
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
|
||||||
inline const char QByteArray::operator[](int i) const
|
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
|
||||||
inline const char QByteArray::operator[](uint i) const
|
|
||||||
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
|
||||||
#else
|
|
||||||
inline char QByteArray::at(int i) const
|
inline char QByteArray::at(int i) const
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
||||||
inline char QByteArray::operator[](int i) const
|
inline char QByteArray::operator[](int i) const
|
||||||
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
{ Q_ASSERT(i >= 0 && i < size()); return d->data[i]; }
|
||||||
inline char QByteArray::operator[](uint i) const
|
inline char QByteArray::operator[](uint i) const
|
||||||
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
{ Q_ASSERT(i < uint(size())); return d->data[i]; }
|
||||||
#endif
|
|
||||||
|
|
||||||
inline bool QByteArray::isEmpty() const
|
inline bool QByteArray::isEmpty() const
|
||||||
{ return d->size == 0; }
|
{ return d->size == 0; }
|
||||||
@ -412,13 +397,8 @@ class Q_CORE_EXPORT QByteRef {
|
|||||||
: a(array),i(idx) {}
|
: a(array),i(idx) {}
|
||||||
friend class QByteArray;
|
friend class QByteArray;
|
||||||
public:
|
public:
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline operator const char() const
|
|
||||||
{ return i < a.d->size ? a.d->data[i] : char(0); }
|
|
||||||
#else
|
|
||||||
inline operator char() const
|
inline operator char() const
|
||||||
{ return i < a.d->size ? a.d->data[i] : char(0); }
|
{ return i < a.d->size ? a.d->data[i] : char(0); }
|
||||||
#endif
|
|
||||||
inline QByteRef &operator=(char c)
|
inline QByteRef &operator=(char c)
|
||||||
{ if (i >= a.d->size) a.expand(i); else a.detach();
|
{ if (i >= a.d->size) a.expand(i); else a.detach();
|
||||||
a.d->data[i] = c; return *this; }
|
a.d->data[i] = c; return *this; }
|
||||||
|
@ -1295,11 +1295,7 @@ ushort QChar::toCaseFolded(ushort ucs2)
|
|||||||
|
|
||||||
\sa toLatin1(), unicode(), QTextCodec::codecForCStrings()
|
\sa toLatin1(), unicode(), QTextCodec::codecForCStrings()
|
||||||
*/
|
*/
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char QChar::toAscii() const
|
|
||||||
#else
|
|
||||||
char QChar::toAscii() const
|
char QChar::toAscii() const
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
#ifndef QT_NO_CODEC_FOR_C_STRINGS
|
#ifndef QT_NO_CODEC_FOR_C_STRINGS
|
||||||
if (QTextCodec::codecForCStrings())
|
if (QTextCodec::codecForCStrings())
|
||||||
|
@ -56,13 +56,8 @@ struct QLatin1Char
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline explicit QLatin1Char(char c) : ch(c) {}
|
inline explicit QLatin1Char(char c) : ch(c) {}
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline const char toLatin1() const { return ch; }
|
|
||||||
inline const ushort unicode() const { return ushort(uchar(ch)); }
|
|
||||||
#else
|
|
||||||
inline char toLatin1() const { return ch; }
|
inline char toLatin1() const { return ch; }
|
||||||
inline ushort unicode() const { return ushort(uchar(ch)); }
|
inline ushort unicode() const { return ushort(uchar(ch)); }
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
char ch;
|
char ch;
|
||||||
@ -230,15 +225,9 @@ public:
|
|||||||
|
|
||||||
UnicodeVersion unicodeVersion() const;
|
UnicodeVersion unicodeVersion() const;
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char toAscii() const;
|
|
||||||
inline const char toLatin1() const;
|
|
||||||
inline const ushort unicode() const { return ucs; }
|
|
||||||
#else
|
|
||||||
char toAscii() const;
|
char toAscii() const;
|
||||||
inline char toLatin1() const;
|
inline char toLatin1() const;
|
||||||
inline ushort unicode() const { return ucs; }
|
inline ushort unicode() const { return ucs; }
|
||||||
#endif
|
|
||||||
#ifdef Q_NO_PACKED_REFERENCE
|
#ifdef Q_NO_PACKED_REFERENCE
|
||||||
inline ushort &unicode() { return const_cast<ushort&>(ucs); }
|
inline ushort &unicode() { return const_cast<ushort&>(ucs); }
|
||||||
#else
|
#else
|
||||||
@ -339,11 +328,7 @@ Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE);
|
|||||||
|
|
||||||
inline QChar::QChar() : ucs(0) {}
|
inline QChar::QChar() : ucs(0) {}
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
inline const char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
|
|
||||||
#else
|
|
||||||
inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
|
inline char QChar::toLatin1() const { return ucs > 0xff ? '\0' : char(ucs); }
|
||||||
#endif
|
|
||||||
inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); }
|
inline QChar QChar::fromLatin1(char c) { return QChar(ushort(uchar(c))); }
|
||||||
|
|
||||||
inline QChar::QChar(uchar c, uchar r) : ucs(ushort((r << 8) | c)){}
|
inline QChar::QChar(uchar c, uchar r) : ucs(ushort((r << 8) | c)){}
|
||||||
|
@ -3636,10 +3636,6 @@ QByteArray QString::toLatin1() const
|
|||||||
return toLatin1_helper(unicode(), length());
|
return toLatin1_helper(unicode(), length());
|
||||||
}
|
}
|
||||||
|
|
||||||
// ### Qt 5: Change the return type of at least toAscii(),
|
|
||||||
// toLatin1() and unicode() such that the use of Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
// isn't necessary in the header. See task 177402.
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns an 8-bit representation of the string as a QByteArray.
|
Returns an 8-bit representation of the string as a QByteArray.
|
||||||
|
|
||||||
|
@ -832,15 +832,9 @@ public:
|
|||||||
inline void setCell(uchar cell);
|
inline void setCell(uchar cell);
|
||||||
inline void setRow(uchar row);
|
inline void setRow(uchar row);
|
||||||
|
|
||||||
#ifdef Q_COMPILER_MANGLES_RETURN_TYPE
|
|
||||||
const char toAscii() const { return QChar(*this).toAscii(); }
|
|
||||||
const char toLatin1() const { return QChar(*this).toLatin1(); }
|
|
||||||
const ushort unicode() const { return QChar(*this).unicode(); }
|
|
||||||
#else
|
|
||||||
char toAscii() const { return QChar(*this).toAscii(); }
|
char toAscii() const { return QChar(*this).toAscii(); }
|
||||||
char toLatin1() const { return QChar(*this).toLatin1(); }
|
char toLatin1() const { return QChar(*this).toLatin1(); }
|
||||||
ushort unicode() const { return QChar(*this).unicode(); }
|
ushort unicode() const { return QChar(*this).unicode(); }
|
||||||
#endif
|
|
||||||
ushort& unicode() { return s.data()[i].unicode(); }
|
ushort& unicode() { return s.data()[i].unicode(); }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user