diff options
author | Tianjie Xu <xunchang@google.com> | 2019-06-14 02:24:49 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2019-06-14 02:24:49 +0200 |
commit | 87e22759704b58b41db224696362ebe10e140ea0 (patch) | |
tree | ff928d36e2e09d8ba9adf5af638de01423384c75 /install/package.cpp | |
parent | Merge "Use the new ziparchive Next std::string_view overload." (diff) | |
parent | InstallPackage now takes a package as parameter (diff) | |
download | android_bootable_recovery-87e22759704b58b41db224696362ebe10e140ea0.tar android_bootable_recovery-87e22759704b58b41db224696362ebe10e140ea0.tar.gz android_bootable_recovery-87e22759704b58b41db224696362ebe10e140ea0.tar.bz2 android_bootable_recovery-87e22759704b58b41db224696362ebe10e140ea0.tar.lz android_bootable_recovery-87e22759704b58b41db224696362ebe10e140ea0.tar.xz android_bootable_recovery-87e22759704b58b41db224696362ebe10e140ea0.tar.zst android_bootable_recovery-87e22759704b58b41db224696362ebe10e140ea0.zip |
Diffstat (limited to 'install/package.cpp')
-rw-r--r-- | install/package.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/install/package.cpp b/install/package.cpp index 4402f4855..86fc0647d 100644 --- a/install/package.cpp +++ b/install/package.cpp @@ -40,12 +40,20 @@ class MemoryPackage : public Package { ~MemoryPackage() override; + PackageType GetType() const override { + return PackageType::kMemory; + } + // Memory maps the package file if necessary. Initializes the start address and size of the // package. uint64_t GetPackageSize() const override { return package_size_; } + std::string GetPath() const override { + return path_; + } + bool ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) override; ZipArchiveHandle GetZipArchiveHandle() override; @@ -82,10 +90,18 @@ class FilePackage : public Package { ~FilePackage() override; + PackageType GetType() const override { + return PackageType::kFile; + } + uint64_t GetPackageSize() const override { return package_size_; } + std::string GetPath() const override { + return path_; + } + bool ReadFullyAtOffset(uint8_t* buffer, uint64_t byte_count, uint64_t offset) override; ZipArchiveHandle GetZipArchiveHandle() override; @@ -253,7 +269,7 @@ ZipArchiveHandle FilePackage::GetZipArchiveHandle() { return zip_handle_; } - if (auto err = OpenArchiveFd(fd_.get(), path_.c_str(), &zip_handle_); err != 0) { + if (auto err = OpenArchiveFd(fd_.get(), path_.c_str(), &zip_handle_, false); err != 0) { LOG(ERROR) << "Can't open package" << path_ << " : " << ErrorCodeString(err); return nullptr; } |