diff --git a/interfaces/ets/ani/resourceManager/src/resourceManager.cpp b/interfaces/ets/ani/resourceManager/src/resourceManager.cpp index 84ff37e6075f23570a8f921c9c2745703a5350d2..4b3eaeb3cc4f8821c3a37604534c16055411380f 100644 --- a/interfaces/ets/ani/resourceManager/src/resourceManager.cpp +++ b/interfaces/ets/ani/resourceManager/src/resourceManager.cpp @@ -1416,12 +1416,12 @@ static ani_object CreateConfig(ani_env* env, std::unique_ptr &cfg) SetEnumMember(env, obj, "colorMode", "@ohos.resourceManager.resourceManager.ColorMode", static_cast(cfg->GetColorMode())); - if (ANI_OK != env->Object_SetPropertyByName_Double(obj, "mcc", static_cast(cfg->GetMcc()))) { + if (ANI_OK != env->Object_SetPropertyByName_Int(obj, "mcc", static_cast(cfg->GetMcc()))) { RESMGR_HILOGE(RESMGR_ANI_TAG, "Set property 'mcc' failed"); return obj; } - if (ANI_OK != env->Object_SetPropertyByName_Double(obj, "mnc", static_cast(cfg->GetMnc()))) { + if (ANI_OK != env->Object_SetPropertyByName_Int(obj, "mnc", static_cast(cfg->GetMnc()))) { RESMGR_HILOGE(RESMGR_ANI_TAG, "Set property 'mnc' failed"); return obj; } @@ -1609,9 +1609,9 @@ static bool GetEnumMember(ani_env *env, ani_object options, const std::string na return true; } -static bool GetNumberMember(ani_env *env, ani_object options, const std::string name, double& value) +static bool GetNumberMember(ani_env *env, ani_object options, const std::string name, int& value) { - if (ANI_OK != env->Object_GetPropertyByName_Double(options, name.c_str(), &value)) { + if (ANI_OK != env->Object_GetPropertyByName_Int(options, name.c_str(), &value)) { RESMGR_HILOGE(RESMGR_ANI_TAG, "Get property '%{public}s' failed", name.c_str()); return false; } @@ -1634,7 +1634,7 @@ static bool GetEnumParamOfConfig(ani_env* env, std::shared_ptr config configPtr->SetColorMode(static_cast(intEnum)); } - double value; + int value; if (GetNumberMember(env, configuration, "mcc", value)) { configPtr->SetMcc(value); }