diff options
author | Colomban Wendling <[email protected]> | 2024-01-24 21:19:56 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2024-01-31 23:36:40 +0100 |
commit | ed5d540bf64fafbf9266b28f1156ce3ce2ba3038 (patch) | |
tree | 021b6c2c929683cb077209118360c0c6fed25204 /src/fr-command-ar.c | |
parent | d39e5c2ef97352e4385b9cec69032bfc0124050f (diff) | |
download | engrampa-ed5d540bf64fafbf9266b28f1156ce3ce2ba3038.tar.bz2 engrampa-ed5d540bf64fafbf9266b28f1156ce3ce2ba3038.tar.xz |
rar: Simplify and merge duplicate code
Merge version matching for rar and unrar. This is ever so slightly
slower in theory for unrar 5.x because there's an additional
unnecessary `sscanf()` call, but it's not actually gonna matter, and
saves quite a bit of duplicated logic.
This also makes the matching a bit more safe by verifying `sscanf()`
actually worked, and avoids using a uninitialized `version` value due
to an unexpected input.
Finally, this makes the parsing a bit more strict by requiring a
version number after the `RAR` and `UNRAR` line prefixes -- leading not
to using the uninitialized version variable.
This will be required by the upcoming unrar-free support as it reports
a `RAR archive ...` line that would have matched the `RAR` version
check.
Diffstat (limited to 'src/fr-command-ar.c')
0 files changed, 0 insertions, 0 deletions