From ecd9111c07f146252d5fb0f37fbdf5bec30f3929 Mon Sep 17 00:00:00 2001 From: Roman Isaikin Date: Thu, 3 Dec 2015 23:28:04 +0300 Subject: [PATCH 1/3] Little doc fix. --- README.md | 2 +- doc/sphinx_deployment.mk | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e44bfbc..e33efc5 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ MessagePack for Qt Documentation ------------- -Complete documentation is available here: [mp.marsw.ru](http://msgpack.marsworks.ru/) (still working on it) +Complete documentation is available here: [msgpack.marsworks.ru](http://msgpack.marsworks.ru/) (still working on it) Installation ------------ diff --git a/doc/sphinx_deployment.mk b/doc/sphinx_deployment.mk index 334d10b..6087020 100644 --- a/doc/sphinx_deployment.mk +++ b/doc/sphinx_deployment.mk @@ -59,15 +59,15 @@ endif ## -- Rsync Deploy config -- ## # Be sure your public key is listed in your server's ~/.ssh/authorized_keys file ifndef SSH_USER -SSH_USER = roman@vds.marsworks.ru +SSH_USER = nginx@mars endif ifndef SSH_PORT -SSH_PORT = 22 +SSH_PORT = 7722 endif ifndef DOCUMENT_ROOT -DOCUMENT_ROOT = /var/www/roman/data/www/msgpack.marsworks.ru/ +DOCUMENT_ROOT = /var/www/msgpack.marsworks.ru/ endif #If you choose to delete on sync, rsync will create a 1:1 match From 349c5051d660c774d6a5376c6fa190a20b8a489b Mon Sep 17 00:00:00 2001 From: Roman Isaikin Date: Thu, 3 Dec 2015 23:31:09 +0300 Subject: [PATCH 2/3] Disabled Qt4 Travis build. --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index ac76a5c..71941db 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ compiler: - gcc env: - - QT4_BUILD=ON - QT4_BUILD=OFF before_install: From b23c76ddf048266b49af9043e6748efb36478ac1 Mon Sep 17 00:00:00 2001 From: Roman Isaikin Date: Thu, 31 Dec 2015 10:36:25 +0300 Subject: [PATCH 3/3] Nil packing and unpacking fix --- CMakeLists.txt | 5 +++++ doc/_themes/sphinx_rtd_theme | Bin 118 -> 9 bytes doc/install.rst | 12 ++++++++++++ src/msgpackcommon.h | 4 ---- src/private/pack_p.cpp | 10 +++++++++- src/private/pack_p.h | 2 ++ src/private/unpack_p.cpp | 2 ++ tests/qttypes/qttypes_test.cpp | 1 + 8 files changed, 31 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72ebe05..a010234 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,8 @@ +set(Qt5Core_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core") +set(Qt5Test_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Test") +set(Qt5_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core") +set(QT_QMAKE_EXECUTABLE "/opt/Qt5.6.0/5.6/gcc_64/bin/qmake") + project(qmsgpack) cmake_minimum_required(VERSION 2.8.8) diff --git a/doc/_themes/sphinx_rtd_theme b/doc/_themes/sphinx_rtd_theme index 928fe94aa8b23509b63c527a965b85b86f69a828..5537ad56f4edda3cdc3c35ec99cf195bf24a93ac 120000 GIT binary patch literal 9 QcmeawE2;4D^Jdfs01wOpxc~qF literal 118 zcmeawE2;4D^Jdg%C}k*SC}PlO$YIE5NM=Z6$N{r68IlpS7 z7|a>;8B!QB8HyQ77<3s57!nzh8L}A?8PXY28HyS78HyPS7%~_#8S)q^7~&a<7)lsY P7~;Vuq%!0(q%r^ijy@Mo diff --git a/doc/install.rst b/doc/install.rst index cd753f4..fbca06d 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -62,6 +62,18 @@ Add options before ``..`` as follow: cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_TESTS=True .. +Custom Qt installation +"""""""""""""""""""""" + +If you installed Qt with online installer, cmake will most likely not find it, in this case try adding following lines to CMakeLists.txt: + +.. code-block:: cmake + + set(Qt5Core_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core") + set(Qt5Test_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Test") + set(Qt5_DIR "/opt/Qt5.6.0/5.6/gcc_64/lib/cmake/Qt5Core") + set(QT_QMAKE_EXECUTABLE "/opt/Qt5.6.0/5.6/gcc_64/bin/qmake") + qmake ^^^^^ diff --git a/src/msgpackcommon.h b/src/msgpackcommon.h index f8109c6..68a6479 100644 --- a/src/msgpackcommon.h +++ b/src/msgpackcommon.h @@ -4,10 +4,6 @@ #include #include -#ifdef Q_OS_WINRT -#include -#endif - #define MSGPACK_MAJOR 0 #define MSGPACK_MINOR 1 #define MSGPACK_VERSION 0 diff --git a/src/private/pack_p.cpp b/src/private/pack_p.cpp index eeb9712..e807bf6 100644 --- a/src/private/pack_p.cpp +++ b/src/private/pack_p.cpp @@ -18,7 +18,9 @@ QReadWriteLock MsgPackPrivate::packers_lock; quint8 *MsgPackPrivate::pack(const QVariant &v, quint8 *p, bool wr, QVector &user_data) { QMetaType::Type t = (QMetaType::Type)v.type(); - if (t == QMetaType::Int) + if (v.isNull() && !v.isValid()) + p = pack_nil(p, wr); + else if (t == QMetaType::Int) p = pack_int(v.toInt(), p, wr); else if (t == QMetaType::UInt) p = pack_uint(v.toUInt(), p, wr); @@ -59,6 +61,12 @@ quint8 *MsgPackPrivate::pack(const QVariant &v, quint8 *p, bool wr, QVector= -32 && i <= 127) { diff --git a/src/private/pack_p.h b/src/private/pack_p.h index 0fe8cce..cf9a785 100644 --- a/src/private/pack_p.h +++ b/src/private/pack_p.h @@ -27,6 +27,8 @@ extern bool compatibilityMode; quint8 * pack(const QVariant &v, quint8 *p, bool wr, QVector &user_data); +quint8 * pack_nil(quint8 *p, bool wr); + quint8 * pack_int(qint32 i, quint8 *p, bool wr); quint8 * pack_uint(quint32 i, quint8 *p, bool wr); quint8 * pack_longlong(qint64 i, quint8 *p, bool wr); diff --git a/src/private/unpack_p.cpp b/src/private/unpack_p.cpp index 9a01d78..45b4be6 100644 --- a/src/private/unpack_p.cpp +++ b/src/private/unpack_p.cpp @@ -87,6 +87,7 @@ quint8 * MsgPackPrivate::unpack_nil(QVariant &v, quint8 *p) { Q_UNUSED(p) Q_UNUSED(v) + v = QVariant(); return p + 1; } @@ -94,6 +95,7 @@ quint8 * MsgPackPrivate::unpack_never_used(QVariant &v, quint8 *p) { Q_UNUSED(p) Q_UNUSED(v) + v = QVariant(); return p + 1; } diff --git a/tests/qttypes/qttypes_test.cpp b/tests/qttypes/qttypes_test.cpp index 03468eb..015a1b0 100644 --- a/tests/qttypes/qttypes_test.cpp +++ b/tests/qttypes/qttypes_test.cpp @@ -68,6 +68,7 @@ void QtTypesTest::test_qtime() QByteArray packed = MsgPack::pack(t); QTime t2 = MsgPack::unpack(packed).toTime(); QVERIFY(t == t2); + qDebug() << packed.toHex(); QVERIFY(packed.size() == 3); t = QTime(12, 01, 01, 0);