Browse Source

Refactored byte[] array in ExifConstants type

pull/1574/head
Sergio Pedri 6 years ago
parent
commit
1991339b0b
  1. 10
      src/ImageSharp/Metadata/Profiles/Exif/ExifConstants.cs
  2. 2
      src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs

10
src/ImageSharp/Metadata/Profiles/Exif/ExifConstants.cs

@ -1,11 +1,13 @@
// Copyright (c) Six Labors and contributors.
// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
internal static class ExifConstants
{
public static readonly byte[] LittleEndianByteOrderMarker =
public static ReadOnlySpan<byte> LittleEndianByteOrderMarker => new byte[]
{
(byte)'I',
(byte)'I',
@ -13,7 +15,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
0x00,
};
public static readonly byte[] BigEndianByteOrderMarker =
public static ReadOnlySpan<byte> BigEndianByteOrderMarker => new byte[]
{
(byte)'M',
(byte)'M',
@ -21,4 +23,4 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
0x2A
};
}
}
}

2
src/ImageSharp/Metadata/Profiles/Exif/ExifWriter.cs

@ -77,7 +77,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
int i = 0;
// The byte order marker for little-endian, followed by the number 42 and a 0
ExifConstants.LittleEndianByteOrderMarker.AsSpan().CopyTo(result.AsSpan(start: i));
ExifConstants.LittleEndianByteOrderMarker.CopyTo(result.AsSpan(start: i));
i += ExifConstants.LittleEndianByteOrderMarker.Length;
uint ifdOffset = ((uint)i - startIndex) + 4U;

Loading…
Cancel
Save