mirror of
https://github.com/romixlab/qmsgpack.git
synced 2025-07-30 10:27:15 +02:00
bin wrong first byte
This commit is contained in:
@ -208,19 +208,18 @@ quint8 *MsgPackPrivate::pack_double(double i, quint8 *p, bool wr)
|
|||||||
quint8 *MsgPackPrivate::pack_bin(const QByteArray &arr, quint8 *p, bool wr)
|
quint8 *MsgPackPrivate::pack_bin(const QByteArray &arr, quint8 *p, bool wr)
|
||||||
{
|
{
|
||||||
int len = arr.length();
|
int len = arr.length();
|
||||||
if (len <= std::numeric_limits<quint8>::max() &&
|
if (len <= std::numeric_limits<quint8>::max()) {
|
||||||
compatibilityMode == false) {
|
if (wr) *p = compatibilityMode ? 0xd9 : 0xc4;
|
||||||
if (wr) *p = 0xc4;
|
|
||||||
p++;
|
p++;
|
||||||
if (wr) *p = len;
|
if (wr) *p = len;
|
||||||
p++;
|
p++;
|
||||||
} else if (len <= std::numeric_limits<quint16>::max()) {
|
} else if (len <= std::numeric_limits<quint16>::max()) {
|
||||||
if (wr) *p = compatibilityMode ? 0xc5 : 0xda;
|
if (wr) *p = compatibilityMode ? 0xda : 0xc5;
|
||||||
p++;
|
p++;
|
||||||
if (wr) _msgpack_store16(p, len);
|
if (wr) _msgpack_store16(p, len);
|
||||||
p += 2;
|
p += 2;
|
||||||
} else {
|
} else {
|
||||||
if (wr) *p = compatibilityMode ? 0xc6 : 0xdb;
|
if (wr) *p = compatibilityMode ? 0xdb : 0xc6;
|
||||||
p++;
|
p++;
|
||||||
if (wr) _msgpack_store32(p, len);
|
if (wr) _msgpack_store32(p, len);
|
||||||
p += 4;
|
p += 4;
|
||||||
|
Reference in New Issue
Block a user