Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Clean up

  • Loading branch information...
commit d49a7da86d3185619f954300630520fc711aadd2 1 parent c98c0fc
Masahiro Nakagawa repeatedly authored
4 example/compare_json.d
View
@@ -13,14 +13,14 @@ import msgpack.msgpack;
void main()
{
- JSONValue jsonObj = parseJSON(`[12, "foo", true, 0.23]`);
+ JSONValue jsonObj = parseJSON(`[12, "foo", true, 0.23, {"1":1}, [1, 2]]`);
void f1()
{
parseJSON(toJSON(&jsonObj));
}
- mp_Object mpObj = mp_Object([mp_Object(12UL), mp_Object(cast(ubyte[])"foo"), mp_Object(true), mp_Object(0.23)]);
+ mp_Object mpObj = unpack(pack(12, "foo", true, 0.23, ["1":1], [1, 2]));
void f2()
{
6 src/msgpack/packer.d
View
@@ -550,7 +550,7 @@ struct Packer(Buffer) if (isOutputRange!(Buffer, ubyte) && isOutputRange!(Buffer
ref Packer packArray(in size_t length)
{
if (length < 16) {
- ubyte temp = Format.ARRAY | cast(ubyte)length;
+ const ubyte temp = Format.ARRAY | cast(ubyte)length;
buffer_.put(take8from(temp));
} else if (length < 65536) {
const temp = convertEndianTo!16(length);
@@ -574,7 +574,7 @@ struct Packer(Buffer) if (isOutputRange!(Buffer, ubyte) && isOutputRange!(Buffer
ref Packer packMap(in size_t length)
{
if (length < 16) {
- ubyte temp = Format.MAP | cast(ubyte)length;
+ const ubyte temp = Format.MAP | cast(ubyte)length;
buffer_.put(take8from(temp));
} else if (length < 65536) {
const temp = convertEndianTo!16(length);
@@ -598,7 +598,7 @@ struct Packer(Buffer) if (isOutputRange!(Buffer, ubyte) && isOutputRange!(Buffer
ref Packer packRaw(in size_t length)
{
if (length < 32) {
- ubyte temp = Format.RAW | cast(ubyte)length;
+ const ubyte temp = Format.RAW | cast(ubyte)length;
buffer_.put(take8from(temp));
} else if (length < 65536) {
const temp = convertEndianTo!16(length);
8 src/msgpack/unpacker.d
View
@@ -519,14 +519,6 @@ struct Unpacker
temp.fraction = load64To!(typeof(temp.fraction))(buffer_[base..expb]);
mixin("temp.exponent = load" ~ ES.stringof[0..2] ~ // delete u suffix
"To!(typeof(temp.exponent))(buffer_[expb..expb + temp.exponent.sizeof]);");
- /*
- static if (ES == 16)
- temp.exponent = load16To!(typeof(temp.exponent))(buffer_[expb..expb + temp.exponent.sizeof]);
- else static if (ES == 32)
- temp.exponent = load32To!(typeof(temp.exponent))(buffer_[expb..expb + temp.exponent.sizeof]);
- else
- temp.exponent = load64To!(typeof(temp.exponent))(buffer_[expb..expb + temp.exponent.sizeof]);
- */
unpackFloat(obj, temp.f);
goto Lpush;
case State.UINT8:
Please sign in to comment.
Something went wrong with that request. Please try again.