diff --git a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs
index 54633a5d72..87b486ea65 100644
--- a/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs
+++ b/src/ImageSharp/Formats/Jpeg/Components/Decoder/ProfileResolver.cs
@@ -1,8 +1,7 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System;
-using System.Text;
namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
{
@@ -12,24 +11,38 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
internal static class ProfileResolver
{
///
- /// Describes the JFIF specific markers.
+ /// Gets the JFIF specific markers.
///
- public static readonly byte[] JFifMarker = Encoding.ASCII.GetBytes("JFIF\0");
+ public static ReadOnlySpan JFifMarker => new[]
+ {
+ (byte)'J', (byte)'F', (byte)'I', (byte)'F', (byte)'\0'
+ };
///
- /// Describes the ICC specific markers.
+ /// Gets the ICC specific markers.
///
- public static readonly byte[] IccMarker = Encoding.ASCII.GetBytes("ICC_PROFILE\0");
+ public static ReadOnlySpan IccMarker => new[]
+ {
+ (byte)'I', (byte)'C', (byte)'C', (byte)'_',
+ (byte)'P', (byte)'R', (byte)'O', (byte)'F',
+ (byte)'I', (byte)'L', (byte)'E', (byte)'\0'
+ };
///
- /// Describes the EXIF specific markers.
+ /// Gets the EXIF specific markers.
///
- public static readonly byte[] ExifMarker = Encoding.ASCII.GetBytes("Exif\0\0");
+ public static ReadOnlySpan ExifMarker => new[]
+ {
+ (byte)'E', (byte)'x', (byte)'i', (byte)'f', (byte)'\0', (byte)'\0'
+ };
///
- /// Describes Adobe specific markers .
+ /// Gets the Adobe specific markers .
///
- public static readonly byte[] AdobeMarker = Encoding.ASCII.GetBytes("Adobe");
+ public static ReadOnlySpan AdobeMarker => new[]
+ {
+ (byte)'A', (byte)'d', (byte)'o', (byte)'b', (byte)'e'
+ };
///
/// Returns a value indicating whether the passed bytes are a match to the profile identifier.
@@ -43,4 +56,4 @@ namespace SixLabors.ImageSharp.Formats.Jpeg.Components.Decoder
&& bytesToCheck.Slice(0, profileIdentifier.Length).SequenceEqual(profileIdentifier);
}
}
-}
\ No newline at end of file
+}
diff --git a/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs b/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs
index c908abc505..fb09065b0a 100644
--- a/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs
+++ b/tests/ImageSharp.Tests/Formats/Jpg/ProfileResolverTests.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Six Labors and contributors.
+// Copyright (c) Six Labors and contributors.
// Licensed under the Apache License, Version 2.0.
using System.Text;
@@ -19,25 +19,25 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
[Fact]
public void ProfileResolverHasCorrectJFifMarker()
{
- Assert.Equal(JFifMarker, ProfileResolver.JFifMarker);
+ Assert.Equal(JFifMarker, ProfileResolver.JFifMarker.ToArray());
}
[Fact]
public void ProfileResolverHasCorrectExifMarker()
{
- Assert.Equal(ExifMarker, ProfileResolver.ExifMarker);
+ Assert.Equal(ExifMarker, ProfileResolver.ExifMarker.ToArray());
}
[Fact]
public void ProfileResolverHasCorrectIccMarker()
{
- Assert.Equal(IccMarker, ProfileResolver.IccMarker);
+ Assert.Equal(IccMarker, ProfileResolver.IccMarker.ToArray());
}
[Fact]
public void ProfileResolverHasCorrectAdobeMarker()
{
- Assert.Equal(AdobeMarker, ProfileResolver.AdobeMarker);
+ Assert.Equal(AdobeMarker, ProfileResolver.AdobeMarker.ToArray());
}
[Fact]
@@ -76,4 +76,4 @@ namespace SixLabors.ImageSharp.Tests.Formats.Jpg
Assert.False(ProfileResolver.IsProfile(AdobeMarker, ProfileResolver.IccMarker));
}
}
-}
\ No newline at end of file
+}