Skip unnecessary calculations
Limit dict2 to correct input size
More concise bailout on palmdoc decoding
Fix extended headers

Also, use String#unpack more consistently, and fix another bug caused
by the faulty 'if 0'-is-false assumption.