diff --git a/frameworks/common/text.cpp b/frameworks/common/text.cpp index c9899ce825559a99e9c047faaf70d9b2846e7ce2..f8cd1f9eff1bcb2fd1abbc65096100ac7969c9c0 100644 --- a/frameworks/common/text.cpp +++ b/frameworks/common/text.cpp @@ -89,6 +89,10 @@ void Text::SetSpannableString(const SpannableString* spannableString) return; } textStyles_ = static_cast(UIMalloc(textLen)); + if (textStyles_ == nullptr) { + GRAPHIC_LOGE("Text::SetSpannableString invalid parameter"); + return; + } ListNode* node = spannableString->spanList_.Begin(); while (node != spannableString->spanList_.End()) { for (uint32_t i = node->data_->start_; i < node->data_->end_; i++) { @@ -561,6 +565,10 @@ void Text::SetRelativeSizeSpan(uint16_t start, uint16_t end, float size) absoluteSize = static_cast(size * fontSize_); #else UITextLanguageFontParam* fontParam = UIFontBuilder::GetInstance()->GetTextLangFontsTable(fontId_); + if (fontParam == nullptr) { + GRAPHIC_LOGE("Text::SetRelativeSizeSpan invalid parameter"); + return; + } absoluteSize = static_cast(size * fontParam->size); #endif SetAbsoluteSizeSpan(start, end, absoluteSize); diff --git a/frameworks/common/typed_text.cpp b/frameworks/common/typed_text.cpp index 045016159d3cca75569665f506120309a8e650c1..629a7fcd660a5a3d19e9bfc99a43306a8b0699df 100644 --- a/frameworks/common/typed_text.cpp +++ b/frameworks/common/typed_text.cpp @@ -177,21 +177,18 @@ uint32_t TypedText::GetNextLine(const char* text, uint8_t fontId, uint8_t fontSi return index; } uint32_t lastBreakPos = 0; - int16_t curW; uint32_t tmp = 0; while (true) { - curW = TypedText::GetTextWidth(text, fontId, fontSize, index, letterSpace); + int16_t curW = TypedText::GetTextWidth(text, fontId, fontSize, index, letterSpace); if (curW > maxWidth) { index = lastBreakPos; if (lastBreakPos == 0) { curW = 0; uint32_t i = 0; - uint32_t letter; - uint16_t letterWidth; while (text[i] != '\0') { tmp = i; - letter = TypedText::GetUTF8Next(text, tmp, i); - letterWidth = UIFont::GetInstance()->GetWidth(letter, fontId, fontSize, 0); + uint32_t letter = TypedText::GetUTF8Next(text, tmp, i); + uint16_t letterWidth = UIFont::GetInstance()->GetWidth(letter, fontId, fontSize, 0); curW += letterWidth; if (letterWidth > 0) { curW += letterSpace; @@ -228,13 +225,12 @@ bool TypedText::GetWrapPoint(const char* text, uint32_t& breakPoint) { breakPoint = 0; uint32_t j = 0; - uint32_t letter = 0; if (text == nullptr) { return true; } while (text[breakPoint] != '\0') { - letter = GetUTF8Next(text, breakPoint, j); + uint32_t letter = GetUTF8Next(text, breakPoint, j); breakPoint = j; if ((letter == ' ') || (letter == '.') || (letter == ',') || (letter == '!') || (letter == '=') || (letter == '?')) { @@ -261,10 +257,9 @@ int16_t TypedText::GetTextWidth(const char* text, uint8_t fontId, uint8_t fontSi uint32_t i = 0; uint16_t width = 0; - uint32_t letter; while (i < length) { - letter = GetUTF8Next(text, i, i); + uint32_t letter = GetUTF8Next(text, i, i); if ((letter == 0) || (letter == '\n') || (letter == '\r')) { continue; } @@ -533,8 +528,8 @@ bool TypedText::IsColourWord(uint32_t codePoint, uint8_t fontId, uint8_t fontSiz #if ENABLE_MULTI_FONT uint8_t* searchLists = nullptr; int8_t listSize = UIMultiFontManager::GetInstance()->GetSearchFontList(fontId, &searchLists); - int8_t currentIndex = 0; if ((listSize > 0) && (searchLists != nullptr)) { + int8_t currentIndex = 0; do { weight = UIFont::GetInstance()->GetFontWeight(searchLists[currentIndex]); if (weight >= 16) { // 16: rgb565->16 rgba8888->32 font with rgba diff --git a/frameworks/components/ui_abstract_scroll.cpp b/frameworks/components/ui_abstract_scroll.cpp index 669bf7ff58c85077b2a2e5e90b112b73159d7790..a51851eaca7394121322ca314866ca4ad51a205e 100644 --- a/frameworks/components/ui_abstract_scroll.cpp +++ b/frameworks/components/ui_abstract_scroll.cpp @@ -36,7 +36,7 @@ public: BarEaseInOutAnimator(BarEaseInOutAnimator&&) = delete; BarEaseInOutAnimator& operator=(BarEaseInOutAnimator&&) = delete; - BarEaseInOutAnimator(UIAbstractScroll& scrollView) + explicit BarEaseInOutAnimator(UIAbstractScroll& scrollView) : scrollView_(scrollView), timer_(APPEAR_PERIOD, TimerCb, this), animator_(this, nullptr, ANIMATOR_DURATION, false) @@ -172,11 +172,9 @@ void UIAbstractScroll::MoveChildByOffset(int16_t offsetX, int16_t offsetY) return; } UIView* view = GetChildrenHead(); - int16_t x; - int16_t y; while (view != nullptr) { - x = view->GetX() + offsetX; - y = view->GetY() + offsetY; + int16_t x = view->GetX() + offsetX; + int16_t y = view->GetY() + offsetY; view->SetPosition(x, y); view = view->GetNextSibling(); } diff --git a/frameworks/components/ui_checkbox.cpp b/frameworks/components/ui_checkbox.cpp index c07611ac27f3d29b84638deceb833cdd383023a4..d199db32c3509e1f664bb4c1c3ca9bc0b30d0493 100644 --- a/frameworks/components/ui_checkbox.cpp +++ b/frameworks/components/ui_checkbox.cpp @@ -181,7 +181,6 @@ void UICheckBox::UnSelectedStateSoftwareDrawing(BufferInfo& gfxDstBuffer, int16_t borderRadius, int16_t rectLineWidth) { - Rect contentRect = GetContentRect(); Style styleUnSelect = StyleDefault::GetBackgroundTransparentStyle(); styleUnSelect.borderWidth_ = rectLineWidth; styleUnSelect.borderRadius_ = borderRadius; diff --git a/frameworks/components/ui_image_view.cpp b/frameworks/components/ui_image_view.cpp index e91eb9ca48222650f4ba4986c7c4afca0ef2e757..094a59b1b1bd518b4266ab24eb181cc76ae13ce2 100644 --- a/frameworks/components/ui_image_view.cpp +++ b/frameworks/components/ui_image_view.cpp @@ -368,6 +368,10 @@ void UIImageView::UpdateDrawTransMap(bool updateContentMatrix) } // only contentMatrix if (transMap_ == nullptr || transMap_->IsInvalid()) { + if (contentMatrix_ == nullptr) { + GRAPHIC_LOGE("Text: UpdateDrawTransMap contentMatrix_ is nullptr"); + return; + } drawTransMap_->SetMatrix(*contentMatrix_); return; } diff --git a/frameworks/components/ui_list.cpp b/frameworks/components/ui_list.cpp index 8144c4226d43c98cdd61e608be49f025e2950727..0f5c3065dd29adfeb7dede1715f9bd448dd2c3bc 100644 --- a/frameworks/components/ui_list.cpp +++ b/frameworks/components/ui_list.cpp @@ -628,8 +628,6 @@ void UIList::MoveChildByOffset(int16_t xOffset, int16_t yOffset) if (view == nullptr) { return; } - int16_t x; - int16_t y; int16_t height; int16_t width; @@ -660,8 +658,8 @@ void UIList::MoveChildByOffset(int16_t xOffset, int16_t yOffset) } bool isSelectViewFind = false; do { - x = view->GetX() + xOffset; - y = view->GetY() + yOffset; + int16_t x = view->GetX() + xOffset; + int16_t y = view->GetY() + yOffset; view->SetPosition(x, y); if ((selectPosition_ != 0) && !isSelectViewFind) { if (direction_ == VERTICAL) { diff --git a/frameworks/components/ui_picker.cpp b/frameworks/components/ui_picker.cpp index 91eb4854951033d3a4b5a406350310b61b33d00b..0532258fcc8bccbc1d79b2f9dd8b05df7e896084 100644 --- a/frameworks/components/ui_picker.cpp +++ b/frameworks/components/ui_picker.cpp @@ -324,9 +324,8 @@ bool UIPicker::RefreshSelected(uint16_t index) UIView* childView = static_cast(list_.GetChildrenHead()); uint16_t lastSelectIndex = listListener_->GetSelectIndex(); - int16_t viewIndex; while (childView != nullptr) { - viewIndex = childView->GetViewIndex(); + int16_t viewIndex = childView->GetViewIndex(); if (viewIndex == lastSelectIndex) { childView->SetStyle(STYLE_TEXT_COLOR, GetBackgroundTextColor().full); if (backgroundFontName_ == nullptr) { diff --git a/frameworks/components/ui_scroll_view.cpp b/frameworks/components/ui_scroll_view.cpp index 3fae9201ec3c05ff1ab9f3992132cbcfda572a24..537693ba31977fa6d7f043b10efa0e82dbe8dc86 100644 --- a/frameworks/components/ui_scroll_view.cpp +++ b/frameworks/components/ui_scroll_view.cpp @@ -127,7 +127,7 @@ bool UIScrollView::OnRotateEvent(const RotateEvent& event) } VibratorFunc vibratorFunc = VibratorManager::GetInstance()->GetVibratorFunc(); if (vibratorFunc != nullptr && !isEdge) { - uint16_t rotateLen = MATH_ABS(totalRotateLen_ - lastVibratorRotateLen_); + rotateLen = MATH_ABS(totalRotateLen_ - lastVibratorRotateLen_); if (rotateLen > DEFAULT_SCROLL_VIEW_VIBRATION_LEN) { uint16_t vibrationCnt = rotateLen / DEFAULT_SCROLL_VIEW_VIBRATION_LEN; for (uint16_t i = 0; i < vibrationCnt; i++) { diff --git a/frameworks/components/ui_view.cpp b/frameworks/components/ui_view.cpp index f898a83d24863ad8b098c9d25c535e358f156834..3445cfa220528a1daab6afb3846cd035b4855354 100644 --- a/frameworks/components/ui_view.cpp +++ b/frameworks/components/ui_view.cpp @@ -1264,9 +1264,8 @@ uint8_t UIView::GetMixOpaScale() const { uint8_t opaMix = opaScale_; UIView* parent = parent_; - uint8_t opaParent; while (parent != nullptr) { - opaParent = parent->GetOpaScale(); + uint8_t opaParent = parent->GetOpaScale(); // 8: Shift right 8 bits opaMix = (opaParent == OPA_OPAQUE) ? opaMix : ((static_cast(opaParent) * opaMix) >> 8); parent = parent->GetParent(); diff --git a/frameworks/components/ui_view_group.cpp b/frameworks/components/ui_view_group.cpp index 47538647ada26accd1ac4ca4170716fb9a5a38b6..3cb872e16ab043001f87e0b986d47c3064b7bb8d 100644 --- a/frameworks/components/ui_view_group.cpp +++ b/frameworks/components/ui_view_group.cpp @@ -310,11 +310,9 @@ UIView* UIViewGroup::GetChildById(const char* id) const void UIViewGroup::MoveChildByOffset(int16_t xOffset, int16_t yOffset) { UIView* view = childrenHead_; - int16_t x; - int16_t y; while (view != nullptr) { - x = view->GetX() + xOffset; - y = view->GetY() + yOffset; + int16_t x = view->GetX() + xOffset; + int16_t y = view->GetY() + yOffset; view->SetPosition(x, y); view = view->GetNextSibling(); } @@ -378,7 +376,6 @@ void UIViewGroup::UpdateRenderView(UIView* targetView) int16_t curZIndex = curView->GetZIndex(); int16_t targetZIndex = targetView->GetZIndex(); - int16_t nextZIndex; UIView* nextView = curView->GetNextRenderSibling(); UIView* preView = nullptr; @@ -396,7 +393,7 @@ void UIViewGroup::UpdateRenderView(UIView* targetView) while (nextView != nullptr) { curZIndex = curView->GetZIndex(); - nextZIndex = nextView->GetZIndex(); + int16_t nextZIndex = nextView->GetZIndex(); if (curZIndex == targetZIndex) { InsertRenderView(curView, preView, targetView); return; @@ -431,7 +428,6 @@ void UIViewGroup::InsertRenderView(UIView* archorView, UIView* anchorPreView, UI return; } - int16_t curZIndex = node->GetZIndex(); int16_t targetZIndex = targetView->GetZIndex(); UIView* newArchorView = nullptr; @@ -442,7 +438,7 @@ void UIViewGroup::InsertRenderView(UIView* archorView, UIView* anchorPreView, UI } while (node->GetNextSibling() != nullptr) { - curZIndex = node->GetNextSibling()->GetZIndex(); + int16_t curZIndex = node->GetNextSibling()->GetZIndex(); if (curZIndex == targetZIndex) { if ((node->GetNextSibling() == targetView) && (newArchorView == nullptr)) { targetView->SetNextRenderSibling(archorView); diff --git a/frameworks/draw/clip_utils.cpp b/frameworks/draw/clip_utils.cpp index b96ae6c0995f1b1a8f494fb2b816725f7a098222..2cfa210cd23b75e591c17d815c5ff428fc030eb1 100644 --- a/frameworks/draw/clip_utils.cpp +++ b/frameworks/draw/clip_utils.cpp @@ -176,9 +176,9 @@ void ClipUtils::DrawPixel(int16_t x, int16_t y, uint8_t opa, const ImageInfo* im } } -void ClipUtils::DrawHorLine(int16_t x, int16_t y, int16_t len, uint8_t opa, const ImageInfo* imageInfo) +void ClipUtils::DrawHorLine(int16_t x, int16_t y, int16_t width, uint8_t opa, const ImageInfo* imageInfo) { - for (int32_t i = x; i <= x + len; i++) { + for (int32_t i = x; i <= x + width; i++) { DrawPixel(i, y, opa, imageInfo); } } diff --git a/frameworks/draw/draw_label.cpp b/frameworks/draw/draw_label.cpp index 264ff7a0a7e03ed06b181b783b377e9ff8ff8b50..2df487342cc0246cd9ecbc8fd53cf0e5d045763d 100644 --- a/frameworks/draw/draw_label.cpp +++ b/frameworks/draw/draw_label.cpp @@ -37,16 +37,14 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf } uint32_t i = 0; - uint32_t letter; uint16_t retOffsetY = 0; // ret value elipse offsetY uint16_t offsetPosY = 0; uint8_t maxLetterSize = GetLineMaxLetterSize(labelLine.text, labelLine.lineLength, labelLine.fontId, labelLine.fontSize, letterIndex, labelLine.sizeSpans); DrawLineBackgroundColor(gfxDstBuffer, letterIndex, labelLine); GlyphNode glyphNode; - uint8_t* fontMap; while (i < labelLine.lineLength) { - letter = TypedText::GetUTF8Next(labelLine.text, i, i); + uint32_t letter = TypedText::GetUTF8Next(labelLine.text, i, i); uint8_t fontId = labelLine.fontId; uint8_t fontSize = labelLine.fontSize; if (labelLine.sizeSpans != nullptr && labelLine.sizeSpans[letterIndex].isSizeSpan) { @@ -88,8 +86,8 @@ uint16_t DrawLabel::DrawTextOneLine(BufferInfo& gfxDstBuffer, const LabelLineInf glyphNode.textStyle = letterInfo.textStyle; #endif glyphNode.advance = 0; - fontMap = fontEngine->GetBitmap(letterInfo.letter, glyphNode, letterInfo.fontId, letterInfo.fontSize, - letterInfo.shapingId); + uint8_t* fontMap = fontEngine->GetBitmap(letterInfo.letter, glyphNode, letterInfo.fontId, letterInfo.fontSize, + letterInfo.shapingId); if (fontMap != nullptr) { #if ENABLE_VECTOR_FONT if (TypedText::IsColourWord(letterInfo.letter, fontId, fontSize)) { @@ -123,10 +121,9 @@ uint8_t DrawLabel::GetLineMaxLetterSize(const char* text, uint16_t lineLength, u return fontSize; } uint32_t i = 0; - uint32_t unicode; uint8_t maxLetterSize = fontSize; while (i < lineLength) { - unicode = TypedText::GetUTF8Next(text, i, i); + uint32_t unicode = TypedText::GetUTF8Next(text, i, i); if (TypedText::IsColourWord(unicode, fontId, fontSize)) { letterIndex++; continue; diff --git a/frameworks/font/glyphs_file.cpp b/frameworks/font/glyphs_file.cpp index e7b2518733c24bb6edca4ae00aef7f576e905298..d14d0378449d47b8760164ba49b19d2d76db5c2e 100644 --- a/frameworks/font/glyphs_file.cpp +++ b/frameworks/font/glyphs_file.cpp @@ -70,7 +70,6 @@ int8_t GlyphsFile::CacheInit() int8_t GlyphsFile::GetNodeFromFile(uint32_t unicode, uint8_t fontId, GlyphNode& node) { uint16_t idx = 0; - uint8_t key; uint32_t offset; GlyphInfo glyphInfo; int8_t result = GetGlyphInfo(fontId, glyphInfo); @@ -79,7 +78,7 @@ int8_t GlyphsFile::GetNodeFromFile(uint32_t unicode, uint8_t fontId, GlyphNode& } for (int32_t i = RADIX_SHIFT_START; i >= 0; i -= RADIX_TREE_BITS) { offset = idx * sizeof(IndexNode); - key = static_cast((unicode >> static_cast(i)) & RADIX_TREE_MASK); + uint8_t key = static_cast((unicode >> static_cast(i)) & RADIX_TREE_MASK); offset += key * sizeof(uint16_t); idx = *(reinterpret_cast(glyphInfo.indexCache + offset)); if (idx == 0) { diff --git a/frameworks/font/ui_font_bitmap.cpp b/frameworks/font/ui_font_bitmap.cpp index d385df33aa15e4e19da255dfd944d0de6a9075b2..d7537420efcaeca65b97ecc30f27c8ed84822a34 100644 --- a/frameworks/font/ui_font_bitmap.cpp +++ b/frameworks/font/ui_font_bitmap.cpp @@ -327,7 +327,6 @@ uint16_t UIFontBitmap::GetOffsetPosY(const char* text, uint8_t fontSize) { uint32_t i = 0; - uint32_t unicode; uint16_t textNum = 0; uint16_t emojiNum = 0; @@ -336,7 +335,7 @@ uint16_t UIFontBitmap::GetOffsetPosY(const char* text, GlyphNode emoijMaxNode = {}; uint8_t maxFontSie = fontSize; while (i < lineLength) { - unicode = TypedText::GetUTF8Next(text, i, i); + uint32_t unicode = TypedText::GetUTF8Next(text, i, i); #if ENABLE_MULTI_FONT uint8_t ret = GetMultiGlyphNode(unicode, glyphNode, fontId); #else @@ -389,9 +388,8 @@ uint16_t UIFontBitmap::GetLineMaxHeight(const char* text, } uint32_t i = 0; - uint32_t unicode; while (i < lineLength) { - unicode = TypedText::GetUTF8Next(text, i, i); + TypedText::GetUTF8Next(text, i, i); if (sizeSpans != nullptr && sizeSpans[letterIndex].isSizeSpan) { uint16_t spannableHeight = 0; if (sizeSpans[letterIndex].height == 0) { diff --git a/frameworks/font/ui_font_vector.cpp b/frameworks/font/ui_font_vector.cpp index 35be8cde3fc552e8a2ee15572dde0d1464e305df..275866128c277abb5881a1094ce08e2697b5ad0f 100644 --- a/frameworks/font/ui_font_vector.cpp +++ b/frameworks/font/ui_font_vector.cpp @@ -756,7 +756,6 @@ uint16_t UIFontVector::GetOffsetPosY(const char* text, return INVALID_RET_VALUE; } uint32_t i = 0; - uint32_t unicode; uint16_t textNum = 0; uint16_t emojiNum = 0; uint16_t loopNum = 0; @@ -764,7 +763,7 @@ uint16_t UIFontVector::GetOffsetPosY(const char* text, GlyphNode emojiMaxNode = {}; uint8_t maxFontSize = fontSize; while (i < lineLength) { - unicode = TypedText::GetUTF8Next(text, i, i); + uint32_t unicode = TypedText::GetUTF8Next(text, i, i); uint8_t ret = GetGlyphNode(unicode, glyphNode, fontId, fontSize); if (ret == RET_VALUE_OK) { #if ENABLE_VECTOR_FONT @@ -811,13 +810,12 @@ uint16_t UIFontVector::GetLineMaxHeight(const char *text, uint16_t lineLength, u return INVALID_RET_VALUE; } uint32_t i = 0; - uint32_t unicode; uint16_t textNum = 0; uint16_t emojiNum = 0; uint16_t loopNum = 0; uint16_t maxHeight = GetHeight(fontId, fontSize); while (i < lineLength) { - unicode = TypedText::GetUTF8Next(text, i, i); + uint32_t unicode = TypedText::GetUTF8Next(text, i, i); TypedText::IsColourWord(unicode, fontId, fontSize) ? emojiNum++ : textNum++; loopNum++; if (sizeSpans != nullptr && sizeSpans[letterIndex].isSizeSpan) { @@ -861,10 +859,9 @@ uint16_t UIFontVector::GetMaxSubLineHeight(uint16_t textNum, uint16_t loopNum, u } } // A line has both emoji and words - uint16_t tmpHeight = 0; if ((textNum > 0) && (emojiNum > 0)) { for (uint8_t i = 0; i < currentFontInfoNum_; i++) { - tmpHeight = static_cast(ftFaces_[i]->size->metrics.height / FONT_PIXEL_IN_POINT); + uint16_t tmpHeight = static_cast(ftFaces_[i]->size->metrics.height / FONT_PIXEL_IN_POINT); maxHeight = tmpHeight > maxHeight ? tmpHeight : maxHeight; } } diff --git a/frameworks/font/ui_line_break.cpp b/frameworks/font/ui_line_break.cpp index c4d98422358788daab01dd6ffc1ebd86ca8f7a84..9b3fe3f1d1d64c7098d34c93964d3e42d2f40a9d 100644 --- a/frameworks/font/ui_line_break.cpp +++ b/frameworks/font/ui_line_break.cpp @@ -133,7 +133,7 @@ uint32_t UILineBreakEngine::GetNextLineAndWidth(const char* text, int32_t state = LINE_BREAK_STATE_START; int16_t width = 0; int16_t height = 0; - while ((text[byteIdx] != '\0') && (byteIdx < len)) { + while ((byteIdx < len) && (text[byteIdx] != '\0')) { uint32_t unicode = TypedText::GetUTF8Next(text, preIndex, byteIdx); if (unicode == 0) { preIndex = byteIdx; diff --git a/frameworks/imgdecode/image_load.cpp b/frameworks/imgdecode/image_load.cpp index 142ecc5174d70bf49abbd65f4c5f66dc294857d5..7f748de5c22a8f5789514e18ca872a9b0d2de56f 100644 --- a/frameworks/imgdecode/image_load.cpp +++ b/frameworks/imgdecode/image_load.cpp @@ -77,9 +77,6 @@ bool ImageLoad::UncompressImageInZip(ImageInfo& imageInfo, uint8_t* buffer, uint bool ImageLoad::UnzipImage(uint8_t* imageBuffer, uint32_t size, ImageInfo& imageInfo) { - uint32_t value = 0; - uint32_t count = 0; - if ((imageBuffer == nullptr) || (size == 0)) { GRAPHIC_LOGE("imageHeader is null."); return false; @@ -98,8 +95,8 @@ bool ImageLoad::UnzipImage(uint8_t* imageBuffer, uint32_t size, ImageInfo& image *dest++ = *source++; } else { source++; - value = *source++; - count = *source++; + uint32_t value = *source++; + uint32_t count = *source++; if (destEnd < count + dest) { break; } @@ -130,11 +127,9 @@ bool ImageLoad::Unzip24Image(uint8_t* imageBuffer, uint32_t size, ImageInfo& ima uint32_t* dest = reinterpret_cast(const_cast(imageInfo.data)); uint32_t* destEnd = reinterpret_cast(const_cast(imageInfo.data) + imageInfo.dataSize); while ((source < sourceEnd) && (dest < destEnd)) { - uint32_t count = 0; - uint32_t value = 0; - // Little endian - value = ((*source)) + (*(source + BITMAP_MID_BIT) << MOVE_LOW) + (*(source + BITMAP_LOW_BIT) << MOVE_HIGH); + uint32_t value = ((*source)) + (*(source + BITMAP_MID_BIT) << MOVE_LOW) + + (*(source + BITMAP_LOW_BIT) << MOVE_HIGH); source = source + BITMAP_ZIP_LEN; if (value != BITMAP_ZIP24_FLAG) { *dest = value | BITMAP_ALPHA_MASK; @@ -143,7 +138,8 @@ bool ImageLoad::Unzip24Image(uint8_t* imageBuffer, uint32_t size, ImageInfo& ima value = ((*source)) + (*(source + BITMAP_MID_BIT) << MOVE_LOW) + (*(source + BITMAP_LOW_BIT) << MOVE_HIGH); source = source + BITMAP_ZIP_LEN; - count = ((*source)) + (*(source + BITMAP_MID_BIT) << MOVE_LOW) + (*(source + BITMAP_LOW_BIT) << MOVE_HIGH); + uint32_t count = ((*source)) + (*(source + BITMAP_MID_BIT) << MOVE_LOW) + + (*(source + BITMAP_LOW_BIT) << MOVE_HIGH); source = source + BITMAP_ZIP_LEN; if (count > BITMAP_MAXCON_PIXNUM) { diff --git a/frameworks/layout/grid_layout.cpp b/frameworks/layout/grid_layout.cpp index de707ae4693a74d9a06c1b0621f094af458a66b4..8328293d71d9cb4b8ac544126c81b550f74929b4 100644 --- a/frameworks/layout/grid_layout.cpp +++ b/frameworks/layout/grid_layout.cpp @@ -56,9 +56,8 @@ void GridLayout::LayoutHorizontal() int16_t layoutWidth = GetWidth() / cols_; int16_t layoutHeight = GetHeight() / rows_; int16_t posX; - int16_t posY; for (int16_t i = 0; i < rows_; i++) { - posY = i * layoutHeight; + int16_t posY = i * layoutHeight; for (int16_t j = 0; j < cols_; j++) { if (child == nullptr) { return; @@ -90,10 +89,9 @@ void GridLayout::LayoutVertical() int16_t bottom; int16_t layoutWidth = GetWidth() / cols_; int16_t layoutHeight = GetHeight() / rows_; - int16_t posX; int16_t posY; for (int16_t i = 0; i < cols_; i++) { - posX = i * layoutWidth; + int16_t posX = i * layoutWidth; for (int16_t j = 0; j < rows_; j++) { if (child == nullptr) { return; diff --git a/frameworks/render/render_base.cpp b/frameworks/render/render_base.cpp index 09b81498b323426855d84160e0672ddc8d933df5..a71ff6299f0c5baf95ce9f5246de22a9739c5674 100644 --- a/frameworks/render/render_base.cpp +++ b/frameworks/render/render_base.cpp @@ -123,7 +123,8 @@ void RenderBase::BlendColorHSpan(int32_t x, int32_t y, int32_t len, const Rgba8T pixfmtType_->BlendColorHSpan(x, y, len, colors, covers, cover); } -bool RenderBase::ColorHSpanHandler(int32_t& x, int32_t& y, int32_t& len, const Rgba8T*& colors, const uint8_t*& covers) +bool RenderBase::ColorHSpanHandler(int32_t& x, const int32_t& y, int32_t& len, const Rgba8T*& colors, + const uint8_t*& covers) const { if (y > GetYMax() || y < GetYMin()) { return false; diff --git a/frameworks/render/render_base.h b/frameworks/render/render_base.h index bbc9120db36b268ebcc2df6fd3465914485ce3a9..0c29f2cdeca6fa5b5e117d82de7a0c54277bb1bc 100644 --- a/frameworks/render/render_base.h +++ b/frameworks/render/render_base.h @@ -191,7 +191,8 @@ public: * @param covers Scan line corresponding coverage array. * @return Returns true if should run the follow programs. */ - bool ColorHSpanHandler(int32_t& x, int32_t& y, int32_t& len, const Rgba8T*& colors, const uint8_t*& covers); + bool ColorHSpanHandler(int32_t& x, const int32_t& y, int32_t& len, const Rgba8T*& colors, + const uint8_t*& covers) const; private: RenderPixfmtRgbaBlend* pixfmtType_; diff --git a/frameworks/render/render_scanline.cpp b/frameworks/render/render_scanline.cpp index 3a77449942bd482ba2cfff1ef9883f5022ae8f5d..45cface2b616984ceca01230d94b369bfd6a6f3a 100644 --- a/frameworks/render/render_scanline.cpp +++ b/frameworks/render/render_scanline.cpp @@ -216,7 +216,6 @@ void BlendSourceAtop(RasterizerScanlineAntialias& raster1, RasterizerScanlineAnt if (y1 == y2) { raster1.SweepScanline(scanline1); y1 = scanline1.GetYLevel(); - span1 = scanline1.Begin(); } } } @@ -325,7 +324,6 @@ void BlendSourceOut(RasterizerScanlineAntialias& raster1, RasterizerScanlineAnti if (y1 == y2 && y1 < raster2.GetMaxY() - 1) { if (raster1.SweepScanline(scanline1)) { y1 = scanline1.GetYLevel(); - span1 = scanline1.Begin(); } } } @@ -489,7 +487,6 @@ void BlendXOR(RasterizerScanlineAntialias& raster1, RasterizerScanlineAntialias& if (y1 == y2 && y1 < raster2.GetMaxY() - 1) { if (raster1.SweepScanline(scanline1)) { y1 = scanline1.GetYLevel(); - span1 = scanline1.Begin(); } } } @@ -616,7 +613,6 @@ void BlendSourceInLoop(RasterizerScanlineAntialias& raster1, GeometryScanline& s if (y1 == y2) { raster1.SweepScanline(scanline1); y1 = scanline1.GetYLevel(); - span1 = scanline1.Begin(); } } diff --git a/test/framework/src/ui_auto_test.cpp b/test/framework/src/ui_auto_test.cpp index 16b6b924e36e464f3dce3991d098e783c281e1c1..d7135e2ba50401679e2ac5eb8372dd4fad567838 100644 --- a/test/framework/src/ui_auto_test.cpp +++ b/test/framework/src/ui_auto_test.cpp @@ -15,6 +15,7 @@ #include "ui_auto_test.h" +#include #include "auto_test_manager.h" #include "components/root_view.h" #include "components/ui_view_group.h" diff --git a/tools/qt/simulator/drivers/indev/key_input.h b/tools/qt/simulator/drivers/indev/key_input.h index e6f16a521a040621c7b894e3632623d63a5e6ed6..56ec94c7e68f13f3c6143ae94af0ab257f97cb1f 100644 --- a/tools/qt/simulator/drivers/indev/key_input.h +++ b/tools/qt/simulator/drivers/indev/key_input.h @@ -25,7 +25,7 @@ namespace OHOS { #if USE_KEY class KeyInput : public KeyInputDevice { public: - KeyInput() {} + KeyInput() : leftButtonDown_(false), lastX_(0), lastY_(0) {} virtual ~KeyInput() {} static KeyInput* GetInstance(); bool Read(DeviceData& data) override; diff --git a/tools/qt/simulator/uitest/ui_mainwidget.h b/tools/qt/simulator/uitest/ui_mainwidget.h index 573ccbde059ec061972000a27eeb6c0ad7d41962..b68cc614dbe9f76767f851e8ab89135320ac12ad 100644 --- a/tools/qt/simulator/uitest/ui_mainwidget.h +++ b/tools/qt/simulator/uitest/ui_mainwidget.h @@ -28,7 +28,7 @@ public: QMetaObject::connectSlotsByName(MainWidget); } // setupUi - void retranslateUi(QWidget* MainWidget) + static void retranslateUi(QWidget* MainWidget) { MainWidget->setWindowTitle(QCoreApplication::translate("MainWidget", "MainWidget", nullptr)); } // retranslateUi