From 09f75f4ac20ddbf1da8ccbc1db93be2101931949 Mon Sep 17 00:00:00 2001 From: Olivia Date: Mon, 19 Dec 2016 10:05:54 +0100 Subject: [PATCH] Fixing default value type constructor warnings. --- src/ImageSharp/Bootstrapper.cs | 2 +- src/ImageSharp/Common/Helpers/Guard.cs | 1 + src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs | 2 +- src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs | 8 ++++---- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/ImageSharp/Bootstrapper.cs b/src/ImageSharp/Bootstrapper.cs index de4bcc938..b29c66c58 100644 --- a/src/ImageSharp/Bootstrapper.cs +++ b/src/ImageSharp/Bootstrapper.cs @@ -71,7 +71,7 @@ namespace ImageSharp Guard.NotNullOrEmpty(format.Extension, nameof(format), "The extension should not be null or empty."); Guard.NotNullOrEmpty(format.SupportedExtensions, nameof(format), "The supported extensions not be null or empty."); - GuardDuplicate(format); + this.GuardDuplicate(format); this.imageFormats.Add(format); } diff --git a/src/ImageSharp/Common/Helpers/Guard.cs b/src/ImageSharp/Common/Helpers/Guard.cs index b67512525..cf307e936 100644 --- a/src/ImageSharp/Common/Helpers/Guard.cs +++ b/src/ImageSharp/Common/Helpers/Guard.cs @@ -65,6 +65,7 @@ namespace ImageSharp /// /// Verifies, that the enumeration is not null and not empty. /// + /// The type of objects in the /// The target enumeration, which should be checked against being null or empty. /// Name of the parameter. /// The error message, if any to add to the exception. diff --git a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs index 33b73cdd1..b1f0fb458 100644 --- a/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs +++ b/src/ImageSharp/Formats/Jpg/Components/Block8x8F.cs @@ -381,7 +381,7 @@ namespace ImageSharp.Formats internal void Clear() { // The cheapest way to do this in C#: - this = new Block8x8F(); + this = default(Block8x8F); } /// diff --git a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs index c209cde3f..71cb4c0f6 100644 --- a/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs +++ b/src/ImageSharp/Formats/Jpg/JpegDecoderCore.cs @@ -1533,12 +1533,12 @@ namespace ImageSharp.Formats // blocks: the third block in the first row has (bx, by) = (2, 0). int bx, by, blockCount = 0; - Block8x8F b = new Block8x8F(); - Block8x8F temp1 = new Block8x8F(); - Block8x8F temp2 = new Block8x8F(); + Block8x8F b = default(Block8x8F); + Block8x8F temp1 = default(Block8x8F); + Block8x8F temp2 = default(Block8x8F); // Tricky way to copy contents of the Unzig static variable to the stack: - StackallocUnzigData unzigOnStack = new StackallocUnzigData(); + StackallocUnzigData unzigOnStack = default(StackallocUnzigData); int* unzigPtr = unzigOnStack.Data; Marshal.Copy(Unzig, 0, (IntPtr)unzigPtr, 64);