diff options
Diffstat (limited to 'src/corelib/io/qdatastream.cpp')
-rw-r--r-- | src/corelib/io/qdatastream.cpp | 97 |
1 files changed, 14 insertions, 83 deletions
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 7920d881b4..1fe2a793a6 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -184,7 +184,7 @@ QT_BEGIN_NAMESPACE \endcode To see if your favorite Qt class has similar stream operators - defined, check the \bold {Related Non-Members} section of the + defined, check the \b {Related Non-Members} section of the class's documentation page. \sa QTextStream QVariant @@ -571,19 +571,19 @@ void QDataStream::setByteOrder(ByteOrder bo) serialization format used by QDataStream. \table - \header \i Qt Version \i QDataStream Version - \row \i Qt 4.6 \i 12 - \row \i Qt 4.5 \i 11 - \row \i Qt 4.4 \i 10 - \row \i Qt 4.3 \i 9 - \row \i Qt 4.2 \i 8 - \row \i Qt 4.0, 4.1 \i 7 - \row \i Qt 3.3 \i 6 - \row \i Qt 3.1, 3.2 \i 5 - \row \i Qt 3.0 \i 4 - \row \i Qt 2.1, 2.2, 2.3 \i 3 - \row \i Qt 2.0 \i 2 - \row \i Qt 1.x \i 1 + \header \li Qt Version \li QDataStream Version + \row \li Qt 4.6 \li 12 + \row \li Qt 4.5 \li 11 + \row \li Qt 4.4 \li 10 + \row \li Qt 4.3 \li 9 + \row \li Qt 4.2 \li 8 + \row \li Qt 4.0, 4.1 \li 7 + \row \li Qt 3.3 \li 6 + \row \li Qt 3.1, 3.2 \li 5 + \row \li Qt 3.0 \li 4 + \row \li Qt 2.1, 2.2, 2.3 \li 3 + \row \li Qt 2.0 \li 2 + \row \li Qt 1.x \li 1 \endtable The \l Version enum provides symbolic constants for the different @@ -771,10 +771,6 @@ QDataStream &QDataStream::operator>>(float &f) return *this; } -#if defined(Q_DOUBLE_FORMAT) -#define Q_DF(x) Q_DOUBLE_FORMAT[(x)] - '0' -#endif - /*! \overload @@ -797,7 +793,6 @@ QDataStream &QDataStream::operator>>(double &f) f = 0.0; CHECK_STREAM_PRECOND(*this) -#ifndef Q_DOUBLE_FORMAT if (dev->read((char *)&f, 8) != 8) { f = 0.0; setStatus(ReadPastEnd); @@ -811,39 +806,6 @@ QDataStream &QDataStream::operator>>(double &f) f = x.val1; } } -#else - //non-standard floating point format - union { - double val1; - char val2[8]; - } x; - char *p = x.val2; - char b[8]; - if (dev->read(b, 8) == 8) { - if (noswap) { - *p++ = b[Q_DF(0)]; - *p++ = b[Q_DF(1)]; - *p++ = b[Q_DF(2)]; - *p++ = b[Q_DF(3)]; - *p++ = b[Q_DF(4)]; - *p++ = b[Q_DF(5)]; - *p++ = b[Q_DF(6)]; - *p = b[Q_DF(7)]; - } else { - *p++ = b[Q_DF(7)]; - *p++ = b[Q_DF(6)]; - *p++ = b[Q_DF(5)]; - *p++ = b[Q_DF(4)]; - *p++ = b[Q_DF(3)]; - *p++ = b[Q_DF(2)]; - *p++ = b[Q_DF(1)]; - *p = b[Q_DF(0)]; - } - f = x.val1; - } else { - setStatus(ReadPastEnd); - } -#endif return *this; } @@ -1112,7 +1074,6 @@ QDataStream &QDataStream::operator<<(double f) } CHECK_STREAM_WRITE_PRECOND(*this) -#ifndef Q_DOUBLE_FORMAT if (noswap) { if (dev->write((char *)&f, sizeof(double)) != sizeof(double)) q_status = WriteFailed; @@ -1126,36 +1087,6 @@ QDataStream &QDataStream::operator<<(double f) if (dev->write((char *)&x.val2, sizeof(double)) != sizeof(double)) q_status = WriteFailed; } -#else - union { - double val1; - char val2[8]; - } x; - x.val1 = f; - char *p = x.val2; - char b[8]; - if (noswap) { - b[Q_DF(0)] = *p++; - b[Q_DF(1)] = *p++; - b[Q_DF(2)] = *p++; - b[Q_DF(3)] = *p++; - b[Q_DF(4)] = *p++; - b[Q_DF(5)] = *p++; - b[Q_DF(6)] = *p++; - b[Q_DF(7)] = *p; - } else { - b[Q_DF(7)] = *p++; - b[Q_DF(6)] = *p++; - b[Q_DF(5)] = *p++; - b[Q_DF(4)] = *p++; - b[Q_DF(3)] = *p++; - b[Q_DF(2)] = *p++; - b[Q_DF(1)] = *p++; - b[Q_DF(0)] = *p; - } - if (dev->write(b, 8) != 8) - q_status = WriteFailed; -#endif return *this; } |