Skip to content

Commit 20ba517

Browse files
authored
Merge pull request #370 from drewnoakes/iptc-fixes
IPTC fixes
2 parents cef2278 + cda6229 commit 20ba517

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

MetadataExtractor/Formats/Iptc/IptcDirectory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public sealed class IptcDirectory : Directory
8989

9090
private static readonly Dictionary<int, string> _tagNameMap = new()
9191
{
92-
{ TagEnvelopeRecordVersion, "Enveloped Record Version" },
92+
{ TagEnvelopeRecordVersion, "Envelope Record Version" },
9393
{ TagDestination, "Destination" },
9494
{ TagFileFormat, "File Format" },
9595
{ TagFileVersion, "File Version" },

MetadataExtractor/Formats/Iptc/IptcReader.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ public sealed class IptcReader : IJpegSegmentMetadataReader
3131

3232
internal const byte IptcMarkerByte = 0x1c;
3333

34-
ICollection<JpegSegmentType> IJpegSegmentMetadataReader.SegmentTypes { get; } = new[] { JpegSegmentType.AppD };
34+
ICollection<JpegSegmentType> IJpegSegmentMetadataReader.SegmentTypes { get; } = [JpegSegmentType.AppD];
3535

3636
public IEnumerable<Directory> ReadJpegSegments(IEnumerable<JpegSegment> segments)
3737
{
3838
// Ensure data starts with the IPTC marker byte
3939
return segments
4040
.Where(segment => segment.Bytes.Length != 0 && segment.Bytes[0] == IptcMarkerByte)
41-
.Select(segment => (Directory)Extract(new SequentialByteArrayReader(segment.Bytes), segment.Bytes.Length));
41+
.Select(segment => Extract(new SequentialByteArrayReader(segment.Bytes), segment.Bytes.Length));
4242
}
4343

4444
/// <summary>Reads IPTC values and returns them in an <see cref="IptcDirectory"/>.</summary>
@@ -166,7 +166,6 @@ private static void ProcessTag(SequentialReader reader, Directory directory, int
166166
if (tagByteCount == 2)
167167
{
168168
var shortValue = reader.GetUInt16();
169-
reader.Skip(tagByteCount - 2);
170169
directory.Set(tagIdentifier, shortValue);
171170
return;
172171
}
@@ -208,7 +207,7 @@ private static void ProcessTag(SequentialReader reader, Directory directory, int
208207

209208
if (directory.ContainsTag(tagIdentifier))
210209
{
211-
// this fancy string[] business avoids using an ArrayList for performance reasons
210+
// We already have a value for this tag. Append this value to any prior value(s).
212211
var oldStrings = directory.GetStringValueArray(tagIdentifier);
213212

214213
StringValue[] newStrings;

0 commit comments

Comments
 (0)