Browse Source

Reduce magic

pull/495/head
Jason Nelson 8 years ago
parent
commit
0b6754b478
  1. 2
      src/ImageSharp/Formats/Gif/GifConstants.cs
  2. 4
      src/ImageSharp/Formats/Gif/GifEncoderCore.cs

2
src/ImageSharp/Formats/Gif/GifConstants.cs

@ -24,7 +24,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
/// <summary>
/// The ASCII encoded bytes used to identify the GIF file.
/// </summary>
internal static readonly byte[] MagicNumber = { 71, 73, 70, 56, 57, 97 }; // GIF89a
internal static readonly byte[] MagicNumber = Encoding.UTF8.GetBytes(FileType + FileVersion);
/// <summary>
/// The extension block introducer <value>!</value>.

4
src/ImageSharp/Formats/Gif/GifEncoderCore.cs

@ -157,7 +157,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
/// <param name="writer">The writer to write to the stream with.</param>
private void WriteHeader(EndianBinaryWriter writer)
{
writer.Write(GifConstants.MagicNumber, 0, GifConstants.MagicNumber.Length);
writer.Write(GifConstants.MagicNumber);
}
/// <summary>
@ -213,7 +213,7 @@ namespace SixLabors.ImageSharp.Formats.Gif
writer.Write(this.buffer, 0, 3);
writer.Write(GifConstants.ApplicationIdentificationBytes, 0, GifConstants.ApplicationIdentificationBytes.Length); // NETSCAPE2.0
writer.Write(GifConstants.ApplicationIdentificationBytes); // NETSCAPE2.0
writer.Write((byte)3); // Application block length
writer.Write((byte)1); // Data sub-block index (always 1)

Loading…
Cancel
Save