From 99a81d297c6ddc5aaab86273b4a98c25bec2e833 Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Tue, 4 Aug 2015 07:10:36 +0100 Subject: Fix build warnings around unused variables --- csharp/src/Google.Protobuf.Test/FieldCodecTest.cs | 2 ++ csharp/src/Google.Protobuf.Test/IssuesTest.cs | 3 +-- csharp/src/Google.Protobuf/JsonFormatter.cs | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs index 6f145a44..38ba227f 100644 --- a/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs +++ b/csharp/src/Google.Protobuf.Test/FieldCodecTest.cs @@ -39,6 +39,7 @@ namespace Google.Protobuf { public class FieldCodecTest { +#pragma warning disable 0414 // Used by tests via reflection - do not remove! private static readonly List Codecs = new List { new FieldCodecTestData(FieldCodec.ForBool(100), true, "Bool"), @@ -61,6 +62,7 @@ namespace Google.Protobuf new FieldCodecTestData( FieldCodec.ForMessage(100, ForeignMessage.Parser), new ForeignMessage { C = 10 }, "Message"), }; +#pragma warning restore 0414 [Test, TestCaseSource("Codecs")] public void RoundTripWithTag(ICodecTestData codec) diff --git a/csharp/src/Google.Protobuf.Test/IssuesTest.cs b/csharp/src/Google.Protobuf.Test/IssuesTest.cs index 47a10c50..a0350035 100644 --- a/csharp/src/Google.Protobuf.Test/IssuesTest.cs +++ b/csharp/src/Google.Protobuf.Test/IssuesTest.cs @@ -49,8 +49,7 @@ namespace Google.Protobuf ItemField message = new ItemField { Item = 3 }; FieldDescriptor field = ItemField.Descriptor.FindFieldByName("item"); Assert.NotNull(field); - // TODO(jonskeet): Reflection... - // Assert.AreEqual(3, (int)message[field]); + Assert.AreEqual(3, (int)field.Accessor.GetValue(message)); } [Test] diff --git a/csharp/src/Google.Protobuf/JsonFormatter.cs b/csharp/src/Google.Protobuf/JsonFormatter.cs index 999e106c..223aa027 100644 --- a/csharp/src/Google.Protobuf/JsonFormatter.cs +++ b/csharp/src/Google.Protobuf/JsonFormatter.cs @@ -739,7 +739,6 @@ namespace Google.Protobuf private const string Hex = "0123456789abcdef"; private static void HexEncodeUtf16CodeUnit(StringBuilder builder, char c) { - uint utf16 = c; builder.Append("\\u"); builder.Append(Hex[(c >> 12) & 0xf]); builder.Append(Hex[(c >> 8) & 0xf]); -- cgit v1.2.3