diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-06-26 15:17:37 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-06-26 15:24:32 +0200 |
commit | 95eae33ae8db583ebf4ff0cdfc3e3a48915a706b (patch) | |
tree | 016104113f5e0591cc95204c498c7c2ddbbff6d1 /onlineupdate | |
parent | c806dab3c99a730430e02ea0d1ccecdb5d688423 (diff) |
updater: subclasses need to pass the archiveReader parameter to their parents
Change-Id: I1d69d592a05908e4e2a2e832a5b6ef9d13fc2e2c
Diffstat (limited to 'onlineupdate')
-rw-r--r-- | onlineupdate/source/update/updater/updater.cxx | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx index 218595034e55..d407e47b6814 100644 --- a/onlineupdate/source/update/updater/updater.cxx +++ b/onlineupdate/source/update/updater/updater.cxx @@ -1367,9 +1367,6 @@ public: virtual int Execute(); virtual void Finish(int status); -protected: - AddFile() : mAdded(false), mArchiveReader(nullptr) { } - private: std::unique_ptr<NS_tchar> mFile; std::unique_ptr<NS_tchar> mRelPath; @@ -1477,9 +1474,6 @@ public: virtual int Execute(); virtual void Finish(int status); -protected: - PatchFile() : mPatchFile(nullptr), mPatchIndex(-1), buf(nullptr), mArchiveReader(nullptr) {} - private: int LoadSourceFile(FILE* ofile); @@ -1804,6 +1798,8 @@ PatchFile::Finish(int status) class AddIfFile : public AddFile { public: + AddIfFile(ArchiveReader* archiveReader); + virtual int Parse(NS_tchar *line); virtual int Prepare(); virtual int Execute(); @@ -1813,6 +1809,11 @@ protected: std::unique_ptr<NS_tchar> mTestFile; }; +AddIfFile::AddIfFile(ArchiveReader* archiveReader): + AddFile(archiveReader) +{ +} + int AddIfFile::Parse(NS_tchar *line) { @@ -1864,6 +1865,8 @@ AddIfFile::Finish(int status) class AddIfNotFile : public AddFile { public: + AddIfNotFile(ArchiveReader* archiveReader); + virtual int Parse(NS_tchar *line); virtual int Prepare(); virtual int Execute(); @@ -1873,6 +1876,11 @@ protected: std::unique_ptr<NS_tchar> mTestFile; }; +AddIfNotFile::AddIfNotFile(ArchiveReader* archiveReader): + AddFile(archiveReader) +{ +} + int AddIfNotFile::Parse(NS_tchar *line) { @@ -1924,6 +1932,8 @@ AddIfNotFile::Finish(int status) class PatchIfFile : public PatchFile { public: + PatchIfFile(ArchiveReader* archiveReader); + virtual int Parse(NS_tchar *line); virtual int Prepare(); // should check for patch file and for checksum here virtual int Execute(); @@ -1933,6 +1943,11 @@ private: std::unique_ptr<NS_tchar> mTestFile; }; +PatchIfFile::PatchIfFile(ArchiveReader* archiveReader): + PatchFile(archiveReader) +{ +} + int PatchIfFile::Parse(NS_tchar *line) { @@ -4536,23 +4551,23 @@ int DoUpdate(ArchiveReader *archiveReader) } else if (NS_tstrcmp(token, NS_T("add")) == 0) { - action = new AddFile(archiveReader); + action = new AddFile(&archiveReader); } else if (NS_tstrcmp(token, NS_T("patch")) == 0) { - action = new PatchFile(archiveReader); + action = new PatchFile(&archiveReader); } else if (NS_tstrcmp(token, NS_T("add-if")) == 0) // Add if exists { - action = new AddIfFile(); + action = new AddIfFile(&archiveReader); } else if (NS_tstrcmp(token, NS_T("add-if-not")) == 0) // Add if not exists { - action = new AddIfNotFile(); + action = new AddIfNotFile(&archiveReader); } else if (NS_tstrcmp(token, NS_T("patch-if")) == 0) // Patch if exists { - action = new PatchIfFile(); + action = new PatchIfFile(&archiveReader); } else { |