diff --git a/frameworks/core/components_ng/pattern/navigation/navigation_group_node.cpp b/frameworks/core/components_ng/pattern/navigation/navigation_group_node.cpp index 1df99263343..a18eb66aadb 100644 --- a/frameworks/core/components_ng/pattern/navigation/navigation_group_node.cpp +++ b/frameworks/core/components_ng/pattern/navigation/navigation_group_node.cpp @@ -214,7 +214,7 @@ void NavigationGroupNode::RemoveRedundantNavDestination(RefPtr& navig auto pattern = GetPattern(); // record remove destination size int32_t removeSize = 0; - while (slot + removeSize < navigationContentNode->GetChildren().size()) { + while (static_cast(slot) + removeSize < navigationContentNode->GetChildren().size()) { // delete useless nodes that are not at the top auto navDestination = AceType::DynamicCast(navigationContentNode->GetLastChild()); if (!navDestination) { diff --git a/frameworks/core/components_ng/pattern/overlay/keyboard_base_pattern.h b/frameworks/core/components_ng/pattern/overlay/keyboard_base_pattern.h index eb8521944e2..a0f7e070962 100644 --- a/frameworks/core/components_ng/pattern/overlay/keyboard_base_pattern.h +++ b/frameworks/core/components_ng/pattern/overlay/keyboard_base_pattern.h @@ -59,7 +59,7 @@ public: private: int32_t targetId_ = -1; float keyboardHeight_ = 0.0f; - bool supportAvoidance_; + bool supportAvoidance_ = false; float safeHeight_ = 0.0f; }; } // namespace OHOS::Ace::NG diff --git a/frameworks/core/components_ng/pattern/overlay/sheet_presentation_pattern.cpp b/frameworks/core/components_ng/pattern/overlay/sheet_presentation_pattern.cpp index 2131a3e242e..857edea65c1 100644 --- a/frameworks/core/components_ng/pattern/overlay/sheet_presentation_pattern.cpp +++ b/frameworks/core/components_ng/pattern/overlay/sheet_presentation_pattern.cpp @@ -409,8 +409,8 @@ void SheetPresentationPattern::HandleDragEnd(float dragVelocity) auto upperIter = std::upper_bound(sheetDetentHeight_.begin(), sheetDetentHeight_.end(), currentSheetHeight); //record the drag position - int32_t detentsLowerPos = 0; - int32_t detentsUpperPos = 0; + uint32_t detentsLowerPos = 0; + uint32_t detentsUpperPos = 0; if (lowerIter == sheetDetentHeight_.end()) { //when drag over the highest sheet page upHeight = sheetDetentHeight_[sheetDetentsSize - 1]; diff --git a/frameworks/core/components_ng/pattern/rich_editor/paragraph_manager.cpp b/frameworks/core/components_ng/pattern/rich_editor/paragraph_manager.cpp index 65dfe7e0318..9009c969379 100644 --- a/frameworks/core/components_ng/pattern/rich_editor/paragraph_manager.cpp +++ b/frameworks/core/components_ng/pattern/rich_editor/paragraph_manager.cpp @@ -131,7 +131,7 @@ PositionWithAffinity ParagraphManager::GetGlyphPositionAtCoordinate(Offset offse if (LessOrEqual(offset.GetY(), info.paragraph->GetHeight()) || (idx == static_cast(paragraphs_.size()) - 1)) { auto result = info.paragraph->GetGlyphPositionAtCoordinate(offset); - finalResult.position_ = result.position_ + info.start; + finalResult.position_ = result.position_ + static_cast(info.start); TAG_LOGI(AceLogTag::ACE_TEXT, "Current paragraph, originPos = %{public}zu, finalPos =%{public}zu and affinity = %{public}d", result.position_, finalResult.position_, result.affinity_); diff --git a/frameworks/core/components_ng/pattern/rich_editor/rich_editor_pattern.cpp b/frameworks/core/components_ng/pattern/rich_editor/rich_editor_pattern.cpp index f2b26e4d825..79b5029fe2a 100644 --- a/frameworks/core/components_ng/pattern/rich_editor/rich_editor_pattern.cpp +++ b/frameworks/core/components_ng/pattern/rich_editor/rich_editor_pattern.cpp @@ -272,7 +272,7 @@ void RichEditorPattern::InsertValueInStyledString(const std::string& insertValue } isTextChange_ = true; moveDirection_ = MoveDirection::FORWARD; - moveLength_ += StringUtils::ToWstring(insertValue).length(); + moveLength_ += static_cast(StringUtils::ToWstring(insertValue).length()); auto host = GetHost(); CHECK_NULL_VOID(host); host->MarkDirtyNode(PROPERTY_UPDATE_MEASURE); @@ -6875,7 +6875,7 @@ size_t RichEditorPattern::GetLineCount() const TextLineMetrics RichEditorPattern::GetLineMetrics(int32_t lineNumber) { - if (lineNumber < 0 || lineNumber > GetLineCount() - 1) { + if (lineNumber < 0 || static_cast(lineNumber) > GetLineCount() - 1) { TAG_LOGE(AceLogTag::ACE_RICH_TEXT, "GetLineMetrics failed, lineNumber not between 0 and max lines:%{public}d", lineNumber); return TextLineMetrics(); @@ -7264,7 +7264,7 @@ void RichEditorPattern::UpdateChildrenOffset() if (isSpanStringMode_) { auto imageSpanNode = AceType::DynamicCast(child); if (imageSpanNode && imageSpanNode->GetSpanItem()) { - index = imageSpanNode->GetSpanItem()->placeholderIndex; + index = static_cast(imageSpanNode->GetSpanItem()->placeholderIndex); } } if (index >= rectsForPlaceholders.size()) { diff --git a/frameworks/core/components_ng/pattern/rich_editor_drag/rich_editor_drag_pattern.cpp b/frameworks/core/components_ng/pattern/rich_editor_drag/rich_editor_drag_pattern.cpp index 7ead99d56e0..161bbae2d38 100644 --- a/frameworks/core/components_ng/pattern/rich_editor_drag/rich_editor_drag_pattern.cpp +++ b/frameworks/core/components_ng/pattern/rich_editor_drag/rich_editor_drag_pattern.cpp @@ -86,7 +86,7 @@ RefPtr RichEditorDragPattern::CreateDragNode( auto boxes = hostPattern->GetTextBoxes(); for (const auto& child : imageChildren) { auto imageIndex = placeholderIndex[index]; - if (imageIndex >= rectsForPlaceholders.size()) { + if (imageIndex >= static_cast(rectsForPlaceholders.size())) { break; } auto rect = rectsForPlaceholders.at(imageIndex); diff --git a/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.cpp b/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.cpp index ef0cb587639..89901a3e74c 100644 --- a/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.cpp +++ b/frameworks/core/components_ng/pattern/scrollable/scrollable_pattern.cpp @@ -2659,7 +2659,7 @@ void ScrollablePattern::AddScrollableFrameInfo(int32_t scrollSource) if (scrollableFrameInfos_.size() >= SCROLLABLE_FRAME_INFO_COUNT) { scrollableFrameInfos_.pop_front(); } - int32_t canOverScrollInfo = IsScrollableSpringEffect(); + uint32_t canOverScrollInfo = IsScrollableSpringEffect(); canOverScrollInfo = (canOverScrollInfo << 1) | IsScrollable(); canOverScrollInfo = (canOverScrollInfo << 1) | ScrollableIdle(); canOverScrollInfo = (canOverScrollInfo << 1) | animateOverScroll_; diff --git a/frameworks/core/components_ng/pattern/scrollable/scrollable_properties.h b/frameworks/core/components_ng/pattern/scrollable/scrollable_properties.h index 4bd6cb2ecd1..948efb6a97f 100644 --- a/frameworks/core/components_ng/pattern/scrollable/scrollable_properties.h +++ b/frameworks/core/components_ng/pattern/scrollable/scrollable_properties.h @@ -233,7 +233,7 @@ struct ScrollableFrameInfo { uint64_t scrollStateTime_ = 0; int32_t scrollState_ = 0; bool canOverScroll_ = false; - int32_t canOverScrollInfo_ = 0; + uint32_t canOverScrollInfo_ = 0; std::string ToString() const { diff --git a/frameworks/core/components_ng/pattern/swiper/swiper_paint_method.h b/frameworks/core/components_ng/pattern/swiper/swiper_paint_method.h index afa967c403a..32667e16f49 100644 --- a/frameworks/core/components_ng/pattern/swiper/swiper_paint_method.h +++ b/frameworks/core/components_ng/pattern/swiper/swiper_paint_method.h @@ -48,7 +48,7 @@ private: void ClipPadding(PaintWrapper* paintWrapper, RSCanvas& canvas) const; bool needPaintFade_; - bool needClipPadding_; + bool needClipPadding_ = false; Axis axis_; float mainDelta_ = 0.0f; }; diff --git a/frameworks/core/interfaces/arkoala/arkoala_api.h b/frameworks/core/interfaces/arkoala/arkoala_api.h index 8d9c5f16c6b..2d967f206ad 100644 --- a/frameworks/core/interfaces/arkoala/arkoala_api.h +++ b/frameworks/core/interfaces/arkoala/arkoala_api.h @@ -1416,7 +1416,7 @@ struct ArkUICommonModifier { void (*setMaskShape)(ArkUINodeHandle node, ArkUI_CharPtr type, ArkUI_Uint32 fill, ArkUI_Uint32 stroke, ArkUI_Float32 strokeWidth, const ArkUI_Float32* attribute, ArkUI_Int32 length, ArkUI_Int32 unit); void (*setMaskPath)(ArkUINodeHandle node, ArkUI_CharPtr type, ArkUI_Uint32 fill, ArkUI_Uint32 stroke, - ArkUI_Float32 strokeWidth, const ArkUI_Float32* attribute, ArkUI_CharPtr commands, ArkUI_Int32 unit); + ArkUI_Float32 strokeWidth, const ArkUI_Float32 (*attribute)[2], ArkUI_CharPtr commands, ArkUI_Int32 unit); void (*setProgressMask)(ArkUINodeHandle node, const ArkUI_Float32* attribute, ArkUI_Uint32 color); void (*setBlendMode)(ArkUINodeHandle node, ArkUI_Int32 blendMode, ArkUI_Int32 blendApplyTypeValue); void (*resetBlendMode)(ArkUINodeHandle node); @@ -1543,8 +1543,8 @@ struct ArkUICommonModifier { void (*resetVisibleAreaChange)(ArkUINodeHandle node); void (*resetAreaChange)(ArkUINodeHandle node); void (*setBackgroundImagePixelMap)(ArkUINodeHandle node, void* drawableDescriptor, ArkUI_Int32 repeatIndex); - void (*setLayoutRect)(ArkUINodeHandle node, ArkUI_Int32* values); - void (*getLayoutRect)(ArkUINodeHandle node, ArkUI_Int32* values); + void (*setLayoutRect)(ArkUINodeHandle node, ArkUI_Int32 (*values)[4]); + void (*getLayoutRect)(ArkUINodeHandle node, ArkUI_Int32 (*values)[4]); void (*resetLayoutRect)(ArkUINodeHandle node); ArkUI_Bool (*getFocusOnTouch)(ArkUINodeHandle node); void (*setSystemBarEffect)(ArkUINodeHandle node, ArkUI_Bool enable); @@ -2688,7 +2688,7 @@ struct ArkUITextAreaModifier { const struct ArkUISizeType* bottom, const struct ArkUISizeType* left); void (*resetTextAreaMargin)(ArkUINodeHandle node); void (*setTextAreaCaret)(ArkUINodeHandle node, ArkUI_Float32 value, ArkUI_Int32 unit); - void (*getTextAreaMargin)(ArkUINodeHandle node, ArkUI_Float32* values, ArkUI_Int32 length, ArkUI_Int32 unit); + void (*getTextAreaMargin)(ArkUINodeHandle node, ArkUI_Float32 (*values)[4], ArkUI_Int32 length, ArkUI_Int32 unit); void (*setTextAreaOnWillInsert)(ArkUINodeHandle node, ArkUI_Int64 callback); void (*resetTextAreaOnWillInsert)(ArkUINodeHandle node); void (*setTextAreaOnDidInsert)(ArkUINodeHandle node, ArkUI_Int64 callback); @@ -2888,7 +2888,7 @@ struct ArkUITextInputModifier { void (*resetTextInputMargin)(ArkUINodeHandle node); void (*setTextInputCaret)(ArkUINodeHandle node, ArkUI_Float32 value, ArkUI_Int32 unit); ArkUINodeHandle (*getTextInputController)(ArkUINodeHandle node); - void (*getTextInputMargin)(ArkUINodeHandle node, ArkUI_Float32* values, ArkUI_Int32 length, ArkUI_Int32 unit); + void (*getTextInputMargin)(ArkUINodeHandle node, ArkUI_Float32 (*values)[4], ArkUI_Int32 length, ArkUI_Int32 unit); void (*setTextInputEnablePreviewText)(ArkUINodeHandle node, ArkUI_Uint32 value); void (*resetTextInputEnablePreviewText)(ArkUINodeHandle node); }; diff --git a/frameworks/core/interfaces/native/node/node_common_modifier.cpp b/frameworks/core/interfaces/native/node/node_common_modifier.cpp index be3359e0b68..f3815ece429 100644 --- a/frameworks/core/interfaces/native/node/node_common_modifier.cpp +++ b/frameworks/core/interfaces/native/node/node_common_modifier.cpp @@ -4447,14 +4447,14 @@ void SetMaskShape(ArkUINodeHandle node, ArkUI_CharPtr type, ArkUI_Uint32 fill, A } void SetMaskPath(ArkUINodeHandle node, ArkUI_CharPtr type, ArkUI_Uint32 fill, ArkUI_Uint32 stroke, - ArkUI_Float32 strokeWidth, const ArkUI_Float32* attribute, ArkUI_CharPtr commands, ArkUI_Int32 unit) + ArkUI_Float32 strokeWidth, const ArkUI_Float32 (*attribute)[2], ArkUI_CharPtr commands, ArkUI_Int32 unit) { auto* frameNode = reinterpret_cast(node); auto strokeWidth_ = Dimension(strokeWidth, static_cast(unit)); CHECK_NULL_VOID(frameNode); auto path = AceType::MakeRefPtr(); - auto width = Dimension(attribute[NUM_0], static_cast(unit)); - auto height = Dimension(attribute[NUM_1], static_cast(unit)); + auto width = Dimension((*attribute)[NUM_0], static_cast(unit)); + auto height = Dimension((*attribute)[NUM_1], static_cast(unit)); std::string pathCommands(commands); path->SetWidth(width); path->SetHeight(height); @@ -5578,21 +5578,22 @@ void ResetAreaChange(ArkUINodeHandle node) ViewAbstract::ResetAreaChanged(frameNode); } -void SetLayoutRect(ArkUINodeHandle node, ArkUI_Int32* values) +void SetLayoutRect(ArkUINodeHandle node, ArkUI_Int32 (*values)[4]) { auto* frameNode = reinterpret_cast(node); - auto rect = NG::RectF(values[0], values[1], values[2], values[3]); // 2:index of width, 3:index of height + auto rect = + NG::RectF((*values)[0], (*values)[1], (*values)[2], (*values)[3]); // 2:index of width, 3:index of height ViewAbstract::SetLayoutRect(frameNode, rect); } -void GetLayoutRect(ArkUINodeHandle node, ArkUI_Int32* values) +void GetLayoutRect(ArkUINodeHandle node, ArkUI_Int32 (*values)[4]) { auto* frameNode = reinterpret_cast(node); auto rect = ViewAbstract::GetLayoutRect(frameNode); - values[0] = rect.GetX(); - values[1] = rect.GetY(); - values[2] = rect.Width(); // 2:index of width - values[3] = rect.Height(); // 3:index of height + (*values)[0] = rect.GetX(); + (*values)[1] = rect.GetY(); + (*values)[2] = rect.Width(); // 2:index of width + (*values)[3] = rect.Height(); // 3:index of height } void ResetLayoutRect(ArkUINodeHandle node) diff --git a/frameworks/core/interfaces/native/node/node_text_area_modifier.cpp b/frameworks/core/interfaces/native/node/node_text_area_modifier.cpp index 98751fb2b47..7fa032a9134 100644 --- a/frameworks/core/interfaces/native/node/node_text_area_modifier.cpp +++ b/frameworks/core/interfaces/native/node/node_text_area_modifier.cpp @@ -1491,15 +1491,15 @@ void ResetTextAreaMargin(ArkUINodeHandle node) TextFieldModelNG::SetMargin(frameNode, paddings); } -void GetTextAreaMargin(ArkUINodeHandle node, ArkUI_Float32* values, ArkUI_Int32 length, ArkUI_Int32 unit) +void GetTextAreaMargin(ArkUINodeHandle node, ArkUI_Float32 (*values)[4], ArkUI_Int32 length, ArkUI_Int32 unit) { auto* frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); auto margin = TextFieldModelNG::GetMargin(frameNode); - values[NUM_0] = margin.top->GetDimension().GetNativeValue(static_cast(unit)); - values[NUM_1] = margin.right->GetDimension().GetNativeValue(static_cast(unit)); - values[NUM_2] = margin.bottom->GetDimension().GetNativeValue(static_cast(unit)); - values[NUM_3] = margin.left->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[NUM_0] = margin.top->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[NUM_1] = margin.right->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[NUM_2] = margin.bottom->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[NUM_3] = margin.left->GetDimension().GetNativeValue(static_cast(unit)); length = NUM_4; } diff --git a/frameworks/core/interfaces/native/node/node_text_input_modifier.cpp b/frameworks/core/interfaces/native/node/node_text_input_modifier.cpp index 0b91ad641f0..300918abe26 100644 --- a/frameworks/core/interfaces/native/node/node_text_input_modifier.cpp +++ b/frameworks/core/interfaces/native/node/node_text_input_modifier.cpp @@ -1709,15 +1709,15 @@ void SetTextInputCaret(ArkUINodeHandle node, ArkUI_Float32 value, ArkUI_Int32 un TextFieldModelNG::SetCaretStyle(frameNode, caretStyle); } -void GetTextInputMargin(ArkUINodeHandle node, ArkUI_Float32* values, ArkUI_Int32 length, ArkUI_Int32 unit) +void GetTextInputMargin(ArkUINodeHandle node, ArkUI_Float32 (*values)[4], ArkUI_Int32 length, ArkUI_Int32 unit) { auto* frameNode = reinterpret_cast(node); CHECK_NULL_VOID(frameNode); auto margin = TextFieldModelNG::GetMargin(frameNode); - values[CALL_ARG_0] = margin.top->GetDimension().GetNativeValue(static_cast(unit)); - values[CALL_ARG_1] = margin.right->GetDimension().GetNativeValue(static_cast(unit)); - values[CALL_ARG_2] = margin.bottom->GetDimension().GetNativeValue(static_cast(unit)); - values[CALL_ARG_3] = margin.left->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[CALL_ARG_0] = margin.top->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[CALL_ARG_1] = margin.right->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[CALL_ARG_2] = margin.bottom->GetDimension().GetNativeValue(static_cast(unit)); + (*values)[CALL_ARG_3] = margin.left->GetDimension().GetNativeValue(static_cast(unit)); length = DEFAULT_MARGIN_VALUES_COUNT; } diff --git a/interfaces/native/node/style_modifier.cpp b/interfaces/native/node/style_modifier.cpp index 3c015ecd67d..1cfa0a9acae 100644 --- a/interfaces/native/node/style_modifier.cpp +++ b/interfaces/native/node/style_modifier.cpp @@ -1078,10 +1078,10 @@ const ArkUI_AttributeItem* GetMargin(ArkUI_NodeHandle node) ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP); if (node->type == ARKUI_NODE_TEXT_INPUT) { fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputMargin( - node->uiNodeHandle, margins, length, unit); + node->uiNodeHandle, &margins, length, unit); } else if (node->type == ARKUI_NODE_TEXT_AREA) { fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaMargin( - node->uiNodeHandle, margins, length, unit); + node->uiNodeHandle, &margins, length, unit); } else { fullImpl->getNodeModifiers()->getCommonModifier()->getMargin(node->uiNodeHandle, &margins, length, unit); } @@ -2697,7 +2697,7 @@ int32_t SetMask(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item) pathAttributes[NUM_1] = item->value[NUM_5].f32; } fullImpl->getNodeModifiers()->getCommonModifier()->setMaskPath( - node->uiNodeHandle, "path", fill, stroke, strokeWidth, pathAttributes, item->string, unit); + node->uiNodeHandle, "path", fill, stroke, strokeWidth, &pathAttributes, item->string, unit); } else if (item->value[0].i32 == ArkUI_MaskType::ARKUI_MASK_TYPE_PROGRESS) { ArkUI_Float32 progressAttributes[NUM_2]; if (LessNotEqual(item->value[NUM_1].f32, 0.0f) || LessNotEqual(item->value[NUM_2].f32, 0.0f)) { @@ -8466,7 +8466,7 @@ int32_t SetLayoutRect(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item) intArray[1] = item->value[1].i32; intArray[2] = item->value[2].i32; // 2:index of width intArray[3] = item->value[3].i32; // 3:index of height - fullImpl->getNodeModifiers()->getCommonModifier()->setLayoutRect(node->uiNodeHandle, intArray); + fullImpl->getNodeModifiers()->getCommonModifier()->setLayoutRect(node->uiNodeHandle, &intArray); return ERROR_CODE_NO_ERROR; } @@ -8474,7 +8474,7 @@ const ArkUI_AttributeItem* GetLayoutRect(ArkUI_NodeHandle node) { auto fullImpl = GetFullImpl(); ArkUI_Int32 intArray[NUM_4]; - fullImpl->getNodeModifiers()->getCommonModifier()->getLayoutRect(node->uiNodeHandle, intArray); + fullImpl->getNodeModifiers()->getCommonModifier()->getLayoutRect(node->uiNodeHandle, &intArray); g_numberValues[0].i32 = intArray[0]; g_numberValues[1].i32 = intArray[1]; g_numberValues[2].i32 = intArray[2]; // 2:index of width @@ -8704,7 +8704,7 @@ int32_t SetRotateTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* it return ERROR_CODE_PARAM_INVALID; } std::array rotateArray; - for (int32_t i = 0; i < static_cast(actualSize) && i < rotateArray.size(); i++) { + for (int32_t i = 0; i < actualSize && i < rotateArray.size(); i++) { rotateArray[i] = item->value[i].f32; } float angle = 0.0f;