Making 7-zip easier to port

  • Hallvard B Furuseth

    I'm wondering how the p7zip folks are working to patch 7-zip.  I've
    seen mention that Igor Pavlov wants to avoid messing with Unix stuff.

    The code looks like it started as quick work throwing in #ifdef
    _WIN32 where convenient - which presumably got results fast but
    gets hard to maintain.  It should be less work in the long run
    to work to rearrange 7-zip code to be easier to port, without
    including #ifdef _WIN32 stuff, and offer the result to Igor.
    Then a second work track which ports the result to become p7zip.

    Simple example: p7zip/CPP/7zip/Archive/7z/7zUpdate.cpp has
    IsExeFile() only for non-Windows, needing two #ifdefs where it
    only needs one.  Killing the #ifdef inside the caller also
    makes it easier to move the rest to an OS-specific file later.
    That is, give 7-zip this function:

      static inline bool IsExeFile(const CUpdateItem &ui)
        int dotPos = ui.Name.ReverseFind(L'.');
        return dotPos >= 0 && IsExeExt(ui.Name.Mid(dotPos + 1));
    then the GetMethodFull() usage reduces to:
      [code]bool filteredGroup = useFilters && IsExeFile(ui);[/code]
    Another: You're removing most #ifdef SUPPORT_DEVICE_FILE stuff.
    That looks made for being thrown out to separate OS-specific
    classes or templates, with empty versions for the #ifndef case.
    After that, pz7ip might not need an extra patch.
    OTOH p7zip has symlinks which need their own patches.  Again,
    they could be thrown out to separate OS-specific classes.
    CInFileStream::Open() calls CInFile::Open() with an extra
    _ignoreSymbolicLink argument - instead the Windows version could
    be a wrapper which ignores that argument.  Instead of passing
    _ignoreSymbolicLink, you can pass something generic like the
    "OS-specific" options or the [i]reason[/i] to ignore symlinks.
    Anyway, enough rambling, since I'm not actually volunteering
    to do any of this myself at the moment:-)
  • Hallvard B Furuseth

    Argh, is it posible to edit posted messages?  Or to preview before posting? That 'codify text' didn't come out quite as intended:(


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks