Open gwittel opened 6 years ago
Thanks for opening the issue and sorry not to reply you for long time. If you have will yet, could you make a pull request?
Could you validate file headers? That's because original implementation does. (here) Could you fix indentation width also? This file uses two spaces for indentation.
When dealing with some legacy format files, I noticed that snzip will fail to read snappy-in-java format files that are concatenated together. The issue is when it encounters the 2nd file, it reads the 's' (
0x73
) from the header and aborts since its not a recognized id.The simple workaround is to skip the next 6 bytes (
nappy\0
) similar to how the framing2 format implicitly skips the header (this is due to it reading0xff 0x06 0x00 0x00
as 6, then skipping those 6 bytes (sNaPpY
) with the fseek.Before I sent a real PR I wanted to get some feedback. My quick and dirty workaround does not validate the 2nd header is actually a valid snappy header. However, framing2 doesn't do this either (it relies on the implicit skipping defined by the header format itself).
Creating test file:
Original version:
Patched:
Thoughts/preferences on patch approach?
Hacky version diff: