-rw-r--r-- | qmake/tools/qdatastream.cpp | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/qmake/tools/qdatastream.cpp b/qmake/tools/qdatastream.cpp index 9c573c7..51a1448 100644 --- a/qmake/tools/qdatastream.cpp +++ b/qmake/tools/qdatastream.cpp | |||
@@ -741,26 +741,34 @@ QDataStream &QDataStream::readBytes( char *&s, uint &l ) | |||
741 | reference to the stream. | 741 | reference to the stream. |
742 | 742 | ||
743 | The buffer \a s must be preallocated. The data is \e not encoded. | 743 | The buffer \a s must be preallocated. The data is \e not encoded. |
744 | 744 | ||
745 | \sa readBytes(), QIODevice::readBlock(), writeRawBytes() | 745 | \sa readBytes(), QIODevice::readBlock(), writeRawBytes() |
746 | */ | 746 | */ |
747 | 747 | ||
748 | QDataStream &QDataStream::readRawBytes( char *s, uint len ) | 748 | QDataStream &QDataStream::readRawBytes( char *s, uint len ) |
749 | { | 749 | { |
750 | CHECK_STREAM_PRECOND | 750 | CHECK_STREAM_PRECOND |
751 | if ( printable ) { // printable data | 751 | if ( printable ) { // printable data |
752 | register Q_INT8 *p = (Q_INT8*)s; | 752 | register Q_INT8 *p = (Q_INT8*)s; |
753 | while ( len-- ) | 753 | if ( version() < 4 ) { |
754 | *this >> *p++; | 754 | while ( len-- ) { |
755 | Q_INT32 tmp; | ||
756 | *this >> tmp; | ||
757 | *p++ = tmp; | ||
758 | } | ||
759 | } else { | ||
760 | while ( len-- ) | ||
761 | *this >> *p++; | ||
762 | } | ||
755 | } else { // read data char array | 763 | } else { // read data char array |
756 | dev->readBlock( s, len ); | 764 | dev->readBlock( s, len ); |
757 | } | 765 | } |
758 | return *this; | 766 | return *this; |
759 | } | 767 | } |
760 | 768 | ||
761 | 769 | ||
762 | /***************************************************************************** | 770 | /***************************************************************************** |
763 | QDataStream write functions | 771 | QDataStream write functions |
764 | *****************************************************************************/ | 772 | *****************************************************************************/ |
765 | 773 | ||
766 | 774 | ||
@@ -1003,22 +1011,28 @@ QDataStream &QDataStream::writeBytes(const char *s, uint len) | |||
1003 | 1011 | ||
1004 | /*! | 1012 | /*! |
1005 | Writes \a len bytes from \a s to the stream and returns a | 1013 | Writes \a len bytes from \a s to the stream and returns a |
1006 | reference to the stream. The data is \e not encoded. | 1014 | reference to the stream. The data is \e not encoded. |
1007 | 1015 | ||
1008 | \sa writeBytes(), QIODevice::writeBlock(), readRawBytes() | 1016 | \sa writeBytes(), QIODevice::writeBlock(), readRawBytes() |
1009 | */ | 1017 | */ |
1010 | 1018 | ||
1011 | QDataStream &QDataStream::writeRawBytes( const char *s, uint len ) | 1019 | QDataStream &QDataStream::writeRawBytes( const char *s, uint len ) |
1012 | { | 1020 | { |
1013 | CHECK_STREAM_PRECOND | 1021 | CHECK_STREAM_PRECOND |
1014 | if ( printable ) { // write printable | 1022 | if ( printable ) { // write printable |
1015 | register Q_INT8 *p = (Q_INT8*)s; | 1023 | if ( version() < 4 ) { |
1016 | while ( len-- ) | 1024 | register char *p = (char *)s; |
1017 | *this << *p++; | 1025 | while ( len-- ) |
1026 | *this << *p++; | ||
1027 | } else { | ||
1028 | register Q_INT8 *p = (Q_INT8*)s; | ||
1029 | while ( len-- ) | ||
1030 | *this << *p++; | ||
1031 | } | ||
1018 | } else { // write data char array | 1032 | } else { // write data char array |
1019 | dev->writeBlock( s, len ); | 1033 | dev->writeBlock( s, len ); |
1020 | } | 1034 | } |
1021 | return *this; | 1035 | return *this; |
1022 | } | 1036 | } |
1023 | 1037 | ||
1024 | #endif // QT_NO_DATASTREAM | 1038 | #endif // QT_NO_DATASTREAM |