From 1bb7f24e664750def641d8aa4f6bdada2c05d828 Mon Sep 17 00:00:00 2001 From: Peter O Date: Mon, 14 Dec 2015 07:59:44 -0500 Subject: [PATCH] Fix NuGet package; prepare for version 2.3.1 --- CBOR.nuspec | 11 +++++++++-- CBORTest/CBORObjectTest.cs | 5 +++-- CBORTest/DataUtilitiesTest.cs | 9 +++++---- LICENSE.md | 2 +- PeterO/Cbor/CBOREncodeOptions.cs | 14 -------------- PeterO/Cbor/CBORObject.cs | 14 ++++++++++---- PeterO/DataUtilities.cs | 4 ++-- Properties/AssemblyInfo.cs | 2 +- README.md | 4 ++++ 9 files changed, 35 insertions(+), 30 deletions(-) diff --git a/CBOR.nuspec b/CBOR.nuspec index 298cd4a3..977b8dc2 100644 --- a/CBOR.nuspec +++ b/CBOR.nuspec @@ -2,7 +2,7 @@ PeterO.Cbor - 2.3.0 + 2.3.1 CBOR Peter Occil Peter Occil @@ -16,6 +16,8 @@ A C# implementation of Concise Binary Object Representation (CBOR), a data serialization format. This implementation can also convert between CBOR and JSON. +In version 2.3.1: +- Fixed NuGet package In version 2.3: - The C# version of the library now also targets "dotnet", which should make it compatible with platform .NET runtime environments such as the upcoming cross-platform "coreclr" runtime. @@ -30,7 +32,6 @@ See the project page for release notes on previous versions: https://github.com/ cbor data serialization binary json numbers arithmetic - @@ -43,4 +44,10 @@ See the project page for release notes on previous versions: https://github.com/ + + + + + + \ No newline at end of file diff --git a/CBORTest/CBORObjectTest.cs b/CBORTest/CBORObjectTest.cs index 6516133f..a6d76c2c 100644 --- a/CBORTest/CBORObjectTest.cs +++ b/CBORTest/CBORObjectTest.cs @@ -1790,8 +1790,9 @@ public void TestFromJSONString() { } string jsonTemp = TestCommon.Repeat( "[", -2000) + TestCommon.Repeat("]", - 2000); +2000) + TestCommon.Repeat( +"]", +2000); try { CBORObject.FromJSONString(jsonTemp); Assert.Fail("Should have failed"); diff --git a/CBORTest/DataUtilitiesTest.cs b/CBORTest/DataUtilitiesTest.cs index 40a76ef6..455e3782 100644 --- a/CBORTest/DataUtilitiesTest.cs +++ b/CBORTest/DataUtilitiesTest.cs @@ -165,9 +165,10 @@ public void TestCodePointBefore() { Assert.AreEqual( 0xd800, DataUtilities.CodePointBefore("A\ud800\udc00B", 2, 1)); - Assert.AreEqual( --1, -DataUtilities.CodePointBefore("A\ud800\udc00B" , 2, 2)); + { +long numberTemp = DataUtilities.CodePointBefore("A\ud800\udc00B" , 2, 2); +Assert.AreEqual(-1, numberTemp); +} Assert.AreEqual(0xfffd, DataUtilities.CodePointBefore("\udc00B", 1)); Assert.AreEqual(0xdc00, DataUtilities.CodePointBefore("\udc00B", 1, 1)); Assert.AreEqual(-1, DataUtilities.CodePointBefore("\udc00B", 1, 2)); @@ -257,7 +258,7 @@ public static String Repeat(String c, int num) { private void TestUtf8RoundTrip(string str) { Assert.AreEqual( str, -DataUtilities.GetUtf8String( DataUtilities.GetUtf8Bytes(str, true), true)); +DataUtilities.GetUtf8String(DataUtilities.GetUtf8Bytes(str, true), true)); } [Test] diff --git a/LICENSE.md b/LICENSE.md index 430bb6b2..8fea1f08 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,3 +1,3 @@ -Written by Peter O. in 2013-2014. In the public domain. +Written by Peter O. in 2013-2015. In the public domain. Public domain dedication: [http://creativecommons.org/publicdomain/zero/1.0/](http://creativecommons.org/publicdomain/zero/1.0/) diff --git a/PeterO/Cbor/CBOREncodeOptions.cs b/PeterO/Cbor/CBOREncodeOptions.cs index a22fa71b..2376aa1c 100644 --- a/PeterO/Cbor/CBOREncodeOptions.cs +++ b/PeterO/Cbor/CBOREncodeOptions.cs @@ -23,20 +23,6 @@ public int Value { } } - /// Not documented yet. - /// An arbitrary object. - /// A Boolean object. - public override bool Equals(object other) { - var enc = other as CBOREncodeOptions; - return (enc == null) ? (false) : (enc.Value == this.Value); - } - - /// Not documented yet. - /// A 32-bit signed integer. - public override int GetHashCode() { - return this.Value; - } - private CBOREncodeOptions(int value) { this.value = value; } diff --git a/PeterO/Cbor/CBORObject.cs b/PeterO/Cbor/CBORObject.cs index 185ed8fa..25caa98f 100644 --- a/PeterO/Cbor/CBORObject.cs +++ b/PeterO/Cbor/CBORObject.cs @@ -1065,8 +1065,7 @@ public static CBORObject FromObject(IDictionaryEnum objects), maps, and types with a - /// registered CBOR type converter. + /// arrays, enumerations ( Enum objects), and maps. /// In the .NET version, if the object is a type not specially /// handled by this method, returns a CBOR map with the values of each /// of its read/write properties (or all properties in the case of an @@ -3424,8 +3423,15 @@ internal static ICBORTag FindTagConverter(BigInteger bigintTag) { AddTagHandler((BigInteger)30, new CBORTag30()); } lock (tagHandlers) { - return (tagHandlers.ContainsKey(bigintTag)) ? - (tagHandlers[bigintTag]) : (null); + if (tagHandlers.ContainsKey(bigintTag)) { + return tagHandlers[bigintTag]; + } +#if DEBUG + if (bigintTag.Equals((BigInteger)2)) { + throw new InvalidOperationException("Expected valid tag handler"); + } +#endif + return null; } } diff --git a/PeterO/DataUtilities.cs b/PeterO/DataUtilities.cs index df238618..c0276864 100644 --- a/PeterO/DataUtilities.cs +++ b/PeterO/DataUtilities.cs @@ -198,7 +198,7 @@ public static long GetUtf8Length(String str, bool replace) { /// The Unicode code point at the previous position. Returns /// -1 if is 0 or less, or is greater than the /// string's length. Returns the replacement character (U + FFFD) if - /// the previous code unit is an unpaired surrogate code + /// the previous character is an unpaired surrogate code /// point. /// The parameter is null. @@ -212,7 +212,7 @@ public static int CodePointBefore(string str, int index) { /// Index of the current position into the /// string. /// Specifies what kind of value to - /// return if the previous code unit is an unpaired surrogate code + /// return if the previous character is an unpaired surrogate code /// point: if 0, return the replacement character (U + FFFD); if 1, /// return the value of the surrogate code point; if neither 0 nor 1, /// return -1. diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 19c36154..8111aa08 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -33,4 +33,4 @@ Any copyright is dedicated to the Public Domain. // // You can specify all the values or you can use the default the Revision and // Build Numbers by using the '*' as shown below: -[assembly: AssemblyVersion("3.0.0")] +[assembly: AssemblyVersion("2.3.1")] diff --git a/README.md b/README.md index df48a58c..ee59c911 100644 --- a/README.md +++ b/README.md @@ -233,6 +233,10 @@ The following are some clarifications to RFC 7049. Release Notes ----------- +In version 2.3.1 (.NET version only): + +- Fixed NuGet package + In version 2.3: - The C# version of the library now also targets "dotnet", which should make it compatible with platform .NET runtime