diff --git a/frameworks/native/qos_ndk.cpp b/frameworks/native/qos_ndk.cpp index 46b0abc40fafee0a57c5e611e82c402744b6cd96..cb04b2fcaacc609cf1f87c44d2430604a7bd6a6d 100644 --- a/frameworks/native/qos_ndk.cpp +++ b/frameworks/native/qos_ndk.cpp @@ -23,6 +23,7 @@ static constexpr int ERROR_NUM = -1; using namespace OHOS::QOS; using namespace std; +namespace { const unordered_map qos_map = { {QoS_Level::QOS_BACKGROUND, QosLevel::QOS_BACKGROUND}, {QoS_Level::QOS_UTILITY, QosLevel::QOS_UTILITY}, @@ -42,7 +43,7 @@ const unordered_map qos_reverse_map = { }; -int OH_QoS_SetThreadQoS(QoS_Level level) +[[maybe_unused]] int OH_QoS_SetThreadQoS(QoS_Level level) { auto iter = qos_map.find(level); if (iter == qos_map.end()) { @@ -51,12 +52,12 @@ int OH_QoS_SetThreadQoS(QoS_Level level) return QosController::GetInstance().SetThreadQosForOtherThread(iter->second, gettid()); } -int OH_QoS_ResetThreadQoS(void) +[[maybe_unused]] int OH_QoS_ResetThreadQoS(void) { return QosController::GetInstance().ResetThreadQosForOtherThread(gettid()); } -int OH_QoS_GetThreadQoS(QoS_Level *level) +[[maybe_unused]] int OH_QoS_GetThreadQoS(QoS_Level *level) { if (level == nullptr) { return ERROR_NUM; @@ -72,4 +73,5 @@ int OH_QoS_GetThreadQoS(QoS_Level *level) } *level = iter->second; return 0; -} \ No newline at end of file +} +} // namespace \ No newline at end of file diff --git a/interfaces/kits/c/qos.h b/interfaces/kits/c/qos.h index c92ab5b8622578b0b086fb042b15bda961c48c97..61887dd59bcd6ef9e0ecf33f4728df6927c10411 100644 --- a/interfaces/kits/c/qos.h +++ b/interfaces/kits/c/qos.h @@ -96,7 +96,7 @@ int OH_QoS_SetThreadQoS(QoS_Level level); * @see QoS_Level * @since 12 */ -int OH_QoS_ResetThreadQoS(); +int OH_QoS_ResetThreadQoS(void); /** * @brief Obtains the QoS level of the current thread.