romixlab / qmsgpack Goto Github PK
View Code? Open in Web Editor NEWMessagePack serializer implementation for Qt / msgpack.org[Qt]
Home Page: http://msgpack.org/
License: MIT License
MessagePack serializer implementation for Qt / msgpack.org[Qt]
Home Page: http://msgpack.org/
License: MIT License
There was detected a bug with 64-bit integers. See tests/unpack_test.
Qt function QJsonObject::toVariantMap() parses JSON 'null' values as QVariants with QMetaType::Nullptr type. When processing these maps with MsgPack::pack() the library prints error:
MsgPack::pack can't pack type: 51
(51 is QMetaType::Nullptr)
It seems that qmsgpack expects not Nullptr type QVariants but null QVariants.
pack_p.cpp:
quint8 *MsgPackPrivate::pack(const QVariant &v, quint8 *p, bool wr, QVector<QByteArray> &user_data)
{
QMetaType::Type t = (QMetaType::Type)v.type();
if (v.isNull() && !v.isValid())
p = pack_nil(p, wr);
...
This seems to be more of an incompatibility than simply a bug but nevertheless causes problems when converting JSON to MsgPack.
Issue can be reproduced with following code:
#include <QJsonDocument>
#include <QJsonObject>
#include "msgpack.h"
int main(int argc, char *argv[])
{
QString json("{ \"test\" : null }");
QJsonDocument jsonDoc(QJsonDocument::fromJson(json.toUtf8()));
QVariantMap map = jsonDoc.object().toVariantMap();
MsgPack::pack(map);
}
It's probably possible to write a user packer, but that feels like a workaround.
Tested with Qt 5.12.2 and qmsgpack e3819fc
msgpack_common.h include check defined as
#ifndef COMMON_H
#define COMMON_H
but in common style should be
#ifndef MSGPACK_COMMON_H
#define MSGPACK_COMMON_H
I have an issue with it, because in our project exists file common.h which has same define
I was just working some fixes to the write support for streams (handling partial writes, like it does partial reads now), and I've come across a bug that probably has to be fixed in qmsgpack, but I'm not sure of the best way to do it.
Here's the bug: QLocalSocket on windows will silently drop data that is written if the previously-written data has not been read on the remote end. E.g.:
/* This call will succeed. */
dev->write(data, 1);
/* This call will appear to succeed, but the data is never sent. */
dev->write(data2, 3);
The fix is to call QIODevice::waitForBytesWritten
before a second write happens. The obvious place for this is in MsgPackStream::writeBytes
after each write, but that's equivalent to calling flush
on the device, and it's only needed for QLocalSocket.
Do you have any ideas or preferences on how this should be fixed? It's been a long time since I've worked in C++, but my only thought was to have a templated flushWrite()
method, and somehow arrange to have a version specialized on QLocalSocket
do the flush and the normal implementation do nothing. I'm not even sure you can actually do that.
Hello,
I run cmake gui and configure:
The C compiler identification is MSVC 17.0.61030.0
The CXX compiler identification is MSVC 17.0.61030.0
Check for working C compiler using: Visual Studio 11 2012 Win64
Check for working C compiler using: Visual Studio 11 2012 Win64 -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working CXX compiler using: Visual Studio 11 2012 Win64
Check for working CXX compiler using: Visual Studio 11 2012 Win64 -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Qt5 not found, searching for Qt4
Looking for Q_WS_X11
Looking for Q_WS_X11 - not found
Looking for Q_WS_WIN
Looking for Q_WS_WIN - found
Looking for Q_WS_QWS
Looking for Q_WS_QWS - not found
Looking for Q_WS_MAC
Looking for Q_WS_MAC - not found
Found Qt4: C:/qt/qt485-Win64VC11-Slot004/bin/qmake.exe (found version "4.8.5")
statusBuilding pack_test
statusBuilding unpack_test
statusBuilding mixed_test
Configuring done
I Choose Qt4 Build and click 'configrue' and then I get (in red):
Qt5 not found, searching for Qt4
statusBuilding pack_test
statusBuilding unpack_test
statusBuilding mixed_test
Configuring done
I click 'generate'
I go to the build dirctory where i open the 'qmsgpack.sln' with MCVS2012 x64 and choose BUILD ALL
I get these errors:
1>------ Erstellen gestartet: Projekt: ZERO_CHECK, Konfiguration: Debug x64 ------
2>------ Erstellen übersprungen: Projekt: RUN_TESTS, Konfiguration: Debug x64 ------
2>Für diese Projektmappenkonfiguration wurde kein zu erstellendes Projekt ausgewählt.
1> Checking Build System
1> CMake does not need to re-run because D:/Meeting/qmsgpackneu/qmsgpack-master/build/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/Meeting/qmsgpackneu/qmsgpack-master/build/src/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/Meeting/qmsgpackneu/qmsgpack-master/build/tests/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/Meeting/qmsgpackneu/qmsgpack-master/build/tests/pack/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/Meeting/qmsgpackneu/qmsgpack-master/build/tests/unpack/CMakeFiles/generate.stamp is up-to-date.
1> CMake does not need to re-run because D:/Meeting/qmsgpackneu/qmsgpack-master/build/tests/mixed/CMakeFiles/generate.stamp is up-to-date.
3>------ Erstellen gestartet: Projekt: qmsgpack, Konfiguration: Debug x64 ------
4>------ Erstellen übersprungen: Projekt: uninstall, Konfiguration: Debug x64 ------
4>Für diese Projektmappenkonfiguration wurde kein zu erstellendes Projekt ausgewählt.
3> Building Custom Rule D:/Meeting/qmsgpackneu/qmsgpack-master/src/CMakeLists.txt
3> CMake does not need to re-run because D:\Meeting\qmsgpackneu\qmsgpack-master\build\src\CMakeFiles\generate.stamp is up-to-date.
3> msgpack.cpp
3> msgpack_common.cpp
3> pack_p.cpp
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(23): error C2027: Verwendung des undefinierten Typs "QStringList"
3> c:\qt\qt485-win64vc11-slot004\include\qtcore\../../src/corelib/tools/qstring.h(77): Siehe Deklaration von 'QStringList'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(47): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(47): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(47): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(60): error C2065: 'uint16_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(60): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ushort'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(60): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(65): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(65): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(65): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(75): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(75): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(75): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(86): error C2065: 'uint16_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(86): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ushort'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(86): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(91): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(91): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(91): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(134): error C2065: 'uint16_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(134): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ushort'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(134): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(139): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(139): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(139): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(156): error C2027: Verwendung des undefinierten Typs "QStringList"
3> c:\qt\qt485-win64vc11-slot004\include\qtcore\../../src/corelib/tools/qstring.h(77): Siehe Deklaration von 'QStringList'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(156): error C2228: Links von ".length" muss sich eine Klasse/Struktur/Union befinden.
3>c:\qt\qt485-win64vc11-slot004\include\qtcore\../../src/corelib/global/qglobal.h(2387): error C2079: 'QForeachContainer<T>::c' verwendet undefiniertes class 'QStringList'
3> with
3> [
3> T=QStringList
3> ]
3> D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(158): Siehe Verweis auf die Instanziierung der gerade kompilierten Klassen-template "QForeachContainer<T>".
3> with
3> [
3> T=QStringList
3> ]
3>c:\qt\qt485-win64vc11-slot004\include\qtcore\../../src/corelib/global/qglobal.h(2389): error C2027: Verwendung des undefinierten Typs "QStringList"
3> c:\qt\qt485-win64vc11-slot004\include\qtcore\../../src/corelib/tools/qstring.h(77): Siehe Deklaration von 'QStringList'
3>c:\qt\qt485-win64vc11-slot004\include\qtcore\../../src/corelib/global/qglobal.h(2389): error C2146: Syntaxfehler: Fehlendes ';' vor Bezeichner 'i'
3>c:\qt\qt485-win64vc11-slot004\include\qtcore\../../src/corelib/global/qglobal.h(2389): error C4430: Fehlender Typspezifizierer - int wird angenommen. Hinweis: "default-int" wird von C++ nicht unterstützt.
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(158): error C2039: 'i': Ist kein Element von 'QForeachContainer<T>'
3> with
3> [
3> T=QStringList
3> ]
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(178): error C2065: 'uint16_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(178): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ushort'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(178): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(183): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(183): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(183): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(220): error C2065: 'uint16_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(220): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ushort'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(220): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(225): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(225): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(225): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(249): error C2065: 'uint16_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(249): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ushort'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(249): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(254): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(254): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(254): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(315): error C2065: 'uint16_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(315): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ushort'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(315): error C2059: Syntaxfehler: ')'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(320): error C2065: 'uint32_t': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(320): error C2146: Syntaxfehler: Fehlendes ')' vor Bezeichner '_byteswap_ulong'
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\pack_p.cpp(320): error C2059: Syntaxfehler: ')'
3> unpack_p.cpp
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(6): error C2065: 'unpack_nil': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(7): error C2065: 'unpack_never_used': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(8): error C2065: 'unpack_false': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(8): error C2065: 'unpack_true': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(9): error C2065: 'unpack_bin8': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(9): error C2065: 'unpack_bin16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(9): error C2065: 'unpack_bin32': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(10): error C2065: 'unpack_ext8': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(10): error C2065: 'unpack_ext16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(10): error C2065: 'unpack_ext32': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(11): error C2065: 'unpack_float32': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(11): error C2065: 'unpack_float64': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(12): error C2065: 'unpack_uint8': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(12): error C2065: 'unpack_uint16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(12): error C2065: 'unpack_uint32': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(12): error C2065: 'unpack_uint64': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(13): error C2065: 'unpack_int8': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(13): error C2065: 'unpack_int16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(13): error C2065: 'unpack_int32': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(13): error C2065: 'unpack_int64': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(14): error C2065: 'unpack_fixext1': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(14): error C2065: 'unpack_fixext2': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(14): error C2065: 'unpack_fixext4': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(14): error C2065: 'unpack_fixext8': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(14): error C2065: 'unpack_fixext16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(15): error C2065: 'unpack_str8': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(15): error C2065: 'unpack_str16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(15): error C2065: 'unpack_str32': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(16): error C2065: 'unpack_array16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(16): error C2065: 'unpack_array32': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(17): error C2065: 'unpack_map16': nichtdeklarierter Bezeichner
3>D:\Meeting\qmsgpackneu\qmsgpack-master\src\private\unpack_p.cpp(18): error C2065: 'unpack_map32': nichtdeklarierter Bezeichner
3> qmsgpack_automoc.cpp
3> Code wird generiert...
5>------ Erstellen gestartet: Projekt: mixed_test, Konfiguration: Debug x64 ------
6>------ Erstellen gestartet: Projekt: pack_test, Konfiguration: Debug x64 ------
5> Generating mixed_test.moc
5> Building Custom Rule D:/Meeting/qmsgpackneu/qmsgpack-master/tests/mixed/CMakeLists.txt
5> CMake does not need to re-run because D:\Meeting\qmsgpackneu\qmsgpack-master\build\tests\mixed\CMakeFiles\generate.stamp is up-to-date.
5> mixed_test.cpp
6> Generating pack_test.moc
6> Building Custom Rule D:/Meeting/qmsgpackneu/qmsgpack-master/tests/pack/CMakeLists.txt
6> CMake does not need to re-run because D:\Meeting\qmsgpackneu\qmsgpack-master\build\tests\pack\CMakeFiles\generate.stamp is up-to-date.
6> pack_test.cpp
6>D:\Meeting\qmsgpackneu\qmsgpack-master\tests\pack\pack_test.cpp(147): warning C4146: Einem vorzeichenlosen Typ wurde ein unärer Minus-Operator zugewiesen. Das Ergebnis ist weiterhin vorzeichenlos.
5> mixed_test_automoc.cpp
5> Code wird generiert...
5>LINK : fatal error LNK1104: Datei "..\..\src\Debug\qmsgpackd.lib" kann nicht geöffnet werden.
6> pack_test_automoc.cpp
6> Code wird generiert...
7>------ Erstellen gestartet: Projekt: unpack_test, Konfiguration: Debug x64 ------
7> Generating unpack_test.moc
7> Building Custom Rule D:/Meeting/qmsgpackneu/qmsgpack-master/tests/unpack/CMakeLists.txt
7> CMake does not need to re-run because D:\Meeting\qmsgpackneu\qmsgpack-master\build\tests\unpack\CMakeFiles\generate.stamp is up-to-date.
7> unpack_test.cpp
7>D:\Meeting\qmsgpackneu\qmsgpack-master\tests\unpack\unpack_test.cpp(51): warning C4146: Einem vorzeichenlosen Typ wurde ein unärer Minus-Operator zugewiesen. Das Ergebnis ist weiterhin vorzeichenlos.
7>D:\Meeting\qmsgpackneu\qmsgpack-master\tests\unpack\unpack_test.cpp(54): warning C4146: Einem vorzeichenlosen Typ wurde ein unärer Minus-Operator zugewiesen. Das Ergebnis ist weiterhin vorzeichenlos.
7> unpack_test_automoc.cpp
7> Code wird generiert...
6>LINK : fatal error LNK1104: Datei "..\..\src\Debug\qmsgpackd.lib" kann nicht geöffnet werden.
7>LINK : fatal error LNK1104: Datei "..\..\src\Debug\qmsgpackd.lib" kann nicht geöffnet werden.
8>------ Erstellen gestartet: Projekt: ALL_BUILD, Konfiguration: Debug x64 ------
8> Building Custom Rule D:/Meeting/qmsgpackneu/qmsgpack-master/CMakeLists.txt
8> CMake does not need to re-run because D:\Meeting\qmsgpackneu\qmsgpack-master\build\CMakeFiles\generate.stamp is up-to-date.
9>------ Erstellen übersprungen: Projekt: INSTALL, Konfiguration: Debug x64 ------
9>Für diese Projektmappenkonfiguration wurde kein zu erstellendes Projekt ausgewählt.
========== Erstellen: 2 erfolgreich, 4 fehlerhaft, 0 aktuell, 3 übersprungen ==========
Why?
Two bytes is not large enough to store the number of seconds in a day (72000) even if you were to store the absolute value.
As implemented, MsgPackPrivate::pack_qtime_raw (qt_types_p.cpp) stores the hour, minute and second values separately bit shifted but truncates the most significant bit of the hour.
This causes packed QTime and QDateTime values with an hour greater than or equal to 4PM to roll over to Midnight.
Tests are not built by default and calling
make tests
results in
make: *** No rule to make target 'tests'. Stop.
Can we correct this, please?
cmake -DBUILD_TESTS=ON ..
if QVariantList
contains some element that can not be packed, the packer just silently ignore this element and print warning, There is no way to report this error to upper caller.
QVariantList l;
l << 1 << 2 << objectCanNotPacked() << 3;
qDebug() << MsgPack::unpack(MsgPack::pack(l));
Then 1,2,3,
is output.
This library looks well written. Would love a first release.
The library seems well tested. How about adding a travis.yml
for building/running tests on Travis CI? If you configure Travis / service hooks, I could try to cook up a travis.yml
(using it for a little project of my own).
The message pack specification says that in32 shall be packed with 0xD2 prefix - see https://github.com/msgpack/msgpack/blob/master/spec.md. However, qmsgpack packs signed integer as unsigned if their value is positive - see src/private/pack_p.cpp, MsgPackPrivate::pack_int.
Hello,
I'm trying to build an example of using your library under Windows 10 and QT Creator.
The library configuration is:
LIBS += -L$$PWD/../../qmsgpack/bin/ -lqmsgpackd
INCLUDEPATH += $$PWD/../../qmsgpack/src
DEPENDPATH += $$PWD/../../qmsgpack/bin
PRE_TARGETDEPS += $$PWD/../../qmsgpack/bin/qmsgpackd.lib
and result of building is:
error LNK2019: unresolved external symbol "__declspec(dllimport) class QVariant __cdecl MsgPack::unpack(class QByteArray const &)" (_imp?unpack@MsgPack@@ya?AVQVariant@@ABVQByteArray@@@z) referenced in function "void __cdecl test_float(void)" (?test_float@@yaxxz)
error LNK2019: unresolved external symbol "__declspec(dllimport) class QByteArray __cdecl MsgPack::pack(class QVariant const &)" (_imp?pack@MsgPack@@ya?AVQByteArray@@ABVQVariant@@@z) referenced in function "void __cdecl test_float(void)" (?test_float@@yaxxz)
fatal error LNK1120: 2 unresolved externals
How to fix it?
Thanks.
Regards,
Victor.
Hello,
I was able to build qmsgpack with cmake 3.5.0-rc3, mingw493_32 and Qt5.5.1.
The lib (libqmsgpack.a and qmsgpack.dll) is stored in a subdirectory named /lib to the project root (the location where my *.pro file is stored).
I can use MsgPack::pack() and MsgPack::unpack() without problems but when I try to use MsgPackStream the following compiler error appears:
undefined reference to 'MsgPackStream::MsgPackStream(QByteArray const&)
undefined reference to MsgPackStream::~MsgPackStream()
undefined reference to MsgPackStream:~MsgPackStram()
error: ld returned 1 exit status
I"m rockin' Win7 Home x64 SP1, and using Qt Creator 5.02 with Qt 5.15.2. I have a MSVC 2017 x64 toolchain.
I extract a zip of the latest code, open the .pro file in Qt Creator 5.02, and get the error:
"LNK1181: cannot open input file 'qmsgpack.lib'"
This is not entirely unsurprising, since it only produces qmsgpack0.lib and qmsgpack0.dll. Renaming them to qmsgpack.lib and qmsgpack.dll gets the examples to compile and run just fine; after opening the main .pro file in Qt Creator. Adding LIBS += -L$$PWD/QMsgPack/qmsgpack.lib
to my project's .pro file and linking to the lib produces a link error:
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) class QByteArray __cdecl MsgPack::pack(class QVariant const &)" (__imp_?pack@MsgPack@@YA?AVQByteArray@@AEBVQVariant@@@Z) referenced in function "public: __cdecl MainWindow::MainWindow(class QWidget *)" (??0MainWindow@@QEAA@PEAVQWidget@@@Z)
Even when I just included the entire source in the project, and tried to compile it, I got that same error!
The commands you give to build and install it "Installation — qmsgpack 1.0.0rc documentation" don't work on Windows. For one thing, it uses nmake for MSVC.
It would really be nice to have a MessagePack that knows Qt, so that I don't have to covert everything over to STL containers and data types. I'd really like to see version 1.00!
I can't find any license for the library.
A packet from network may contains invalid length. QMsgpack
have code like this:
int len = _msgpack_load32(int, p);
p += 4;
v = QString::fromUtf8((char*)p, len);
or
len = _msgpack_load32(quint32, &p[1]);
array.resize(len);
It is dangerous to use the len
directly before checking the memory boundary.
I suggest adding a lengthLimit
property to QMsgpackStream
. If QMsgpackStream
is constructed from a QByteArray
, the lengthLimit
is set to QByteArray::size()
automatically.
when i compile the cmake package, i get a dynamic library, but i hope i can use a static one.
Could you please help me with it.
I packed the list as given in the examples
QList<QVariant> list;
list << 123 << 4.56 << true;
packed = MsgPack::pack(list);
qDebug() << packed.toHex();
but how to unpack them while holding their types?
Hi,
commenting msgpackcommon.h
----%<--------%<--------%<--------%<----
//#ifdef Q_OS_WINRT
//#endif
----%<--------%<--------%<--------%<----
makes it compile.
This patch is here: https://github.com/jiangcaiyang/qmsgpack-patched
It adds some precompiled directives and modified some code, so as to be able to get compiled by Qt for Windows RT.
If you think the patch is usable, please accept it and get it into your repository.
At the moment, it looks like the library has some global data (compat mode, the hash of user packers), which makes me guess the library is not thread safe? It would be great if it were. Until then, it would at least be nice if the thread-unsafetyness was documented in README.md
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.