1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Attempt to fix QDataStream operator<< ODR violation

This commit is contained in:
tux3 2015-11-09 23:23:32 +01:00
parent a052e3c452
commit afe2dbd128
No known key found for this signature in database
GPG Key ID: 7E086DD661263264

View File

@ -17,6 +17,9 @@
along with qTox. If not, see <http://www.gnu.org/licenses/>.
*/
#define QT_NO_DATASTREAM
#include <QString>
#undef QT_NO_DATASTREAM
#include "settingsserializer.h"
#include "serialize.h"
#include "src/nexus.h"
@ -36,12 +39,7 @@ inline QDataStream& operator<<(QDataStream& dataStream, const SettingsSerializer
return dataStream << static_cast<uint8_t>(tag);
}
inline QDataStream& operator<<(QDataStream& dataStream, const QString& str)
{
return dataStream << str.toUtf8();
}
inline QDataStream& operator<<(QDataStream& dataStream, const QByteArray& data)
static inline QDataStream& operator<<(QDataStream& dataStream, const QByteArray& data)
{
QByteArray size = vuintToData(data.size());
dataStream.writeRawData(size.data(), size.size());
@ -49,12 +47,17 @@ inline QDataStream& operator<<(QDataStream& dataStream, const QByteArray& data)
return dataStream;
}
static inline QDataStream& operator<<(QDataStream& dataStream, const QString& str)
{
return dataStream << str.toUtf8();
}
QDataStream& operator>>(QDataStream& dataStream, SettingsSerializer::RecordTag& tag)
{
return dataStream.operator >>((uint8_t&)tag);
}
inline QDataStream& operator>>(QDataStream& dataStream, QByteArray& data)
static inline QDataStream& operator>>(QDataStream& dataStream, QByteArray& data)
{
unsigned char num3;
size_t num = 0;