Commit Graph

63 Commits

Author SHA1 Message Date
Konstantin Ritt a412eedf24 Fix build with QT_NO_CAST_FROM_ASCII 2018-03-02 16:01:00 +03:00
Roman Isaikin b7284725e8 Fix bugs in msgpackstream.cpp, add PVS Studio headers and how to, add stream test to Qt project. 2017-07-10 16:02:38 +03:00
Roman Isaikin aa613f658f Merge pull request #26 from arturo182/master
Fix location module detection
2017-03-02 11:52:33 +03:00
Matthew Stickney ca56d9e362 Add an option to flush writes.
There is a bug with QLocalSockets on Windows where data will be silently
dropped if two consecutive writes are performed without flushing and the
remote end hasn't read all the data between the two (see
https://bugreports.qt.io/browse/QTBUG-18385). Since qmsgpack performs
several write operations as part of a single stream output, it must allow
callers to specify whether to flush writes in order to work around this
bug.
2017-02-27 17:32:49 -05:00
arturo182 22750cf88b Fix location module detection 2017-02-20 10:20:18 +01:00
Matthew Stickney 067c72767a Handle partial writes correctly.
QIODevice::write() can theoretically write any number of bytes less than
the amount that was requested. If the result was >= 0, we haven't hit EOF
or an actual error yet and should continue attempting to write. Note that
the docs[1] for QIODevice::writeData() specify that writeData should write
all available data before returning or else QDataStream won't work, but
that's no guarantee that all implementors of QIODevice will actually do so.

Also note that this does not call QIODevice::waitForBytesWritten after
writing, which would negate the benefits of buffering for buffered devices.
As a side-effect, that means this will spin if the writes don't complete.

[1] http://doc.qt.io/qt-5/qiodevice.html#writeData
2017-02-16 16:24:13 -05:00
Matthew Stickney bec0d71cc1 Initialize the stream status to OK in the QIODevice constructor.
Without this, the status is an an uninitialize state, which causes the
precondition checks to fail on writes.
2017-02-16 16:24:04 -05:00
Roman Isaikin 51932532d2 Merge pull request #24 from arturo182/master
Improvement and a fix
2017-02-16 23:02:49 +03:00
arturo182 6e753f0669 Fix erroneous comparison instead of assignment 2017-02-15 10:20:25 +01:00
arturo182 2d8af48459 Make the qtlocation module an optional dependency 2017-02-15 10:13:28 +01:00
Matthew Stickney 4ff4ba8448 Handle partial reads correctly.
QIODevice::read() can read any number of bytes less than the amount
requested if there wasn't that much data available. If the result is >= 0,
we haven't actually hit EOF yet and should continue trying to read data.
Since QIODevice::read() doesn't block, we use QIODevice::waitForReadyRead()
to avoid spinning waiting for input to arrive.

If we encounter EOF or another error during a read, we set the ReadPastEnd
status and walk away as normal.
2017-02-08 18:46:31 -05:00
Enoch Carter 35b0e9108c changed QMetaType::Type T to int to allow registration of custom QMetaTypes 2016-05-26 08:51:54 -06:00
Roman Isaikin 363e20d2c6 Merge pull request #21 from romixlab/static-build
Static build, tests for QMap, missing export & includes for Windows build
2016-04-26 23:45:30 +03:00
Roman Isaikin 7cbc3c3138 Fix 64bit integers pack, issue #20. 2016-04-26 22:26:46 +03:00
Roman Isaikin 49b6c10986 Merge branch 'master' into static-build 2016-04-09 22:37:40 +03:00
Roman Isaikin 66c8a7cf33 Merge remote-tracking branch 'pixraider-remote/master' into static-build 2016-04-09 22:30:20 +03:00
Roman Isaikin 46f6184f22 Merge pull request #18 from lugia-kun/master
MSVC build fix
2016-04-09 22:06:13 +03:00
Роман Исайкин 6e023af9e0 Fix MsgPackStream export. 2016-04-06 11:33:23 +03:00
Hajime Yoshimori af0e130c58 Merge branch 'master' of https://github.com/romixlab/qmsgpack 2016-01-09 21:16:48 +09:00
Roman Isaikin b23c76ddf0 Nil packing and unpacking fix 2015-12-31 10:36:25 +03:00
pixraider a0a1956aec + qmsgpack.pri for static linking to any project 2015-11-27 21:52:10 +03:00
Hajime Yoshimori 527fb32676 Fix build under MSVC18.0 (2012)
- stdint.h (which defines uint16_t and uint32_t) is bundled with the
  versions starting from MSVC14.0 (2010)
2015-10-05 10:42:03 +09:00
Isaikin Roman f000efd79d Merge branch 'master' of https://github.com/jiangcaiyang/qmsgpack-patched 2015-09-12 17:09:12 +03:00
Isaikin Roman 02b8cb0260 Qt4 build fix. 2015-09-12 16:59:01 +03:00
Isaikin Roman 5761f66683 Qt types stream operators, documentation updated, custom types support improved, bug fixes and new tests. 2015-09-12 16:48:21 +03:00
jiangcaiyang 45c485476a To work with Windows Phone
Changed some code to cater to MSVC compiler, it potentially support
Windows Runtime ( i.e. Windows Metro Applications ).
2015-09-10 10:18:10 +08:00
Isaikin Roman 4da435044d MsgPackStream missing dev() added. Some little improvements. 2015-08-28 21:12:09 +03:00
Roman Isaikin 5be342038a .pro make install now working. 2015-08-07 22:56:51 +03:00
Roman Isaikin 169c2bb59d .pro files added 2015-08-07 22:40:18 +03:00
Roman Isaikin d868f78621 Doc work 2015-07-12 22:35:34 +03:00
Roman 4258811d95 msgpack_common.h define fix 2015-06-30 15:56:10 +03:00
Roman 4973aa88f2 qt_types test fixed
Sphinx doc added
2015-06-29 20:47:24 +03:00
Roman a175a79fda Merge pull request #12 from anton-dutov/nil-pack
Nil pack
2015-06-29 20:36:29 +03:00
Roman 63c15f9ead Qt4 user type fixes
QDate, QTime, QDateTime, QPoint, QSize, QRect isNull() checks
2015-06-29 19:52:59 +03:00
Roman ce6ddab5e4 CMake BUILD_TESTS variable added
TRUE and FALSE renamed to MTRUE and MFALSE
stream.h[cpp] renamed to msgpackstream.h[cpp]
QMap and QHash added to MsgPackStream + test
2015-06-29 14:32:35 +03:00
Anton Dutov deac492817 Nil packer and unittests pack/unpack for nil 2015-06-29 01:33:48 +05:00
Anton Dutov c8b826c6a0 Unpack nil fix 2015-06-29 01:19:10 +05:00
Isaikin Roman 318aa870cd sysdep.h moved to endianhelper.h for MsgPackStream
MsgPackStream integers fixed (unpack_upto_* removed, bad idea)
MsgPackStream::test_array added
2015-06-10 17:42:06 +03:00
Isaikin Roman 9e61498ca2 MsgPackStream: writeBytes() added 2015-05-29 20:15:26 +03:00
Roman 7d5d72e814 Some bugs fixed
float support added
float, double, QByteArray, QList<T> to MsgPackStream added
float, double, QByteArrat tests for MsgPackStream added
2015-05-24 22:31:35 +03:00
Isaikin Roman 1277a0c204 MsgPackStream: float, double 2015-05-23 20:00:40 +03:00
Roman 2acfaf4cc5 Typo 2015-05-19 23:02:13 +03:00
Roman f978fb0d78 MsgPackStream QString and const char * added
Qt types: QPoint, QSize, QRect implemented using MsgPackStream
MsgPackStream QString tests added
2015-05-19 22:41:22 +03:00
Roman b7fbf6413e MsgPackStream integers pack and unpack
User types packers now called only once, and return QByteArray
2015-05-16 21:45:33 +03:00
Isaikin Roman 32b04745ee MsgPackStream work 2015-05-16 12:07:10 +03:00
Roman 87bd3dedb1 MsgPackStream work (now working now) 2015-05-15 22:49:39 +03:00
Roman 1ae96715cf Started work on MsgPackStream 2015-05-02 00:06:35 +03:00
Roman 3b0d6e3c31 Work on QTime, QDate, QDateTime, QSize, QPoint, QRect
unpack_upto_<integer> added for user packer / unpacker functions
2015-04-22 23:47:31 +03:00
Roman 6d04bc66c6 ExtHelpers added 2015-04-15 22:59:59 +03:00
Isaikin Roman 6cf1e17492 1/2 QPoint 2015-04-15 19:13:54 +03:00