Experiment with using ITaggedData for AES extra data handling
This is an experiment to use the ITaggedData machinery for handling the AES extra data, too see how it might effect things, and to think if it might be useful for #443 (to have the extra data handling in a central place).
Notes:
-
It changes the TagID property on ITaggedData from
shorttoushortto accomodate the 0x9901 value for the AES extra data. Some of the other apis use int rather than short so that might be more consistent, not sure if other places could be changed to keep it working withshortthough. -
Not sure if using ZipHelperStream to unpack the data instead of reading array values is more extra overhead than would be ideal, though i think the read functions in
ZipExtraDatamight already do more size checks than they really need to, so perhaps it could be tuned in general? -
Similar on the
GetData()side - building the fixed 7 byte array with a temporary stream and 7 calls to write byte is perhaps not the optimal approach there.
I certify that I own, and have sufficient rights to contribute, all source code and related material intended to be compiled or integrated with the source code for the SharpZipLib open source product (the "Contribution"). My Contribution is licensed under the MIT License.
I am currently going through the ExtraFields/ITaggedData for ArchiveDiag and have added some extensions and an Enum with the known IDs. I'm thinking about doing some changes to the API to make it a bit more useful, but that should not affect this too much.
it was initially just to see if it's a reasonable approach to sharing the AES extra data code (rather than just having some other helper functions), rather than a concrete thing, so no problem.
(as far as the shape of the api goes, see my comment about possibly not being terribly efficient, though I don't know what the scope is for changing the interface vs. public API breaks)
Codecov Report
Merging #470 (9bd70bd) into master (b5b1a92) will increase coverage by
0.33%. The diff coverage is94.28%.
@@ Coverage Diff @@
## master #470 +/- ##
==========================================
+ Coverage 73.07% 73.40% +0.33%
==========================================
Files 68 68
Lines 8305 8322 +17
==========================================
+ Hits 6069 6109 +40
+ Misses 2236 2213 -23
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/ICSharpCode.SharpZipLib/Zip/ZipExtraData.cs | 79.23% <92.85%> (+2.90%) |
:arrow_up: |
| src/ICSharpCode.SharpZipLib/Zip/ZipEntry.cs | 91.11% <100.00%> (+0.20%) |
:arrow_up: |
| src/ICSharpCode.SharpZipLib/Zip/ZipOutputStream.cs | 91.94% <100.00%> (-0.10%) |
:arrow_down: |
| ...ode.SharpZipLib/Zip/Compression/DeflaterHuffman.cs | 97.87% <0.00%> (+6.07%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update b5b1a92...9bd70bd. Read the comment docs.
Just trying to remember what state this was left in...
Any thoughts on the type of TagID, given the comments in the op and in #657 ?
I think it should definitely be ushort (or even byte[2], but that's a bit less convenient to use).