diff --git a/frameworks/native/backup_ext/include/untar_file.h b/frameworks/native/backup_ext/include/untar_file.h index 6bd0e42006717bd896f0450265fb3e8858ad3754..c2a28dc2dd4a54de78eec17fd2b6d641a52d4245 100644 --- a/frameworks/native/backup_ext/include/untar_file.h +++ b/frameworks/native/backup_ext/include/untar_file.h @@ -34,7 +34,7 @@ public: static UntarFile &GetInstance(); int UnPacket(const std::string &tarFile, const std::string &rootPath); int IncrementalUnPacket(const std::string &tarFile, const std::string &rootPath, - const std::map &includes); + const std::unordered_map &includes); private: UntarFile() = default; @@ -147,7 +147,7 @@ private: off_t tarFileBlockCnt_ {0}; off_t pos_ {0}; size_t readCnt_ {0}; - std::map includes_; + std::unordered_map includes_; }; } // namespace OHOS::FileManagement::Backup diff --git a/frameworks/native/backup_ext/src/ext_extension.cpp b/frameworks/native/backup_ext/src/ext_extension.cpp index 3c29b896c9a5f298507e2d50b945c9e4b865dbec..bf1da14544d012288f400a57f8629e7f8b4c2b66 100644 --- a/frameworks/native/backup_ext/src/ext_extension.cpp +++ b/frameworks/native/backup_ext/src/ext_extension.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -543,7 +544,7 @@ int BackupExtExtension::DoRestore(const string &fileName) return ERR_OK; } -static map GetTarIncludes(const string &tarName) +static unordered_map GetTarIncludes(const string &tarName) { // 获取简报文件内容 string reportName = GetReportFileName(tarName); @@ -1145,9 +1146,9 @@ using CompareFilesResult = tuple, static CompareFilesResult CompareFiles(const UniqueFd &cloudFd, const UniqueFd &storageFd) { BReportEntity cloudRp(UniqueFd(cloudFd.Get())); - map cloudFiles = cloudRp.GetReportInfos(); + unordered_map cloudFiles = cloudRp.GetReportInfos(); BReportEntity storageRp(UniqueFd(storageFd.Get())); - map storageFiles = storageRp.GetReportInfos(); + unordered_map storageFiles = storageRp.GetReportInfos(); map allFiles; map smallFiles; map bigFiles; diff --git a/frameworks/native/backup_ext/src/tar_file.cpp b/frameworks/native/backup_ext/src/tar_file.cpp index 2b4b0bce39a54a6b6a340c3522c891d74fb0b275..3a7d9969e70cf65a41e2fc6d15d4d92e04702c28 100644 --- a/frameworks/native/backup_ext/src/tar_file.cpp +++ b/frameworks/native/backup_ext/src/tar_file.cpp @@ -114,6 +114,8 @@ bool TarFile::TraversalFile(string &filePath) } if (currentTarFileSize_ >= DEFAULT_SLICE_SIZE) { + HILOGI("Current tar file size is over %{public}d, start to slice", + static_cast(DEFAULT_SLICE_SIZE / MB_TO_BYTE)); fileCount_ = 0; FillSplitTailBlocks(); CreateSplitTarFile(); @@ -307,7 +309,7 @@ bool TarFile::FillSplitTailBlocks() if (currentTarFile_ == nullptr) { throw BError(BError::Codes::EXT_BACKUP_PACKET_ERROR, "FillSplitTailBlocks currentTarFile_ is null"); } - + // write tar file tail const int END_BLOCK_SIZE = 1024; vector buff {}; diff --git a/frameworks/native/backup_ext/src/untar_file.cpp b/frameworks/native/backup_ext/src/untar_file.cpp index ebff9a54170ee355b36097dd3855ad4ff969afcb..1beb90bb958df278fbf825a1df9603081a114602 100644 --- a/frameworks/native/backup_ext/src/untar_file.cpp +++ b/frameworks/native/backup_ext/src/untar_file.cpp @@ -95,7 +95,7 @@ int UntarFile::UnPacket(const string &tarFile, const string &rootPath) } int UntarFile::IncrementalUnPacket(const string &tarFile, const string &rootPath, - const map &includes) + const unordered_map &includes) { includes_ = includes; tarFilePtr_ = fopen(tarFile.c_str(), "rb"); diff --git a/utils/include/b_json/b_report_entity.h b/utils/include/b_json/b_report_entity.h index 9bdc59df9901c8d7db5824da7faf07151a229f6c..38dd8e477eb48e78a62392a9dcfe439d6cc13ecf 100644 --- a/utils/include/b_json/b_report_entity.h +++ b/utils/include/b_json/b_report_entity.h @@ -41,7 +41,7 @@ public: * * @return std::map */ - std::map GetReportInfos(); + std::unordered_map GetReportInfos(); public: /** diff --git a/utils/src/b_json/b_report_entity.cpp b/utils/src/b_json/b_report_entity.cpp index 816441b6eb5ecd13e7b1462be58127f382a401d8..90420ba6f9a089c0bf315df7ded9aa7fd4b15f0c 100644 --- a/utils/src/b_json/b_report_entity.cpp +++ b/utils/src/b_json/b_report_entity.cpp @@ -137,9 +137,9 @@ static void DealLine(unordered_map &keys, } } -map BReportEntity::GetReportInfos() +unordered_map BReportEntity::GetReportInfos() { - map infos {}; + unordered_map infos {}; char buffer[HASH_BUFFER_SIZE]; ssize_t bytesRead;