diff --git a/frameworks/ets/ani/src/sts_action_button.cpp b/frameworks/ets/ani/src/sts_action_button.cpp index 7ea002ad5d1c9a28ca5fe919730458735dc91725..24012799e73951205976680916c185ec0a5d9376 100644 --- a/frameworks/ets/ani/src/sts_action_button.cpp +++ b/frameworks/ets/ani/src/sts_action_button.cpp @@ -233,20 +233,20 @@ ani_status GetNotificationActionButtonArray(ani_env *env, ani_object param, ani_ref arrayObj = nullptr; ani_boolean isUndefined = true; ani_status status; - ani_double length; + ani_int length; StsActionButton actionButton; if ((status = GetPropertyRef(env, param, name, isUndefined, arrayObj)) != ANI_OK || isUndefined == ANI_TRUE) { ANS_LOGE("GetActionButtonArray: GetPropertyRef name = %{public}s, status = %{public}d", name, status); return ANI_INVALID_ARGS; } - if (ANI_OK!= (status = GetPropertyDouble(env, static_cast(arrayObj), "length", isUndefined, length))) { + if (ANI_OK!= (status = GetPropertyInt(env, static_cast(arrayObj), "length", isUndefined, length))) { ANS_LOGE("GetActionButtonArray: GetPropertyDouble name = %{public}s, status = %{public}d", name, status); return status; } - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref buttonRef; if (ANI_OK != (status = env->Object_CallMethodByName_Ref(static_cast(arrayObj), - "$_get", "i:C{std.core.Object}", &buttonRef, (ani_int)i))) { + "$_get", "i:C{std.core.Object}", &buttonRef, i))) { ANS_LOGE("GetActionButtonArray: get ref failed, status = %{public}d, index = %{public}d", status, i); return status; } diff --git a/frameworks/ets/ani/src/sts_bundle_option.cpp b/frameworks/ets/ani/src/sts_bundle_option.cpp index 35a45a92be740a9576932319dd57a5c3bd7c48f7..8bf27fe098660439684a445c65d07f158fecf6d4 100644 --- a/frameworks/ets/ani/src/sts_bundle_option.cpp +++ b/frameworks/ets/ani/src/sts_bundle_option.cpp @@ -85,14 +85,14 @@ bool UnwrapArrayBundleOption(ani_env *env, return false; } ani_status status; - ani_double length; - status = env->Object_GetPropertyByName_Double(static_cast(arrayObj), "length", &length); + ani_int length; + status = env->Object_GetPropertyByName_Int(static_cast(arrayObj), "length", &length); if (status != ANI_OK) { ANS_LOGE("UnwrapArrayBundleOption: get length failed, status = %{public}d", status); return false; } Notification::NotificationBundleOption option; - for (int32_t i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref optionRef; status = env->Object_CallMethodByName_Ref(static_cast(arrayObj), "$_get", "i:C{std.core.Object}", &optionRef, i); diff --git a/frameworks/ets/ani/src/sts_common.cpp b/frameworks/ets/ani/src/sts_common.cpp index 23c0d06dcbf8d95015dc79b0b31d218fceea48ee..0da585c0ea038176f8f7cde989374380e307ef26 100644 --- a/frameworks/ets/ani/src/sts_common.cpp +++ b/frameworks/ets/ani/src/sts_common.cpp @@ -84,16 +84,16 @@ bool GetStringArrayByAniObj(ani_env *env, const ani_object ani_obj, std::vector< ANS_LOGE("GetStringArrayByAniObj fail, has nullptr"); return false; } - ani_double length; - ani_status status = env->Object_GetPropertyByName_Double(ani_obj, "length", &length); + ani_int length; + ani_status status = env->Object_GetPropertyByName_Int(ani_obj, "length", &length); if (status != ANI_OK) { ANS_LOGE("Object_GetPropertyByName_Double faild. status %{public}d", status); return false; } - for (int i = 0; i < int(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref stringEntryRef; status = env->Object_CallMethodByName_Ref(ani_obj, - "$_get", "i:C{std.core.Object}", &stringEntryRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", &stringEntryRef, i); if (status != ANI_OK) { ANS_LOGE("status : %{public}d", status); return false; @@ -295,21 +295,21 @@ ani_status GetPropertyStringArray(ani_env *env, ani_object param, const char *na ANS_LOGD("GetPropertyStringArray: %{public}s", name); ani_ref arrayObj = nullptr; ani_status status; - ani_double length; + ani_int length; if ((status = GetPropertyRef(env, param, name, isUndefined, arrayObj)) != ANI_OK || isUndefined == ANI_TRUE) { ANS_LOGE("GetPropertyRef fail, status = %{public}d, isUndefind = %{public}d", status, isUndefined); return ANI_INVALID_ARGS; } - status = env->Object_GetPropertyByName_Double(static_cast(arrayObj), "length", &length); + status = env->Object_GetPropertyByName_Int(static_cast(arrayObj), "length", &length); if (status != ANI_OK) { ANS_LOGE("status : %{public}d", status); return status; } std::string str = ""; - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref stringEntryRef; status = env->Object_CallMethodByName_Ref(static_cast(arrayObj), - "$_get", "i:C{std.core.Object}", &stringEntryRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", &stringEntryRef, i); if (status != ANI_OK) { ANS_LOGE("status : %{public}d, index: %{public}d", status, i); return status; @@ -331,21 +331,21 @@ ani_status GetPropertyNumberArray(ani_env *env, ani_object param, const char *na ANS_LOGD("GetPropertyNumberArray enter"); ani_ref arrayObj = nullptr; ani_status status; - ani_double length; + ani_int length; if ((status = GetPropertyRef(env, param, name, isUndefined, arrayObj)) != ANI_OK || isUndefined == ANI_TRUE) { return ANI_INVALID_ARGS; } - status = env->Object_GetPropertyByName_Double(static_cast(arrayObj), "length", &length); + status = env->Object_GetPropertyByName_Int(static_cast(arrayObj), "length", &length); if (status != ANI_OK) { ANS_LOGI("status : %{public}d", status); return status; } - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref numEntryRef; status = env->Object_CallMethodByName_Ref(static_cast(arrayObj), - "$_get", "i:C{std.core.Object}", &numEntryRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", &numEntryRef, i); if (status != ANI_OK) { ANS_LOGI("status : %{public}d, index: %{public}d", status, i); return status; @@ -369,21 +369,21 @@ ani_status GetPropertyLongArray(ani_env *env, ani_object param, const char *name ANS_LOGD("GetPropertyLongArray enter"); ani_ref arrayObj = nullptr; ani_status status; - ani_double length; + ani_int length; if ((status = GetPropertyRef(env, param, name, isUndefined, arrayObj)) != ANI_OK || isUndefined == ANI_TRUE) { return ANI_INVALID_ARGS; } - status = env->Object_GetPropertyByName_Double(static_cast(arrayObj), "length", &length); + status = env->Object_GetPropertyByName_Int(static_cast(arrayObj), "length", &length); if (status != ANI_OK) { ANS_LOGI("status : %{public}d", status); return status; } - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref numEntryRef; status = env->Object_CallMethodByName_Ref(static_cast(arrayObj), - "$_get", "i:C{std.core.Object}", &numEntryRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", &numEntryRef, i); if (status != ANI_OK) { ANS_LOGI("status : %{public}d, index: %{public}d", status, i); return status; diff --git a/frameworks/ets/ani/src/sts_convert_other.cpp b/frameworks/ets/ani/src/sts_convert_other.cpp index e82916c4e81d32f728654e851a8b63d91ae60906..4d537c83a46d032658263be65e3a02b76bd3d85a 100644 --- a/frameworks/ets/ani/src/sts_convert_other.cpp +++ b/frameworks/ets/ani/src/sts_convert_other.cpp @@ -118,17 +118,17 @@ ani_status GetPixelMapArrayByRef(ani_env *env, ani_ref param, std::vectorObject_GetPropertyByName_Double(static_cast(param), "length", &length); + ani_int length; + status = env->Object_GetPropertyByName_Int(static_cast(param), "length", &length); if (status != ANI_OK) { ANS_LOGE("GetPixelMapArrayByRef: status : %{public}d", status); return status; } - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref pixelMapRef; status = env->Object_CallMethodByName_Ref(static_cast(param), - "$_get", "i:C{std.core.Object}", &pixelMapRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", &pixelMapRef, i); if (status != ANI_OK) { ANS_LOGE("GetPixelMapArrayByRef:status : %{public}d, index: %{public}d", status, i); pixelMaps.clear(); @@ -180,20 +180,20 @@ ani_status GetResourceArray(ani_env *env, ani_ref arrayObj = nullptr; ani_boolean isUndefined = true; ani_status status; - ani_double length; + ani_int length; if ((status = GetPropertyRef(env, param, name, isUndefined, arrayObj)) != ANI_OK || isUndefined == ANI_TRUE) { ANS_LOGE("GetResourceArray failed, status : %{public}d", status); return ANI_INVALID_ARGS; } - status = env->Object_GetPropertyByName_Double(static_cast(arrayObj), "length", &length); + status = env->Object_GetPropertyByName_Int(static_cast(arrayObj), "length", &length); if (status != ANI_OK) { ANS_LOGE("GetResourceArray : status : %{public}d", status); return status; } - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref iconRef; status = env->Object_CallMethodByName_Ref(static_cast(arrayObj), - "$_get", "i:C{std.core.Object}", &iconRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", &iconRef, i); if (status != ANI_OK) { res.clear(); ANS_LOGE("GetResourceArray: status = %{public}d, index = %{public}d", status, i); @@ -211,7 +211,7 @@ ani_status GetResourceArray(ani_env *env, return status; } -ani_status GetKeyString(ani_env *env, ani_object obj, int index, ani_string &str) +ani_status GetKeyString(ani_env *env, ani_object obj, int32_t index, ani_string &str) { ANS_LOGD("GetKeyString call"); if (env == nullptr || obj == nullptr) { @@ -221,7 +221,7 @@ ani_status GetKeyString(ani_env *env, ani_object obj, int index, ani_string &str ani_status status = ANI_ERROR; ani_ref stringEntryRef; status = env->Object_CallMethodByName_Ref(obj, - "$_get", "i:C{std.core.Object}", &stringEntryRef, (ani_int)index); + "$_get", "i:C{std.core.Object}", &stringEntryRef, index); if (status != ANI_OK) { ANS_LOGE("status : %{public}d, index: %{public}d", status, index); return status; @@ -277,15 +277,15 @@ ani_status GetPixelMapByRef( return ANI_ERROR; } ani_status status = ANI_ERROR; - ani_double length; + ani_int length; if (ANI_OK != - (status = env->Object_GetPropertyByName_Double(static_cast(keysStrArrayRef), "length", &length))) { + (status = env->Object_GetPropertyByName_Int(static_cast(keysStrArrayRef), "length", &length))) { ANS_LOGE("GetPixelMapByRef : Object_GetPropertyByName_Double status = %{public}d", status); return status; } ani_string strAni = {}; std::vector keys = {}; - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { if ((status = GetKeyString(env, static_cast(keysStrArrayRef), i, strAni)) != ANI_OK) { ANS_LOGE("GetPixelMapByRef : GetKeyString status = %{public}d", status); keys.clear(); diff --git a/frameworks/ets/ani/src/sts_disturb_mode.cpp b/frameworks/ets/ani/src/sts_disturb_mode.cpp index f57445ea2761a5e73868058510dc9fc94a19874a..0f836672daf2de808c0ca760e540f67092fbbffc 100644 --- a/frameworks/ets/ani/src/sts_disturb_mode.cpp +++ b/frameworks/ets/ani/src/sts_disturb_mode.cpp @@ -64,16 +64,16 @@ bool UnwrapArrayDoNotDisturbProfile(ani_env *env, ani_object arrayObj, return false; } ani_status status; - ani_double length; - status = env->Object_GetPropertyByName_Double(arrayObj, "length", &length); + ani_int length; + status = env->Object_GetPropertyByName_Int(arrayObj, "length", &length); if (status != ANI_OK) { ANS_LOGD("UnwrapArrayDoNotDisturbProfile: status = %{public}d", status); return false; } - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref optionRef; status = env->Object_CallMethodByName_Ref(arrayObj, "$_get", - "i:C{std.core.Object}", &optionRef, (ani_int)i); + "i:C{std.core.Object}", &optionRef, i); if (status != ANI_OK) { ANS_LOGE("UnwrapArrayDoNotDisturbProfile: status : %{public}d, index: %{public}d", status, i); return false; diff --git a/frameworks/ets/ani/src/sts_notification_content.cpp b/frameworks/ets/ani/src/sts_notification_content.cpp index 1edd1f1a1d0f7cf82f26e69c1061740a60b17c01..fa6ffffbef349ffd77f060a983d8f82e9ba27c71 100644 --- a/frameworks/ets/ani/src/sts_notification_content.cpp +++ b/frameworks/ets/ani/src/sts_notification_content.cpp @@ -320,20 +320,20 @@ ani_status GetIconButtonArray(ani_env *env, ani_ref arrayObj = nullptr; ani_boolean isUndefined = true; ani_status status = ANI_ERROR; - ani_double length; + ani_int length; if (((status = GetPropertyRef(env, param, name, isUndefined, arrayObj)) != ANI_OK) || isUndefined == ANI_TRUE) { ANS_LOGI("get param failed, may be %{public}s : undefined", name); return ANI_INVALID_ARGS; } - status = env->Object_GetPropertyByName_Double(static_cast(arrayObj), "length", &length); + status = env->Object_GetPropertyByName_Int(static_cast(arrayObj), "length", &length); if (status != ANI_OK) { ANS_LOGI("status : %{public}d", status); return status; } - for (int i = 0; i < static_cast(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref buttonRef; status = env->Object_CallMethodByName_Ref(static_cast(arrayObj), - "$_get", "i:C{std.core.Object}", &buttonRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", &buttonRef, i); if (status != ANI_OK) { ANS_LOGI("status : %{public}d, index: %{public}d", status, i); return status; diff --git a/frameworks/ets/ani/src/sts_slot.cpp b/frameworks/ets/ani/src/sts_slot.cpp index 0167a798b051442a9260668e5c70d317fcc0f643..43f29248de8b447643bf95f7b4f888f39fbf2fa2 100644 --- a/frameworks/ets/ani/src/sts_slot.cpp +++ b/frameworks/ets/ani/src/sts_slot.cpp @@ -304,16 +304,16 @@ bool UnwrapNotificationSlotArrayByAniObj(ani_env *env, ani_object notificationSl ANS_LOGE("notificationSlotArrayObj is null"); return false; } - ani_double length; - ani_status status = env->Object_GetPropertyByName_Double(notificationSlotArrayObj, "length", &length); + ani_int length; + ani_status status = env->Object_GetPropertyByName_Int(notificationSlotArrayObj, "length", &length); if (status != ANI_OK) { ANS_LOGE("Object_GetPropertyByName_Double faild. status : %{public}d", status); return false; } - for (int i = 0; i < int(length); i++) { + for (int32_t i = 0; i < length; i++) { ani_ref notificationSlotEntryRef; status = env->Object_CallMethodByName_Ref(notificationSlotArrayObj, - "$_get", "i:C{std.core.Object}", ¬ificationSlotEntryRef, (ani_int)i); + "$_get", "i:C{std.core.Object}", ¬ificationSlotEntryRef, i); if (status != ANI_OK) { ANS_LOGE("Object_CallMethodByName_Ref faild. status : %{public}d", status); }