Rewrite unrar parsing code

Review Request #124503 - Created July 28, 2015 and submitted

Information
Ragnar Thomsen
ark
master
331065
Reviewers
kdeutils
elvisangelaccio, rkcosta

The parsing code of unrar was rewritten to hopefully improve readability. The output from unrar3 and 4 is identical and these will be referred to as unrar4. Unfortunately, it was not possible to reduce the length of the code. This is due to the output of unrar not being very parser-friendly and we want to support both unrar4 and 5, which have very different output. However, the new code should be easier to follow and hopefully more robust. Also, alot of comments have been inserted to ease maintenance of the code.

Specific changes:

  • readListLine() is now very short. It simply checks the version of unrar and calls unrar4 or 5 specific line-handling functions termed handleUnrar4Line() and handleUnrar5Line().
  • When the line-handling functions have completed parsing all the details of an archive entry, they call an entry-handling function, either handleUnrar4Entry() or handleUnrar5Entry().
  • The groundwork for handling comments in rar archives has also been laid, for now the comment is stored in a member QString variable (m_comment). The UI work for showing comments in archives is being done in RR124468).

In the process, two bugs were identified and fixed:

  1. The parsing of modification time for entries in unrar5 was broken.
  2. The target of symlinks was not being parsed in both unrar4 and 5, and hence not presented in Ark.

Tested different types of rar archives using both unrar 4 and 5:

  • With encryption (both header/files and only files).
  • With comment.
  • With recovery record.
  • With NTFS file streams stored (winrar feature).
  • Multi-volume archives.
  • Archive created using WinRAR on Windows 7.

Issues

  • 0
  • 2
  • 0
  • 2
Description From Last Updated
Ragnar Thomsen
Ragnar Thomsen
Ragnar Thomsen
Ragnar Thomsen
Elvis Angelaccio
Ragnar Thomsen
Elvis Angelaccio
Ragnar Thomsen
Review request changed

Status: Closed (submitted)

Change Summary:

Submitted with commit b738a0041a44ad9c36644aa903c6621ac9e265e9 by Ragnar Thomsen to branch master.
Loading...