Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
295613c
Add tests that verify we handle unseekable streams correctly.
carlossanlop Apr 3, 2023
d627497
Add expected data field locations for all supported formats.
carlossanlop Apr 3, 2023
018f709
Add exception message for when attempting to write an unseekable data…
carlossanlop Apr 3, 2023
9092cb4
Add seekability validation in public TarWriter entry writing methods.
carlossanlop Apr 3, 2023
6c460eb
Add TarFile stream roundtrip tests for unseekable streams.
carlossanlop Apr 4, 2023
6ea8e0f
Add missing async TarFile roundtrip tests.
carlossanlop Apr 4, 2023
f87b9e9
Support unseekable streams in TarHeader.Write.
carlossanlop Apr 4, 2023
e94fefb
Reuse and simplify the code.
carlossanlop Apr 4, 2023
15523ac
More reuse, remove unused and not needed.
carlossanlop Apr 4, 2023
5979be9
Remove TarFile.CreateFromDirectoryAsync.File.Roundtrip.cs. Submit it …
carlossanlop Apr 4, 2023
b702a44
Remove unnecessary resx comments.
carlossanlop May 23, 2023
625a619
Dedicated method for writing fields to buffer depending on the format.
carlossanlop May 23, 2023
4f702c4
Specify `Data` in name of method that expects unseekable data stream.…
carlossanlop May 23, 2023
0054f99
Delete unnecessary method.
carlossanlop May 23, 2023
2fc23de
Rename WritePadding to WriteEmptyPadding
carlossanlop May 23, 2023
d81b5a8
Rename test variables
carlossanlop May 24, 2023
796d542
Merge identical test arrays into one
carlossanlop May 24, 2023
94157b0
Invert if else to be more clear about conditions
carlossanlop May 24, 2023
1557885
remove size assign comment
carlossanlop May 24, 2023
943988b
Remove redundant debug assert
carlossanlop May 24, 2023
abff5c0
Async padding byte array creation simplification
carlossanlop May 24, 2023
66dc094
Apply suggestions from code review
adamsitnik May 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Specify Data in name of method that expects unseekable data stream.…
… Add extra debug asserts.
  • Loading branch information
carlossanlop committed May 23, 2023
commit 4f702c4625f2eaae16f38956f563d3be2879eaa1
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ internal void WriteAs(TarEntryFormat format, Stream archiveStream, Span<byte> bu
}
else // seekable archive stream, unseekable data stream
{
WriteWithUnseekableStreamAs(format, archiveStream, buffer);
WriteWithUnseekableDataStreamAs(format, archiveStream, buffer);
}
}

Expand All @@ -69,11 +69,12 @@ internal async Task WriteAsAsync(TarEntryFormat format, Stream archiveStream, Me
}
}

private void WriteWithUnseekableStreamAs(TarEntryFormat format, Stream archiveStream, Span<byte> buffer)
private void WriteWithUnseekableDataStreamAs(TarEntryFormat format, Stream archiveStream, Span<byte> buffer)
{
// When the data stream is unseekable, the order in which we write the entry data changes
Debug.Assert(archiveStream.CanSeek);
Debug.Assert(_dataStream != null);
Debug.Assert(!_dataStream.CanSeek);

// Store the start of the current entry's header, it'll be used later
long headerStartPosition = archiveStream.Position;
Expand Down Expand Up @@ -119,6 +120,7 @@ private async Task WriteWithUnseekableDataStreamAsAsync(TarEntryFormat format, S
// When the data stream is unseekable, the order in which we write the entry data changes
Debug.Assert(archiveStream.CanSeek);
Debug.Assert(_dataStream != null);
Debug.Assert(!_dataStream.CanSeek);

// Store the start of the current entry's header, it'll be used later
long headerStartPosition = archiveStream.Position;
Expand Down