Skip to content

Commit 143cbf3

Browse files
committed
Fix remaining broken normalize cases.
1 parent 7dc9bec commit 143cbf3

File tree

5 files changed

+173
-4
lines changed

5 files changed

+173
-4
lines changed
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
6+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
7+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
8+
<ProjectGuid>{F119722F-5E6A-4479-A4CF-0CE00FF29737}</ProjectGuid>
9+
<OutputType>Library</OutputType>
10+
<AppDesignerFolder>Properties</AppDesignerFolder>
11+
<RootNamespace>JsonLD.Portable</RootNamespace>
12+
<AssemblyName>JsonLD.Portable</AssemblyName>
13+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14+
<TargetFrameworkProfile>Profile78</TargetFrameworkProfile>
15+
<FileAlignment>512</FileAlignment>
16+
<ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
17+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
18+
<RestorePackages>true</RestorePackages>
19+
</PropertyGroup>
20+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
21+
<DebugSymbols>true</DebugSymbols>
22+
<DebugType>full</DebugType>
23+
<Optimize>false</Optimize>
24+
<OutputPath>bin\Debug\</OutputPath>
25+
<DefineConstants>TRACE;DEBUG;PORTABLE</DefineConstants>
26+
<ErrorReport>prompt</ErrorReport>
27+
<WarningLevel>4</WarningLevel>
28+
</PropertyGroup>
29+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
30+
<DebugType>pdbonly</DebugType>
31+
<Optimize>true</Optimize>
32+
<OutputPath>bin\Release\</OutputPath>
33+
<DefineConstants>TRACE;PORTABLE</DefineConstants>
34+
<ErrorReport>prompt</ErrorReport>
35+
<WarningLevel>4</WarningLevel>
36+
</PropertyGroup>
37+
<ItemGroup>
38+
<Compile Include="..\src\JsonLD\Core\Context.cs">
39+
<Link>Context.cs</Link>
40+
</Compile>
41+
<Compile Include="..\src\JsonLD\Core\DocumentLoader.cs">
42+
<Link>DocumentLoader.cs</Link>
43+
</Compile>
44+
<Compile Include="..\src\JsonLD\Core\IJSONLDTripleCallback.cs">
45+
<Link>IJSONLDTripleCallback.cs</Link>
46+
</Compile>
47+
<Compile Include="..\src\JsonLD\Core\IRDFParser.cs">
48+
<Link>IRDFParser.cs</Link>
49+
</Compile>
50+
<Compile Include="..\src\JsonLD\Core\JsonLdApi.cs">
51+
<Link>JsonLdApi.cs</Link>
52+
</Compile>
53+
<Compile Include="..\src\JsonLD\Core\JSONLDConsts.cs">
54+
<Link>JSONLDConsts.cs</Link>
55+
</Compile>
56+
<Compile Include="..\src\JsonLD\Core\JsonLdError.cs">
57+
<Link>JsonLdError.cs</Link>
58+
</Compile>
59+
<Compile Include="..\src\JsonLD\Core\JsonLdOptions.cs">
60+
<Link>JsonLdOptions.cs</Link>
61+
</Compile>
62+
<Compile Include="..\src\JsonLD\Core\JsonLdProcessor.cs">
63+
<Link>JsonLdProcessor.cs</Link>
64+
</Compile>
65+
<Compile Include="..\src\JsonLD\Core\JsonLdUtils.cs">
66+
<Link>JsonLdUtils.cs</Link>
67+
</Compile>
68+
<Compile Include="..\src\JsonLD\Core\NormalizeUtils.cs">
69+
<Link>NormalizeUtils.cs</Link>
70+
</Compile>
71+
<Compile Include="..\src\JsonLD\Core\RDFDataset.cs">
72+
<Link>RDFDataset.cs</Link>
73+
</Compile>
74+
<Compile Include="..\src\JsonLD\Core\RDFDatasetUtils.cs">
75+
<Link>RDFDatasetUtils.cs</Link>
76+
</Compile>
77+
<Compile Include="..\src\JsonLD\Core\Regex.cs">
78+
<Link>Regex.cs</Link>
79+
</Compile>
80+
<Compile Include="..\src\JsonLD\Core\RemoteDocument.cs">
81+
<Link>RemoteDocument.cs</Link>
82+
</Compile>
83+
<Compile Include="..\src\JsonLD\Core\UniqueNamer.cs">
84+
<Link>UniqueNamer.cs</Link>
85+
</Compile>
86+
<Compile Include="..\src\JsonLD\Impl\NQuadRDFParser.cs">
87+
<Link>NQuadRDFParser.cs</Link>
88+
</Compile>
89+
<Compile Include="..\src\JsonLD\Impl\NQuadTripleCallback.cs">
90+
<Link>NQuadTripleCallback.cs</Link>
91+
</Compile>
92+
<Compile Include="..\src\JsonLD\Impl\TurtleRDFParser.cs">
93+
<Link>TurtleRDFParser.cs</Link>
94+
</Compile>
95+
<Compile Include="..\src\JsonLD\Impl\TurtleTripleCallback.cs">
96+
<Link>TurtleTripleCallback.cs</Link>
97+
</Compile>
98+
<Compile Include="..\src\JsonLD\Util\JavaCompat.cs">
99+
<Link>JavaCompat.cs</Link>
100+
</Compile>
101+
<Compile Include="..\src\JsonLD\Util\JSONUtils.cs">
102+
<Link>JSONUtils.cs</Link>
103+
</Compile>
104+
<Compile Include="..\src\JsonLD\Util\Obj.cs">
105+
<Link>Obj.cs</Link>
106+
</Compile>
107+
<Compile Include="..\src\JsonLD\Util\URL.cs">
108+
<Link>URL.cs</Link>
109+
</Compile>
110+
<Compile Include="Properties\AssemblyInfo.cs" />
111+
</ItemGroup>
112+
<ItemGroup>
113+
<Reference Include="Newtonsoft.Json">
114+
<HintPath>..\packages\Newtonsoft.Json.6.0.1\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll</HintPath>
115+
</Reference>
116+
</ItemGroup>
117+
<ItemGroup>
118+
<None Include="packages.config" />
119+
</ItemGroup>
120+
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
121+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
122+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
123+
<PropertyGroup>
124+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
125+
</PropertyGroup>
126+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
127+
</Target>
128+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
129+
Other similar extension points exist, see Microsoft.Common.targets.
130+
<Target Name="BeforeBuild">
131+
</Target>
132+
<Target Name="AfterBuild">
133+
</Target>
134+
-->
135+
</Project>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Resources;
2+
using System.Reflection;
3+
using System.Runtime.CompilerServices;
4+
using System.Runtime.InteropServices;
5+
6+
// General Information about an assembly is controlled through the following
7+
// set of attributes. Change these attribute values to modify the information
8+
// associated with an assembly.
9+
[assembly: AssemblyTitle("JsonLD.Portable")]
10+
[assembly: AssemblyDescription("")]
11+
[assembly: AssemblyConfiguration("")]
12+
[assembly: AssemblyCompany("")]
13+
[assembly: AssemblyProduct("JsonLD.Portable")]
14+
[assembly: AssemblyCopyright("Copyright © 2014")]
15+
[assembly: AssemblyTrademark("")]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: NeutralResourcesLanguage("en")]
18+
19+
// Version information for an assembly consists of the following four values:
20+
//
21+
// Major Version
22+
// Minor Version
23+
// Build Number
24+
// Revision
25+
//
26+
// You can specify all the values or you can default the Build and Revision Numbers
27+
// by using the '*' as shown below:
28+
// [assembly: AssemblyVersion("1.0.*")]
29+
[assembly: AssemblyVersion("1.0.0.0")]
30+
[assembly: AssemblyFileVersion("1.0.0.0")]

JsonLD.Portable/packages.config

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="Newtonsoft.Json" version="6.0.1" targetFramework="portable-net45+wp80+win+MonoAndroid10+MonoTouch10" />
4+
</packages>

src/JsonLD/Core/NormalizeUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ private static string HashQuads(string id, IDictionary<string, IDictionary<strin
472472
nquads.Add(RDFDatasetUtils.ToNQuad((RDFDataset.Quad)quads[i], quads[i].TryGetValue("name", out name) ? (string)((IDictionary<string,object>)name)["value"] : null, id));
473473
}
474474
// sort serialized quads
475-
nquads.SortInPlace();
475+
nquads.SortInPlace(StringComparer.Ordinal);
476476
// return hashed quads
477477
string hash = Sha1hash(nquads);
478478
((IDictionary<string,object>)bnodes[id])["hash"] = hash;
@@ -529,7 +529,7 @@ private static string EncodeHex(byte[] data)
529529
/// <returns>the adjacent blank node name or null if none was found.</returns>
530530
private static string GetAdjacentBlankNodeName(IDictionary<string,object> node, string id)
531531
{
532-
return (string)node["type"] == "blank node" && (!node.ContainsKey("value") || (string)node["value"] == id) ? (string)node["value"] : null;
532+
return (string)node["type"] == "blank node" && (!node.ContainsKey("value") || (string)node["value"] != id) ? (string)node["value"] : null;
533533
}
534534

535535
private class Permutator

src/JsonLD/Util/JavaCompat.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ public bool Find()
356356
#if !PORTABLE
357357
internal class MessageDigest
358358
{
359-
HMACSHA1 md;
359+
SHA1 md;
360360
Stream stream;
361361

362362
public static MessageDigest GetInstance(string algorithm)
@@ -367,7 +367,7 @@ public static MessageDigest GetInstance(string algorithm)
367367

368368
public MessageDigest()
369369
{
370-
md = new HMACSHA1();
370+
md = new SHA1Managed();
371371
stream = new MemoryStream();
372372
}
373373

0 commit comments

Comments
 (0)