!35384 Security Alarm Modification

Merge pull request !35384 from yangziyong/Security_Alarm_Modification
This commit is contained in:
openharmony_ci 2024-06-14 17:58:12 +00:00 committed by Gitee
commit 02293b42cf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
14 changed files with 44 additions and 43 deletions

View File

@ -214,7 +214,7 @@ void NavigationGroupNode::RemoveRedundantNavDestination(RefPtr<FrameNode>& navig
auto pattern = GetPattern<NavigationPattern>();
// record remove destination size
int32_t removeSize = 0;
while (slot + removeSize < navigationContentNode->GetChildren().size()) {
while (static_cast<int32_t>(slot) + removeSize < navigationContentNode->GetChildren().size()) {
// delete useless nodes that are not at the top
auto navDestination = AceType::DynamicCast<NavDestinationGroupNode>(navigationContentNode->GetLastChild());
if (!navDestination) {

View File

@ -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

View File

@ -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];

View File

@ -131,7 +131,7 @@ PositionWithAffinity ParagraphManager::GetGlyphPositionAtCoordinate(Offset offse
if (LessOrEqual(offset.GetY(), info.paragraph->GetHeight()) ||
(idx == static_cast<int>(paragraphs_.size()) - 1)) {
auto result = info.paragraph->GetGlyphPositionAtCoordinate(offset);
finalResult.position_ = result.position_ + info.start;
finalResult.position_ = result.position_ + static_cast<size_t>(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_);

View File

@ -272,7 +272,7 @@ void RichEditorPattern::InsertValueInStyledString(const std::string& insertValue
}
isTextChange_ = true;
moveDirection_ = MoveDirection::FORWARD;
moveLength_ += StringUtils::ToWstring(insertValue).length();
moveLength_ += static_cast<int32_t>(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<uint32_t>(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<ImageSpanNode>(child);
if (imageSpanNode && imageSpanNode->GetSpanItem()) {
index = imageSpanNode->GetSpanItem()->placeholderIndex;
index = static_cast<uint32_t>(imageSpanNode->GetSpanItem()->placeholderIndex);
}
}
if (index >= rectsForPlaceholders.size()) {

View File

@ -86,7 +86,7 @@ RefPtr<FrameNode> RichEditorDragPattern::CreateDragNode(
auto boxes = hostPattern->GetTextBoxes();
for (const auto& child : imageChildren) {
auto imageIndex = placeholderIndex[index];
if (imageIndex >= rectsForPlaceholders.size()) {
if (imageIndex >= static_cast<int32_t>(rectsForPlaceholders.size())) {
break;
}
auto rect = rectsForPlaceholders.at(imageIndex);

View File

@ -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_;

View File

@ -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
{

View File

@ -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;
};

View File

@ -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);
};

View File

@ -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<FrameNode*>(node);
auto strokeWidth_ = Dimension(strokeWidth, static_cast<OHOS::Ace::DimensionUnit>(unit));
CHECK_NULL_VOID(frameNode);
auto path = AceType::MakeRefPtr<Path>();
auto width = Dimension(attribute[NUM_0], static_cast<OHOS::Ace::DimensionUnit>(unit));
auto height = Dimension(attribute[NUM_1], static_cast<OHOS::Ace::DimensionUnit>(unit));
auto width = Dimension((*attribute)[NUM_0], static_cast<OHOS::Ace::DimensionUnit>(unit));
auto height = Dimension((*attribute)[NUM_1], static_cast<OHOS::Ace::DimensionUnit>(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<FrameNode*>(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<FrameNode*>(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)

View File

@ -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<FrameNode*>(node);
CHECK_NULL_VOID(frameNode);
auto margin = TextFieldModelNG::GetMargin(frameNode);
values[NUM_0] = margin.top->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
values[NUM_1] = margin.right->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
values[NUM_2] = margin.bottom->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
values[NUM_3] = margin.left->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[NUM_0] = margin.top->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[NUM_1] = margin.right->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[NUM_2] = margin.bottom->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[NUM_3] = margin.left->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
length = NUM_4;
}

View File

@ -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<FrameNode*>(node);
CHECK_NULL_VOID(frameNode);
auto margin = TextFieldModelNG::GetMargin(frameNode);
values[CALL_ARG_0] = margin.top->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
values[CALL_ARG_1] = margin.right->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
values[CALL_ARG_2] = margin.bottom->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
values[CALL_ARG_3] = margin.left->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[CALL_ARG_0] = margin.top->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[CALL_ARG_1] = margin.right->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[CALL_ARG_2] = margin.bottom->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
(*values)[CALL_ARG_3] = margin.left->GetDimension().GetNativeValue(static_cast<DimensionUnit>(unit));
length = DEFAULT_MARGIN_VALUES_COUNT;
}

View File

@ -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<float, ARRAY_SIZE> rotateArray;
for (int32_t i = 0; i < static_cast<uint32_t>(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;