Browse Source

build fixes, minor improves

pull/1760/head
Ildar Khayrutdinov 5 years ago
parent
commit
d670edcccf
  1. 15
      src/ImageSharp/Metadata/Profiles/Exif/Values/ExifLong8Array.cs
  2. 4
      src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumberArray.cs

15
src/ImageSharp/Metadata/Profiles/Exif/Values/ExifLong8Array.cs

@ -1,6 +1,8 @@
// Copyright (c) Six Labors.
// Licensed under the Apache License, Version 2.0.
using System.Runtime.CompilerServices;
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
{
internal sealed class ExifLong8Array : ExifArrayValue<ulong>
@ -29,9 +31,9 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
return ExifDataType.Long;
}
for (int i = 0; i < this.Value.Length; i++)
foreach (ulong value in this.Value)
{
if (this.Value[i] > uint.MaxValue)
if (value > uint.MaxValue)
{
return ExifDataType.Long8;
}
@ -64,7 +66,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
case long[] array:
{
if (value.GetType().Equals(typeof(ulong[])))
if (value.GetType() == typeof(ulong[]))
{
return this.SetArray((ulong[])value);
}
@ -74,7 +76,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
case int[] array:
{
if (value.GetType().Equals(typeof(uint[])))
if (value.GetType() == typeof(uint[]))
{
return this.SetArray((uint[])value);
}
@ -84,7 +86,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
case short[] array:
{
if (value.GetType().Equals(typeof(ushort[])))
if (value.GetType() == typeof(ushort[]))
{
return this.SetArray((ushort[])value);
}
@ -106,10 +108,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
private bool SetArray(long[] values)
{
var numbers = new ulong[values.Length];
this.Value = Unsafe.As<long[], ulong[]>(ref values);
this.Value = numbers;
return true;
}

4
src/ImageSharp/Metadata/Profiles/Exif/Values/ExifNumberArray.cs

@ -24,9 +24,9 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
return ExifDataType.Short;
}
for (int i = 0; i < this.Value.Length; i++)
foreach (Number value in this.Value)
{
if (this.Value[i] > ushort.MaxValue)
if (value > ushort.MaxValue)
{
return ExifDataType.Long;
}

Loading…
Cancel
Save