Skip to content

Spanify (3/n)#367

Merged
drewnoakes merged 6 commits intodrewnoakes:masterfrom
iamcarbon:span4
Jan 22, 2024
Merged

Spanify (3/n)#367
drewnoakes merged 6 commits intodrewnoakes:masterfrom
iamcarbon:span4

Conversation

@iamcarbon
Copy link
Collaborator

  • Updates mutable byte[] data in HuffmanTablesDirectory with statistically initialized data
  • Adds and utilizes JpegSegment.Span property to reduce need for AsSpan()
  • Uses static JpegSegmentPreambleBytes in DuckyReader

@iamcarbon
Copy link
Collaborator Author

@drewnoakes Ready for review / feedback. CI is failing due to an ambiguous xunit method call (resolved in #366)

Copy link
Owner

@drewnoakes drewnoakes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other PR has merged so it should be possible to get the checks here to pass now.

Left some comments for potential future work too. We can file issues to track them if we feel they're valid.

internal static ReadOnlySpan<byte> JpegSegmentPreambleBytes => "Ducky"u8;

ICollection<JpegSegmentType> IJpegSegmentMetadataReader.SegmentTypes { get; } = new[] { JpegSegmentType.AppC };
ICollection<JpegSegmentType> IJpegSegmentMetadataReader.SegmentTypes { get; } = [JpegSegmentType.AppC];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should bump these to IReadOnlyCollection. Can be a future PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Annoyingly, HashSet doesn't implement IReadOnlyCollection, which we use in JpegReader.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at usages of the property, they're all enumerations. So IReadOnlyCollection or IEnumerable are both candidates, and JpegReader would be changed to no longer use HashSet<T>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants