From 79e211c13da149001bbf1a7345c29099b6aaa635 Mon Sep 17 00:00:00 2001 From: "arnaud.clere" Date: Tue, 3 Dec 2019 15:59:16 +0100 Subject: [PATCH] cosmetic changes --- tests/QBind/QCbor_impl.h | 22 +++++++++++----------- tests/QBind/main.cpp | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/QBind/QCbor_impl.h b/tests/QBind/QCbor_impl.h index ec0e49b70d..b811fc1acb 100644 --- a/tests/QBind/QCbor_impl.h +++ b/tests/QBind/QCbor_impl.h @@ -115,21 +115,21 @@ protected: bool isValid() const noexcept { return io; } bool trySequence(quint32* rows=nullptr) { levels.push_back(rows); - if (Q_LIKELY(rows)) { putInteger (*rows , cbor::ArrayType); } - else { putMajorValue(cbor::IndefiniteLength, cbor::ArrayType); } return true; } + if (Q_LIKELY(rows)) { putInteger (*rows , cbor::ArrayType); } + else { putMajorValue(cbor::IndefiniteLength, cbor::ArrayType); } return true; } bool tryRecord (quint32* cols=nullptr) { levels.push_back(cols); - if (Q_LIKELY(cols)) { putInteger (*cols , cbor::MapType ); } - else { putMajorValue(cbor::IndefiniteLength, cbor::MapType ); } return true; } + if (Q_LIKELY(cols)) { putInteger (*cols , cbor::MapType ); } + else { putMajorValue(cbor::IndefiniteLength, cbor::MapType ); } return true; } bool tryNull ( ) { putSimpleValue(cbor::Null ); return true; } bool tryBind ( QUtf8DataView u) { putInteger (quint64(u.size()), cbor::TextStringType); io->append(u.data(), u.size()); return true; } bool tryBind ( QString&& s) { QUtf8Data u(s.toUtf8()); - putInteger (quint64(u.size()), cbor::TextStringType); io->append(u.utf8()); return true; } - //static const char mimeHeader[] = "Content-Type:text/plain;charset=utf-16\xD\xA\xD\xA"; - //QByteArray utf16(QByteArray::fromRawData(reinterpret_cast(s.utf16()), s.size()*int(sizeof(QChar)))); - //return putMajorValue (cbor::NextByteUnsignedInt,cbor::TagType ) && io->putChar(cbor::MimeMessage) && - // putInteger (sizeof(mimeHeader)+ - // utf16.size() ,cbor::ByteStringType) && io->write(mimeHeader, sizeof(mimeHeader)) - // && (Q_LIKELY(io->write(utf16)) || s[0]==QChar('\0')); } + putInteger (quint64(u.size()), cbor::TextStringType); io->append(u.utf8()); return true; } + //static const char mimeHeader[] = "Content-Type:text/plain;charset=utf-16\xD\xA\xD\xA"; + //QByteArray utf16(QByteArray::fromRawData(reinterpret_cast(s.utf16()), s.size()*int(sizeof(QChar)))); + //return putMajorValue (cbor::NextByteUnsignedInt,cbor::TagType ) && io->putChar(cbor::MimeMessage) && + // putInteger (sizeof(mimeHeader)+ + // utf16.size() ,cbor::ByteStringType) && io->write(mimeHeader, sizeof(mimeHeader)) + // && (Q_LIKELY(io->write(utf16)) || s[0]==QChar('\0')); } bool tryBind ( QByteArray&& s) { putInteger (quint64(s.size()), cbor::ByteStringType); io->append(s); return true; } bool tryBind ( bool&& b) { putSimpleValue(b ? cbor::True : cbor::False); return true; } bool tryBind ( float&& n) { putSimpleValue(cbor::Next32BitFloat); putBigEndian(n); return true; } diff --git a/tests/QBind/main.cpp b/tests/QBind/main.cpp index bc76bbfe16..0c2f482c67 100644 --- a/tests/QBind/main.cpp +++ b/tests/QBind/main.cpp @@ -284,7 +284,7 @@ struct QTransmogrifier { } if (c.alpha()<255) { r = r.bind("alpha",quint8(c.alpha())); } return r.bind("base",quint8(255)); // Explicits ARGBCMYKSLV components' base (H base is 360 corresponding to color wheel degrees, with -1 used for gray in addition to S being 0) - // QDebug use of float values removes need for base but may lose precision + // QDebug use of float values removes need for base but may lose precision } }; -- GitLab