Conversation
a87e629 to
128f119
Compare
and incremental reads. Instead of attempting to open a file with MachOFile.new and catching a FatBinaryError to attempt FatFile.new, read a few bytes and do some magic/sanity tests. Once sanity is established, instantiate either a MachOFile or a FatFile (or error out with a MagicError). Additionally, stop truncated files (< 4 bytes) ahead of time with a TruncationError.
Ensure that MachO.open raises all expected exceptions.
128f119 to
ee8906c
Compare
|
@UniqMartin Mind doing a quick lookover of this? |
Looks good to me! (And sorry for being slow to respond!) Are you intending to make changes to |
Thank you (and no worries)!
Yeah, this would be ideal. I probably won't get around to it in this PR, but it would ultimately be much nicer to spread these performance improvements around if and when users choose to create I'll merge this tonight! |
Optimization: Replace control-flow-by-exception with magic testing and incremental reads.
Instead of attempting to open a file with
MachOFile.newand catchinga
FatBinaryErrorto attemptFatFile.new, read a few bytes and do somemagic/sanity tests. Once sanity is established, instantiate either a
MachOFileor aFatFile.Tasks:
attr_accessor filenameMachO.openReference: #7