diff --git a/src/ImageSharp/Formats/Png/PngChunk.cs b/src/ImageSharp/Formats/Png/PngChunk.cs index 89352ff7e9..2566492f44 100644 --- a/src/ImageSharp/Formats/Png/PngChunk.cs +++ b/src/ImageSharp/Formats/Png/PngChunk.cs @@ -10,7 +10,7 @@ namespace SixLabors.ImageSharp.Formats.Png /// internal readonly struct PngChunk { - public PngChunk(int length, PngChunkType type, IManagedByteBuffer data = null, uint crc = default) + public PngChunk(int length, PngChunkType type, IManagedByteBuffer data = null, uint crc = 0) { this.Length = length; this.Type = type; @@ -28,7 +28,7 @@ namespace SixLabors.ImageSharp.Formats.Png /// /// Gets the chunk type. - /// The chunk type value the UInt32BigEndian encoding of its 4 ASCII characters. + /// The value is the equal to the UInt32BigEndian encoding of its 4 ASCII characters. /// public PngChunkType Type { get; } diff --git a/src/ImageSharp/Formats/Png/PngChunkType.cs b/src/ImageSharp/Formats/Png/PngChunkType.cs index 14550e8aca..f2dae5c67d 100644 --- a/src/ImageSharp/Formats/Png/PngChunkType.cs +++ b/src/ImageSharp/Formats/Png/PngChunkType.cs @@ -3,6 +3,9 @@ namespace SixLabors.ImageSharp.Formats.Png { + /// + /// Contains a list of possible chunk types. + /// internal enum PngChunkType : uint { Header = 1229472850U, // IHDR diff --git a/src/ImageSharp/Formats/Png/PngDecoderCore.cs b/src/ImageSharp/Formats/Png/PngDecoderCore.cs index 053e9f712b..4230984e73 100644 --- a/src/ImageSharp/Formats/Png/PngDecoderCore.cs +++ b/src/ImageSharp/Formats/Png/PngDecoderCore.cs @@ -1241,9 +1241,9 @@ namespace SixLabors.ImageSharp.Formats.Png if (this.crc.Value != chunk.Crc) { - string chunkName = Encoding.UTF8.GetString(this.chunkTypeBuffer, 0, 4); + string chunkTypeName = Encoding.UTF8.GetString(this.chunkTypeBuffer, 0, 4); - throw new ImageFormatException($"CRC Error. PNG {chunkName} chunk is corrupt!"); + throw new ImageFormatException($"CRC Error. PNG {chunkTypeName} chunk is corrupt!"); } } diff --git a/tests/ImageSharp.Tests/Formats/Png/PngChunkTests.cs b/tests/ImageSharp.Tests/Formats/Png/PngChunkTests.cs index 3d1da000be..687548963b 100644 --- a/tests/ImageSharp.Tests/Formats/Png/PngChunkTests.cs +++ b/tests/ImageSharp.Tests/Formats/Png/PngChunkTests.cs @@ -23,7 +23,7 @@ namespace SixLabors.ImageSharp.Tests.Formats.Png private static PngChunkType GetType(string text) { - return (PngChunkType)BinaryPrimitives.ReadInt32BigEndian(Encoding.UTF8.GetBytes(text).AsSpan()); + return (PngChunkType)BinaryPrimitives.ReadInt32BigEndian(Encoding.UTF8.GetBytes(text)); } } -} +} \ No newline at end of file