Skip to content
This repository has been archived by the owner on May 16, 2022. It is now read-only.

Commit

Permalink
1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Oct 13, 2017
1 parent 7c25e6e commit d41ec00
Show file tree
Hide file tree
Showing 15 changed files with 124 additions and 61 deletions.
6 changes: 3 additions & 3 deletions docs/Utf8Json.AspNetCoreMvcFormatter.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json.AspNetCoreMvcFormatter</id>
<version>1.2.1</version>
<version>1.2.2</version>
<title>Utf8Json AspNetCoreMvcFormatter</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand All @@ -13,11 +13,11 @@
<tags>Json, Serialization, Formatter, Serializer, Unity, Xamarin, ASPNET</tags>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.0.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="Microsoft.AspNetCore.Mvc.Abstractions" version="2.0.0" exclude="Build,Analyzers" />
</group>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions docs/Utf8Json.ImmutableCollection.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json.ImmutableCollection</id>
<version>1.2.1</version>
<version>1.2.2</version>
<title>Utf8Json Extension Resolver for ImmutableCollection</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand All @@ -13,15 +13,15 @@
<tags>Json, Serialization, Formatter, Serializer, Unity, Xamarin</tags>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="System.Collections.Immutable" version="1.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="System.Collections.Immutable" version="1.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="System.Collections.Immutable" version="1.4.0" exclude="Build,Analyzers" />
</group>
</dependencies>
Expand Down
8 changes: 4 additions & 4 deletions docs/Utf8Json.UnityShims.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json.UnityShims</id>
<version>1.2.1</version>
<version>1.2.2</version>
<title>Utf8Json UnityShims</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand All @@ -13,15 +13,15 @@
<tags>Json, Serialization, Formatter, Serializer, Unity, Xamarin</tags>
<dependencies>
<group targetFramework=".NETFramework4.7">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETFramework4.5">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Utf8Json" version="1.2.1" exclude="Build,Analyzers" />
<dependency id="Utf8Json" version="1.2.2" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
</group>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion docs/Utf8Json.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Utf8Json</id>
<version>1.2.1</version>
<version>1.2.2</version>
<title>Utf8Json</title>
<authors>neuecc</authors>
<owners>neuecc</owners>
Expand Down
8 changes: 4 additions & 4 deletions docs/push.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nuget push Utf8Json.1.2.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.ImmutableCollection.1.2.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.UnityShims.1.2.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.AspNetCoreMvcFormatter.1.2.1.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.1.2.2.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.ImmutableCollection.1.2.2.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.UnityShims.1.2.2.nupkg -Source https://www.nuget.org/api/v2/package
nuget push Utf8Json.AspNetCoreMvcFormatter.1.2.2.nupkg -Source https://www.nuget.org/api/v2/package
4 changes: 2 additions & 2 deletions src/Utf8Json.AspNetCoreMvcFormatter/_AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
[assembly: ComVisible(false)]

[assembly: Guid("899f8b6c-c4c7-4e8b-9875-f61fdfb630bd")]
[assembly: AssemblyVersion("1.2.1")]
[assembly: AssemblyFileVersion("1.2.1")]
[assembly: AssemblyVersion("1.2.2")]
[assembly: AssemblyFileVersion("1.2.2")]
2 changes: 1 addition & 1 deletion src/Utf8Json.CodeGenerator/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.2.1.0" newVersion="1.2.1.0" />
<bindingRedirect oldVersion="0.0.0.0-1.2.2.0" newVersion="1.2.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.IO.Compression" publicKeyToken="b77a5c561934e089" culture="neutral" />
Expand Down
4 changes: 2 additions & 2 deletions src/Utf8Json.ImmutableCollection/_AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
[assembly: ComVisible(false)]

[assembly: Guid("2e7ac239-3db1-4772-9f47-5f62abb56ed0")]
[assembly: AssemblyVersion("1.2.1")]
[assembly: AssemblyFileVersion("1.2.1")]
[assembly: AssemblyVersion("1.2.2")]
[assembly: AssemblyFileVersion("1.2.2")]
1 change: 1 addition & 0 deletions src/Utf8Json.UnityClient/Utf8Json.UnityClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
<Compile Include="Assets\Scripts\Utf8Json\Internal\Emit\MetaMember.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Internal\Emit\MetaType.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Internal\FarmHash.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Internal\FuncExtensions.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Internal\GuidBits.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Internal\NumberConverter.cs" />
<Compile Include="Assets\Scripts\Utf8Json\Internal\ReflectionExtensions.cs" />
Expand Down
4 changes: 2 additions & 2 deletions src/Utf8Json.UnityShims/_AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
[assembly: ComVisible(false)]

[assembly: Guid("bf5d0a42-70b7-417d-af8c-2f7e073057e2")]
[assembly: AssemblyVersion("1.2.1")]
[assembly: AssemblyFileVersion("1.2.1")]
[assembly: AssemblyVersion("1.2.2")]
[assembly: AssemblyFileVersion("1.2.2")]
67 changes: 35 additions & 32 deletions src/Utf8Json/Formatters/DateTimeFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ public DateTime Deserialize(ref JsonReader reader, IJsonFormatterResolver format
var array = str.Array;
var i = str.Offset;
var len = str.Count;
var to = str.Offset + str.Count;

// YYYY
if (len == 4)
Expand Down Expand Up @@ -288,55 +289,55 @@ public DateTime Deserialize(ref JsonReader reader, IJsonFormatterResolver format
var second = (array[i++] - (byte)'0') * 10 + (array[i++] - (byte)'0');

int ticks = 0;
if (i < len && array[i] == '.')
if (i < to && array[i] == '.')
{
i++;

// *7.
if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1000000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 100000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 10000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 100;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 10;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1;
i++;

// others, lack of precision
while (i < len && NumberConverter.IsNumber(array[i]))
while (i < to && NumberConverter.IsNumber(array[i]))
{
i++;
}
}

END_TICKS:
var kind = DateTimeKind.Unspecified;
if (i <= len && array[i] == 'Z')
if (i < to && array[i] == 'Z')
{
kind = DateTimeKind.Utc;
}
else if (i < len && array[i] == '-' || array[i] == '+')
else if (i < to && array[i] == '-' || array[i] == '+')
{
if (!(i + 5 <= len)) goto ERROR;
if (!(i + 5 < to)) goto ERROR;

kind = DateTimeKind.Local;
var minus = array[i++] == '-';
Expand Down Expand Up @@ -591,6 +592,7 @@ public DateTimeOffset Deserialize(ref JsonReader reader, IJsonFormatterResolver
var array = str.Array;
var i = str.Offset;
var len = str.Count;
var to = str.Offset + str.Count;

// YYYY
if (len == 4)
Expand Down Expand Up @@ -637,51 +639,51 @@ public DateTimeOffset Deserialize(ref JsonReader reader, IJsonFormatterResolver
var second = (array[i++] - (byte)'0') * 10 + (array[i++] - (byte)'0');

int ticks = 0;
if (i < len && array[i] == '.')
if (i < to && array[i] == '.')
{
i++;

// *7.
if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1000000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 100000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 10000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 100;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 10;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1;
i++;

// others, lack of precision
while (i < len && NumberConverter.IsNumber(array[i]))
while (i < to && NumberConverter.IsNumber(array[i]))
{
i++;
}
}

END_TICKS:

if (i < len && array[i] == '-' || array[i] == '+')
if (i < to && array[i] == '-' || array[i] == '+')
{
if (!(i + 5 <= len)) goto ERROR;
if (!(i + 5 < to)) goto ERROR;

var minus = array[i++] == '-';

Expand Down Expand Up @@ -853,6 +855,7 @@ public TimeSpan Deserialize(ref JsonReader reader, IJsonFormatterResolver format
var array = str.Array;
var i = str.Offset;
var len = str.Count;
var to = str.Offset + str.Count;

// check day exists
bool hasDay = false;
Expand Down Expand Up @@ -914,41 +917,41 @@ public TimeSpan Deserialize(ref JsonReader reader, IJsonFormatterResolver format
var second = (array[i++] - (byte)'0') * 10 + (array[i++] - (byte)'0');

int ticks = 0;
if (i < len && array[i] == '.')
if (i < to && array[i] == '.')
{
i++;

// *7.
if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1000000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 100000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 10000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1000;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 100;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 10;
i++;

if (!(i <= len) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
if (!(i < to) || !NumberConverter.IsNumber(array[i])) goto END_TICKS;
ticks += (array[i] - (byte)'0') * 1;
i++;

// others, lack of precision
while (i < len && NumberConverter.IsNumber(array[i]))
while (i < to && NumberConverter.IsNumber(array[i]))
{
i++;
}
Expand Down
6 changes: 5 additions & 1 deletion src/Utf8Json/Formatters/StandardClassLibraryFormatters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,11 @@ public Lazy<T> Deserialize(ref JsonReader reader, IJsonFormatterResolver formatt

// deserialize immediately(no delay, because capture byte[] causes memory leak)
var v = formatterResolver.GetFormatterWithVerify<T>().Deserialize(ref reader, formatterResolver);
#if NETSTANDARD
return new Lazy<T>(v.AsFunc());
#else
return new Lazy<T>(() => v);
#endif
}
}

Expand Down Expand Up @@ -639,7 +643,7 @@ public ValueTask<T> Deserialize(ref JsonReader reader, IJsonFormatterResolver fo
}

#endif
}
}

namespace Utf8Json.Formatters.Internal
{
Expand Down
Loading

0 comments on commit d41ec00

Please sign in to comment.