Browse Source

build fixes

pull/1760/head
Ildar Khayrutdinov 5 years ago
parent
commit
eb8b6f2586
  1. 32
      src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs
  2. 2
      src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs
  3. 2
      src/ImageSharp/Metadata/Profiles/Exif/Values/ExifLong8Array.cs

32
src/ImageSharp/Formats/Tiff/TiffDecoderCore.cs

@ -335,8 +335,20 @@ namespace SixLabors.ImageSharp.Formats.Tiff
int stripIndex = i;
for (int planeIndex = 0; planeIndex < stripsPerPixel; planeIndex++)
{
ulong offset = stripOffsets.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val };
ulong count = stripByteCounts.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val };
ulong offset = stripOffsets.GetValue(stripIndex) switch
{
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
ulong count = stripByteCounts.GetValue(stripIndex) switch
{
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
decompressor.Decompress(
this.inputStream,
offset,
@ -423,8 +435,20 @@ namespace SixLabors.ImageSharp.Formats.Tiff
break;
}
ulong offset = stripOffsets.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val };
ulong count = stripByteCounts.GetValue(stripIndex) switch { ulong val => val, Number val => (uint)val };
ulong offset = stripOffsets.GetValue(stripIndex) switch
{
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
ulong count = stripByteCounts.GetValue(stripIndex) switch
{
ulong val => val,
Number val => (uint)val,
_ => throw TiffThrowHelper.ThrowImageFormatException("Expected Number or Long8 array")
};
decompressor.Decompress(
this.inputStream,
offset,

2
src/ImageSharp/Formats/Tiff/TiffThrowHelper.cs

@ -16,7 +16,7 @@ namespace SixLabors.ImageSharp.Formats.Tiff
/// </summary>
/// <param name="errorMessage">The error message for the exception.</param>
[MethodImpl(MethodImplOptions.NoInlining)]
public static void ThrowImageFormatException(string errorMessage) => throw new ImageFormatException(errorMessage);
public static Exception ThrowImageFormatException(string errorMessage) => throw new ImageFormatException(errorMessage);
[MethodImpl(InliningOptions.ColdPath)]
public static Exception NotSupportedDecompressor(string compressionType) => throw new NotSupportedException($"Not supported decoder compression method: {compressionType}");

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

@ -31,7 +31,7 @@ namespace SixLabors.ImageSharp.Metadata.Profiles.Exif
return ExifDataType.Long;
}
foreach (ulong value in this.Value)
foreach (ulong value in this.Value)
{
if (value > uint.MaxValue)
{

Loading…
Cancel
Save