From 232ae735a867f790660e58ef372811ad06d0212c Mon Sep 17 00:00:00 2001 From: ma_nan Date: Mon, 30 Aug 2021 10:41:53 +0800 Subject: [PATCH 1/2] fix codestyle Signed-off-by: ma_nan --- services/diffpatch/bzip2/lz4_adapter.h | 4 ++-- services/script/script_interpreter/script_expression.cpp | 2 +- services/ui/updater_ui.cpp | 9 +++++++-- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/services/diffpatch/bzip2/lz4_adapter.h b/services/diffpatch/bzip2/lz4_adapter.h index 51c1cfac..f6b287b6 100644 --- a/services/diffpatch/bzip2/lz4_adapter.h +++ b/services/diffpatch/bzip2/lz4_adapter.h @@ -44,7 +44,7 @@ protected: int32_t compressionLevel_ { 0 }; int32_t blockIndependence_ { 0 }; int32_t contentChecksumFlag_ { 0 }; - int32_t blockSizeID_ { 0 }; + uint32_t blockSizeID_ { 0 }; int32_t autoFlush_ {1}; }; @@ -85,4 +85,4 @@ private: int32_t CompressData(const BlockBuffer &srcData) override; }; } // namespace updatepatch -#endif // LZ4_ADAPTER_H \ No newline at end of file +#endif // LZ4_ADAPTER_H diff --git a/services/script/script_interpreter/script_expression.cpp b/services/script/script_interpreter/script_expression.cpp index f9d31943..d3f6293b 100644 --- a/services/script/script_interpreter/script_expression.cpp +++ b/services/script/script_interpreter/script_expression.cpp @@ -128,7 +128,7 @@ UScriptValuePtr BinaryExpression::Execute(ScriptInterpreter &inter, UScriptConte left = left_->Execute(inter, local); } - if (action_ == OR_OPERATOR && left->IsTrue()) { + if (action_ == OR_OPERATOR && left_ != nullptr && left->IsTrue()) { INTERPRETER_LOGE(inter, local, "BinaryExpression::Execute left:%s %s", UScriptValue::ScriptToString(left).c_str(), opStr[action_].c_str()); return std::make_shared(1); diff --git a/services/ui/updater_ui.cpp b/services/ui/updater_ui.cpp index 8118029c..a6902937 100644 --- a/services/ui/updater_ui.cpp +++ b/services/ui/updater_ui.cpp @@ -449,7 +449,7 @@ void UpdaterUiInit() HdfInit(); } -void DeleteView() +static void DeleteOtherView() { if (g_updateInfoLabel != nullptr) { delete g_updateInfoLabel; @@ -487,6 +487,11 @@ void DeleteView() delete g_logResultLabel; g_logResultLabel = nullptr; } +} + +void DeleteView() +{ + DeleteOtherView(); if (g_textLabel0 != nullptr) { delete g_textLabel0; g_textLabel0 = nullptr; @@ -516,4 +521,4 @@ void DeleteView() g_sfDev = nullptr; } } -} // namespace updater +} // namespace updater \ No newline at end of file -- Gitee From fd8f6a165c455b4ec70dd4b7c077f4ab6c6c169c Mon Sep 17 00:00:00 2001 From: ma_nan Date: Mon, 30 Aug 2021 17:37:45 +0800 Subject: [PATCH 2/2] fix codestyle Signed-off-by: ma_nan --- services/updater.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/services/updater.cpp b/services/updater.cpp index a1534384..43fb6b6f 100644 --- a/services/updater.cpp +++ b/services/updater.cpp @@ -116,9 +116,9 @@ int UpdatePreProcess(PkgManager::PkgManagerPtr pkgManager, const std::string &pa return ret; } -static UpdaterStatus IsSpaceCapacitySufficient(PkgManager::PkgManagerPtr pkgManager, - const std::string &packagePath) +static UpdaterStatus IsSpaceCapacitySufficient(const std::string &packagePath) { + PkgManager::PkgManagerPtr pkgManager = hpackage::PkgManager::CreatePackageInstance(); UPDATER_ERROR_CHECK(pkgManager != nullptr, "pkgManager is nullptr", return UPDATE_CORRUPT); std::vector fileIds; int ret = pkgManager->LoadPackageWithoutUnPack(packagePath, fileIds); @@ -184,7 +184,7 @@ UpdaterStatus DoInstallUpdaterPackage(PkgManager::PkgManagerPtr pkgManager, cons if (retryCount > 0) { LOG(INFO) << "Retry for " << retryCount << " time(s)"; } else { - UpdaterStatus ret = IsSpaceCapacitySufficient(pkgManager, packagePath); + UpdaterStatus ret = IsSpaceCapacitySufficient(packagePath); // Only handle UPATE_ERROR and UPDATE_SUCCESS here. // If it returns UPDATE_CORRUPT, which means something wrong with package manager. // Let package verify handle this. -- Gitee