From 2ef4a9abf802a8d3e50417a2293a4f47730b2e1a Mon Sep 17 00:00:00 2001 From: zhuxu Date: Mon, 11 Nov 2024 14:35:35 +0800 Subject: [PATCH] =?UTF-8?q?=E2=80=9CcodeCheck=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuxu Change-Id: I92a93e775f2ae8f36d26bea2ff432ace45170f86 --- .../fontcollection_napi/js_fontcollection.cpp | 6 +++--- .../graphic/text/paragraph_napi/js_paragraph.cpp | 16 ++++++++-------- .../kits/napi/graphic/text/run_napi/js_run.cpp | 2 +- .../graphic/text/text_line_napi/js_text_line.cpp | 2 +- .../kits/napi/graphic/text/utils/napi_common.cpp | 2 +- .../texgine/src/font_descriptor_cache.cpp | 2 +- rosen/modules/texgine/src/font_parser.cpp | 2 +- .../texgine/src/opentype_parser/ranges.cpp | 2 +- 8 files changed, 17 insertions(+), 17 deletions(-) diff --git a/interfaces/kits/napi/graphic/text/fontcollection_napi/js_fontcollection.cpp b/interfaces/kits/napi/graphic/text/fontcollection_napi/js_fontcollection.cpp index 2c1915499f..8bf472ec1c 100644 --- a/interfaces/kits/napi/graphic/text/fontcollection_napi/js_fontcollection.cpp +++ b/interfaces/kits/napi/graphic/text/fontcollection_napi/js_fontcollection.cpp @@ -65,7 +65,7 @@ napi_value JsFontCollection::Constructor(napi_env env, napi_callback_info info) } JsFontCollection* jsFontCollection = new(std::nothrow) JsFontCollection(); - if (jsFontCollection == nullptr){ + if (jsFontCollection == nullptr) { TEXT_LOGE("Failed to new font collection"); return nullptr; } @@ -392,7 +392,7 @@ napi_value JsFontCollection::OnLoadFont(napi_env env, napi_callback_info info) TEXT_LOGE("Failed to get argument, argc %{public}zu", argc); return nullptr; } - if (argv[0] == nullptr){ + if (argv[0] == nullptr) { TEXT_LOGE("Argv[0] is invalid"); return nullptr; } @@ -403,7 +403,7 @@ napi_value JsFontCollection::OnLoadFont(napi_env env, napi_callback_info info) return nullptr; } napi_valuetype valueType = napi_undefined; - if (argv[1] == nullptr){ + if (argv[1] == nullptr) { TEXT_LOGE("JsFontCollection::OnLoadFont Argv[1] is invalid"); return nullptr; } diff --git a/interfaces/kits/napi/graphic/text/paragraph_napi/js_paragraph.cpp b/interfaces/kits/napi/graphic/text/paragraph_napi/js_paragraph.cpp index 0767106578..139589bf50 100644 --- a/interfaces/kits/napi/graphic/text/paragraph_napi/js_paragraph.cpp +++ b/interfaces/kits/napi/graphic/text/paragraph_napi/js_paragraph.cpp @@ -173,7 +173,7 @@ napi_value JsParagraph::OnPaint(napi_env env, napi_callback_info info) TEXT_LOGE("Failed to get parameter, argc %{public}zu, ret %{public}d", argc, status); return NapiThrowError(env, TextErrorCode::ERROR_INVALID_PARAM, "Invalid params."); } - if (argv[0] == nullptr){ + if (argv[0] == nullptr) { TEXT_LOGE("Argv is invalid"); return NapiGetUndefined(env); } @@ -182,7 +182,7 @@ napi_value JsParagraph::OnPaint(napi_env env, napi_callback_info info) double y = 0.0; napi_unwrap(env, argv[0], reinterpret_cast(&jsCanvas)); if (!jsCanvas || !jsCanvas->GetCanvas() || - !(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) && + !(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) && argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], y))) { TEXT_LOGE("Failed to get paint parameter"); return NapiGetUndefined(env); @@ -385,19 +385,19 @@ napi_value JsParagraph::OnGetRectsForRange(napi_env env, napi_callback_info info TextRectWidthStyle wstyle; TextRectHeightStyle hstyle; napi_get_named_property(env, argv[0], "start", &tempValue); - if (tempValue == nullptr){ + if (tempValue == nullptr) { TEXT_LOGE("Get start property failed"); return NapiGetUndefined(env); } bool isStartOk = ConvertFromJsValue(env, tempValue, start); tempValue = nullptr; napi_get_named_property(env, argv[0], "end", &tempValue); - if (tempValue == nullptr){ + if (tempValue == nullptr) { TEXT_LOGE("Get end property failed"); return NapiGetUndefined(env); } bool isEndOk = ConvertFromJsValue(env, tempValue, end); - if (!(isStartOk && isEndOk && argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], wstyle) && + if (!(isStartOk && isEndOk && argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], wstyle) && argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], hstyle))) { TEXT_LOGE("Failed to convert, start ok:%{public}d, end ok:%{public}d", isStartOk, isEndOk); return NapiGetUndefined(env); @@ -459,7 +459,7 @@ napi_value JsParagraph::OnGetGlyphPositionAtCoordinate(napi_env env, napi_callba } double dx = 0.0; double dy = 0.0; - if (!(argv[0] != nullptr && ConvertFromJsValue(env, argv[0], dx) && argv[1] != nullptr && + if (!(argv[0] != nullptr && ConvertFromJsValue(env, argv[0], dx) && argv[1] != nullptr && ConvertFromJsValue(env, argv[1], dy))) { TEXT_LOGE("Failed to convert"); return NapiGetUndefined(env); @@ -689,7 +689,7 @@ napi_value JsParagraph::OnGetFontMetricsByTextStyle(napi_env env, napi_callback_ napi_value argv[ARGC_ONE] = {nullptr}; napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); if (status != napi_ok || argc < ARGC_ONE) { - TEXT_LOGE("Argc is invalid: %{public}zu",argc); + TEXT_LOGE("Argc is invalid: %{public}zu", argc); return NapiThrowError(env, TextErrorCode::ERROR_INVALID_PARAM, "Invalid params."); } TextStyle textStyle; @@ -718,7 +718,7 @@ napi_value JsParagraph::OnGetLineFontMetrics(napi_env env, napi_callback_info in napi_value argv[ARGC_ONE] = {nullptr}; napi_status status = napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); if (status != napi_ok || argc < ARGC_ONE) { - TEXT_LOGE("Argc is invalid: %{public}zu",argc); + TEXT_LOGE("Argc is invalid: %{public}zu", argc); return NapiThrowError(env, TextErrorCode::ERROR_INVALID_PARAM, "Invalid params."); } int lineNumber = 0; diff --git a/interfaces/kits/napi/graphic/text/run_napi/js_run.cpp b/interfaces/kits/napi/graphic/text/run_napi/js_run.cpp index b92522fbe9..46285a54b4 100644 --- a/interfaces/kits/napi/graphic/text/run_napi/js_run.cpp +++ b/interfaces/kits/napi/graphic/text/run_napi/js_run.cpp @@ -302,7 +302,7 @@ napi_value JsRun::OnPaint(napi_env env, napi_callback_info info) double y = 0.0; napi_unwrap(env, argv[0], reinterpret_cast(&jsCanvas)); if (!jsCanvas || !jsCanvas->GetCanvas() || - !(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) && + !(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) && argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], y))) { TEXT_LOGE("Failed to get paint parameter"); return NapiGetUndefined(env); diff --git a/interfaces/kits/napi/graphic/text/text_line_napi/js_text_line.cpp b/interfaces/kits/napi/graphic/text/text_line_napi/js_text_line.cpp index 8d9b0530ba..65c3a7ba30 100644 --- a/interfaces/kits/napi/graphic/text/text_line_napi/js_text_line.cpp +++ b/interfaces/kits/napi/graphic/text/text_line_napi/js_text_line.cpp @@ -282,7 +282,7 @@ napi_value JsTextLine::OnPaint(napi_env env, napi_callback_info info) } double x = 0.0; double y = 0.0; - if (!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) && + if (!(argv[ARGC_ONE] != nullptr && ConvertFromJsValue(env, argv[ARGC_ONE], x) && argv[ARGC_TWO] != nullptr && ConvertFromJsValue(env, argv[ARGC_TWO], y))) { return NapiGetUndefined(env); } diff --git a/interfaces/kits/napi/graphic/text/utils/napi_common.cpp b/interfaces/kits/napi/graphic/text/utils/napi_common.cpp index 0824806e20..3ac1d0bd29 100644 --- a/interfaces/kits/napi/graphic/text/utils/napi_common.cpp +++ b/interfaces/kits/napi/graphic/text/utils/napi_common.cpp @@ -361,7 +361,7 @@ bool GetParagraphStyleFromJS(napi_env env, napi_value argValue, TypographyStyle& if (tempValue != nullptr && napi_get_value_uint32(env, tempValue, &textDirection) == napi_ok) { pographyStyle.textDirection = TextDirection(textDirection); } - SetAlignValueForParagraphStyle(env, argValue,pographyStyle); + SetAlignValueForParagraphStyle(env, argValue, pographyStyle); tempValue = nullptr; napi_get_named_property(env, argValue, "wordBreak", &tempValue); uint32_t wordBreak = 0; diff --git a/rosen/modules/texgine/src/font_descriptor_cache.cpp b/rosen/modules/texgine/src/font_descriptor_cache.cpp index 01b710f70a..a96f2217bc 100644 --- a/rosen/modules/texgine/src/font_descriptor_cache.cpp +++ b/rosen/modules/texgine/src/font_descriptor_cache.cpp @@ -221,7 +221,7 @@ bool FontDescriptorCache::ProcessSystemFontType(const int32_t& systemFontType, i } void FontDescriptorCache::GetSystemFontFullNamesByType( - const int32_t &systemFontType,std::unordered_set &fontList) + const int32_t &systemFontType, std::unordered_set &fontList) { int32_t fontType = 0; if (!ProcessSystemFontType(systemFontType, fontType)) { diff --git a/rosen/modules/texgine/src/font_parser.cpp b/rosen/modules/texgine/src/font_parser.cpp index b9a4770356..f1ae74bcf9 100644 --- a/rosen/modules/texgine/src/font_parser.cpp +++ b/rosen/modules/texgine/src/font_parser.cpp @@ -109,7 +109,7 @@ void FontParser::SetNameString(FontParser::FontDescriptor& fontDescriptor, std:: { bool willSet = field.empty(); if (!willSet) { - willSet = languageId == fontDescriptor.requestedLid || + willSet = languageId == fontDescriptor.requestedLid || (fieldLid != fontDescriptor.requestedLid && languageId == LANGUAGE_DEFAULT); } diff --git a/rosen/modules/texgine/src/opentype_parser/ranges.cpp b/rosen/modules/texgine/src/opentype_parser/ranges.cpp index 23d829b2c0..39ea92bc1c 100644 --- a/rosen/modules/texgine/src/opentype_parser/ranges.cpp +++ b/rosen/modules/texgine/src/opentype_parser/ranges.cpp @@ -50,7 +50,7 @@ void Ranges::Dump() const for (const auto &[start, end, gid] : ranges_) { LOGSO_FUNC_LINE(INFO) << "0x" << std::uppercase << std::hex << std::setw(4) << std::setfill('0') << start //4 means output width - << " ~ 0x" << std::uppercase << std::hex + << " ~ 0x" << std::uppercase << std::hex << std::setw(4) << std::setfill('0') << end //4 means output width << ": offset " << std::dec << end; }