Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static final boolean isFixedArray(byte b)

public static final boolean isFixedMap(byte b)
{
return (b & (byte) 0xe0) == Code.FIXMAP_PREFIX;
return (b & (byte) 0xf0) == Code.FIXMAP_PREFIX;
}

public static final boolean isFixedRaw(byte b)
Expand Down
32 changes: 32 additions & 0 deletions msgpack-core/src/test/scala/org/msgpack/core/MessagePackTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,38 @@ class MessagePackTest extends MessagePackSpec {
}
}

"detect fixarray values" in {

val packer = new MessagePackFactory().newBufferPacker()
packer.packArrayHeader(0)
packer.close
val bytes = packer.toByteArray
new MessagePackFactory().newUnpacker(bytes).unpackArrayHeader() shouldBe 0
try {
new MessagePackFactory().newUnpacker(bytes).unpackMapHeader()
fail("Shouldn't reach here")
}
catch {
case e: MessageTypeException => // OK
}
}

"detect fixmap values" in {

val packer = new MessagePackFactory().newBufferPacker()
packer.packMapHeader(0)
packer.close
val bytes = packer.toByteArray
new MessagePackFactory().newUnpacker(bytes).unpackMapHeader() shouldBe 0
try {
new MessagePackFactory().newUnpacker(bytes).unpackArrayHeader()
fail("Shouldn't reach here")
}
catch {
case e: MessageTypeException => // OK
}
}

"detect fixint quickly" in {

val N = 100000
Expand Down