+1 for questioning or ignoring commonly accepted assumptions.
Such as that compressed archives are hard if possible at all to repair. Or, say, that the optimal encoding is a very hard problem... something that David Huffman simply didn't know when he came up with his coding algorithm.
Very cool article. If you are going to have a bunch of packed structs, though, it's often easier to wrap all the structs in #pragma pack(0)/pack() rather than putting the attribute on each member. This is an MSism, but it works in gcc.
Thanks a lot for this tip! Saves a lot of writing. I knew there had to be a better way...
Ideally, I guess I wouldn't read directly into a struct, though, and instead use the right functions from endian.h to make the code portable, but ah! such is life when you're scrambling to save a zip and the post-graduation nostalgia is high and the post-coffee-crash caffeination is low.
When I use my hacking skills for something like this, I sometimes fear that I am wasting time and a normal person would have solved this problem faster and easier because he isn't focused on programming all the time.
Nice to see that the fun way is the right way in this case.
I've always found that font to be pretty terrible and makes Latex docs look less professional, but I guess if you are used to it from reading papers, it's the opposite.
Actually, it's just a standard WordPress blog using the Latin Modern Roman typeface, which is based upon Computer Modern, the default in [La]TeX.
(I dig the TeX-lookalike WP theme, but it should really use other @font-face formats for compatibility, e.g., WOFF and EOT; that might make it look better in other browsers.)
I'm surprised that zip -FF wouldn't work. Sounds like it needs your patch, although it looks from the InfoZip source that the fix functionality is spread throughout the zip parsing code rather than isolated into a small routine like this one.
What would be interesting is a utility that could fix archives uploaded via FTP with ASCII mode accidentally turned on. This page claims to have a method: http://bukys.com/services/recovery/examples/
The original author responded to my comment above with the link http://blog.zx2c4.com/605#comment-5889, which is to a comment that claims that PKZIPFIX does the same thing. Unfortunately it's been [dead]ed.
Such as that compressed archives are hard if possible at all to repair. Or, say, that the optimal encoding is a very hard problem... something that David Huffman simply didn't know when he came up with his coding algorithm.