diff --git a/frameworks/native/power_mgr_client.cpp b/frameworks/native/power_mgr_client.cpp index 43a5e65e0bd985844f834584443f2686ce553f11..4538fb40f49f74860a201056e2ef5c80082d1a95 100644 --- a/frameworks/native/power_mgr_client.cpp +++ b/frameworks/native/power_mgr_client.cpp @@ -46,7 +46,7 @@ std::vector> PowerMgrClient::runningLocks_; std::mutex PowerMgrClient::runningLocksMutex_; std::mutex g_instanceMutex; constexpr int32_t MAX_VERSION_STRING_SIZE = 4; -constexpr int32_t PARAM_MAX_NUM = 10; +constexpr uint32_t PARAM_MAX_NUM = 10; PowerMgrClient::PowerMgrClient() { @@ -573,9 +573,9 @@ std::string PowerMgrClient::Dump(const std::vector& args) sptr proxy = GetPowerMgrProxy(); RETURN_IF_WITH_RET(proxy == nullptr, error); std::string returnDump = "remote error"; - int32_t argc = args.size(); + uint32_t argc = args.size(); if (argc >= PARAM_MAX_NUM) { - POWER_HILOGW(COMP_FWK, "params exceed limit, argc=%{public}d", argc); + POWER_HILOGW(COMP_FWK, "params exceed limit, argc=%{public}u", argc); return returnDump; } proxy->ShellDumpIpc(args, argc, returnDump); diff --git a/frameworks/native/running_lock_info.cpp b/frameworks/native/running_lock_info.cpp index 38f62c0b1dca0a84421c7cd9b261d46a2d2c4050..b55dbd04b582089485b3466aa4a53ea7289cdf2d 100644 --- a/frameworks/native/running_lock_info.cpp +++ b/frameworks/native/running_lock_info.cpp @@ -22,7 +22,6 @@ namespace OHOS { namespace PowerMgr { -constexpr uint32_t MAX_PROXY_RUNNINGLOCK_NUM = 2000; bool RunningLockInfo::ReadFromParcel(Parcel& parcel) { uint32_t readType; @@ -68,6 +67,7 @@ bool RunningLockInfo::Marshalling(Parcel& parcel) const bool VectorPair::Marshalling(Parcel& parcel) const { + constexpr uint32_t MAX_PROXY_RUNNINGLOCK_NUM = 2000; size_t size = processInfos_.size(); RETURN_IF_WRITE_PARCEL_FAILED_WITH_RET(parcel, Int32, size, false); if (size > MAX_PROXY_RUNNINGLOCK_NUM) { @@ -83,6 +83,7 @@ bool VectorPair::Marshalling(Parcel& parcel) const VectorPair* VectorPair::Unmarshalling(Parcel& parcel) { + constexpr int32_t MAX_PROXY_RUNNINGLOCK_NUM = 2000; auto vectorPairPtr = std::make_unique(); int32_t size {0}; diff --git a/services/native/src/power_mgr_service_ipc_adapter.cpp b/services/native/src/power_mgr_service_ipc_adapter.cpp index 530154c1db2502f8b3ab1e606123036c3c6f7c06..6e18c17db4ab6e4f3c12738407cd93e1b7804c9b 100644 --- a/services/native/src/power_mgr_service_ipc_adapter.cpp +++ b/services/native/src/power_mgr_service_ipc_adapter.cpp @@ -199,7 +199,7 @@ int32_t PowerMgrServiceAdapter::QueryRunningLockListsIpc(std::map(runningLockLists.size()); RETURN_IF_WITH_RET(num > MAX_PARAM_NUM, INIT_VALUE); return ERR_OK; }