Skip to content

Commit 3291956

Browse files
committed
Merge pull request #156 from MartinWeindel/v07-develop
fixed packExtendedTypeHeader for payload length = 32, 64, 128
2 parents 9cb9bfa + b68b7ee commit 3291956

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,12 @@ public MessagePacker packExtendedTypeHeader(int extType, int payloadLen) throws
451451
writeByteAndByte(FIXEXT4, (byte) extType);
452452
} else if(payloadLen == 8) {
453453
writeByteAndByte(FIXEXT8, (byte) extType);
454-
} else {
454+
} else if(payloadLen == 16) {
455455
writeByteAndByte(FIXEXT16, (byte) extType);
456-
}
456+
} else {
457+
writeByteAndByte(EXT8, (byte) payloadLen);
458+
writeByte((byte) extType);
459+
}
457460
} else {
458461
writeByteAndByte(EXT8, (byte) payloadLen);
459462
writeByte((byte) extType);

msgpack-core/src/test/scala/org/msgpack/core/MessagePackTest.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ class MessagePackTest extends MessagePackSpec {
348348
}
349349
}
350350

351-
val testHeaderLength = Seq(1, 2, 4, 8, 16, 1000, 2000, 10000, 50000, 100000, 500000)
351+
val testHeaderLength = Seq(1, 2, 4, 8, 16, 17, 32, 64, 255, 256, 1000, 2000, 10000, 50000, 100000, 500000)
352352

353353

354354
"pack/unpack arrays" taggedAs ("array") in {

0 commit comments

Comments
 (0)