Skip to content

Commit

Permalink
upgrade msgpack-unity3d to version 2.3.2. closes #36
Browse files Browse the repository at this point in the history
  • Loading branch information
endel committed Mar 29, 2018
1 parent cabfc50 commit 23c7ff3
Show file tree
Hide file tree
Showing 70 changed files with 31 additions and 27 deletions.
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/IJsonReader.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/IJsonWriter.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/IValueInfo.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/IndexedDictionary.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/Json.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonMember.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonReader.cs
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonStreamReader.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonStreamWriter.cs
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonStringReader.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonTextReader.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonTextWriter.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonToken.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonUtils.cs
100644 → 100755
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/JsonWriter.cs
100644 → 100755
Empty file.
Empty file.
Empty file.
20 changes: 12 additions & 8 deletions Assets/Plugins/GameDevWare.Serialization/MessagePack/DefaultMsgPackExtensionTypeHandler.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ public override bool TryRead(sbyte type, ArraySegment<byte> data, out object val
return false;

var buffer = data.Array;
var guidValue = new Guid
(
this.bitConverter.ToUInt32(buffer, data.Offset),
this.bitConverter.ToUInt16(buffer, data.Offset + 4),
this.bitConverter.ToUInt16(buffer, data.Offset + 6),
unchecked
{
var guidValue = new Guid
(
(uint)(buffer[data.Offset + 3] << 24 | buffer[data.Offset + 2] << 16 | buffer[data.Offset + 1] << 8 | buffer[data.Offset + 0]),
(ushort)(buffer[data.Offset + 5] << 8 | buffer[data.Offset + 4]),
(ushort)(buffer[data.Offset + 7] << 8 | buffer[data.Offset + 6]),
buffer[data.Offset + 8],
buffer[data.Offset + 9],
buffer[data.Offset + 10],
Expand All @@ -105,9 +107,11 @@ public override bool TryRead(sbyte type, ArraySegment<byte> data, out object val
buffer[data.Offset + 13],
buffer[data.Offset + 14],
buffer[data.Offset + 15]
);
value = guidValue;
return true;
);

value = guidValue;
return true;
}
default:
return false;
}
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
14 changes: 7 additions & 7 deletions Assets/Plugins/GameDevWare.Serialization/MessagePack/MsgPackReader.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -260,15 +260,15 @@ public bool NextToken()
this.closingTokens.Push(new ClosingToken { Token = JsonToken.EndOfObject, Counter = mapCount * 2 + 1 });
this.Value.SetValue(null, JsonToken.BeginObject, pos);
}
else if (formatValue >= (byte)MsgPackType.NegativeFixIntStart && formatValue <= (byte)MsgPackType.NegativeFixIntEnd)
else if (formatValue >= (byte)MsgPackType.NegativeFixIntStart)
{
var value = -(formatValue - (byte)MsgPackType.NegativeFixIntStart);
this.Value.SetValue((sbyte)value, JsonToken.Number, pos);
var value = unchecked((sbyte)formatValue);
this.Value.SetValue(value, JsonToken.Number, pos);
}
else if (formatValue >= (byte)MsgPackType.PositiveFixIntStart && formatValue <= (byte)MsgPackType.PositiveFixIntEnd)
else if (formatValue <= (byte)MsgPackType.PositiveFixIntEnd)
{
var value = formatValue - (byte)MsgPackType.PositiveFixIntStart;
this.Value.SetValue((byte)value, JsonToken.Number, pos);
var value = unchecked((byte)formatValue);
this.Value.SetValue(value, JsonToken.Number, pos);
}
else
{
Expand Down Expand Up @@ -421,7 +421,7 @@ public bool NextToken()
break;
case MsgPackType.Int8:
this.ReadToBuffer(1, throwOnEos: true);
this.Value.SetValue((sbyte)this.buffer[this.bufferOffset], JsonToken.Number, pos);
this.Value.SetValue(unchecked((sbyte)this.buffer[this.bufferOffset]), JsonToken.Number, pos);
break;
case MsgPackType.Int16:
this.ReadToBuffer(2, throwOnEos: true);
Expand Down
Empty file.
Empty file.
20 changes: 10 additions & 10 deletions Assets/Plugins/GameDevWare.Serialization/MessagePack/MsgPackWriter.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -109,31 +109,31 @@ public void Write(JsonMember value)

public void Write(int number)
{
if (number > -32 && number < 0)
if (number >= -32 && number < 0)
{
var formatByte = (byte)((byte)Math.Abs(number) | (byte)MsgPackType.NegativeFixIntStart);
var formatByte = unchecked((byte)number);
this.buffer[0] = formatByte;
this.outputStream.Write(this.buffer, 0, 1);
this.bytesWritten += 1;
}
else if (number >= 0 && number < 128)
{
var formatByte = (byte)((byte)number | (byte)MsgPackType.PositiveFixIntStart);
var formatByte = unchecked((byte)number);
this.buffer[0] = formatByte;
this.outputStream.Write(this.buffer, 0, 1);
this.bytesWritten += 1;
}
else if (number <= sbyte.MaxValue && number >= sbyte.MinValue)
{
this.WriteType(MsgPackType.Int8);
this.buffer[0] = (byte)(sbyte)number;
this.buffer[0] = unchecked((byte)(sbyte)number);
this.outputStream.Write(this.buffer, 0, 1);
this.bytesWritten += 1;
}
else if (number <= short.MaxValue && number >= short.MinValue)
{
this.WriteType(MsgPackType.Int16);
this.bitConverter.CopyBytes((short)number, this.buffer, 0);
this.bitConverter.CopyBytes(checked((short)number), this.buffer, 0);
this.outputStream.Write(this.buffer, 0, 2);
this.bytesWritten += 2;
}
Expand All @@ -150,22 +150,22 @@ public void Write(uint number)
{
if (number < 128)
{
var formatByte = (byte)((byte)number | (byte)MsgPackType.PositiveFixIntStart);
var formatByte = checked((byte)number);
this.buffer[0] = formatByte;
this.outputStream.Write(this.buffer, 0, 1);
this.bytesWritten += 1;
}
else if (number <= byte.MaxValue)
{
this.WriteType(MsgPackType.UInt8);
this.buffer[0] = (byte)number;
this.buffer[0] = checked((byte)number);
this.outputStream.Write(this.buffer, 0, 1);
this.bytesWritten += 1;
}
else if (number <= ushort.MaxValue)
{
this.WriteType(MsgPackType.UInt16);
this.bitConverter.CopyBytes((ushort)number, this.buffer, 0);
this.bitConverter.CopyBytes(checked((ushort)number), this.buffer, 0);
this.outputStream.Write(this.buffer, 0, 2);
this.bytesWritten += 2;
}
Expand All @@ -182,7 +182,7 @@ public void Write(long number)
{
if (number <= int.MaxValue && number >= int.MinValue)
{
this.Write((int)number);
this.Write(checked((int)number));
return;
}

Expand All @@ -196,7 +196,7 @@ public void Write(ulong number)
{
if (number <= uint.MaxValue)
{
this.Write((uint)number);
this.Write(checked((uint)number));
return;
}

Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/MsgPack.cs
100644 → 100755
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
4 changes: 2 additions & 2 deletions Assets/Plugins/GameDevWare.Serialization/Serializers/UriSerializer.cs
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*
/*
Copyright (c) 2016 Denis Zykov, GameDevWare.com
This a part of "Json & MessagePack Serialization" Unity Asset - https://www.assetstore.unity3d.com/#!/content/59918
Expand Down Expand Up @@ -37,7 +37,7 @@ public override void Serialize(IJsonWriter writer, object value)
if (value == null) throw new ArgumentNullException("value");

var uri = (Uri)value;
writer.WriteString(uri.ToString());
writer.WriteString(uri.OriginalString);
}
}
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file modified Assets/Plugins/GameDevWare.Serialization/TypeSerializer.cs
100644 → 100755
Empty file.
Empty file.

0 comments on commit 23c7ff3

Please sign in to comment.