diff --git a/ai/cv/image_classification/resize_computer.cpp b/ai/cv/image_classification/resize_computer.cpp index c119b5ca2a0e849fe27e10fcb8094e2cc38d57cb..d01aac63a10267e9f64ca058974be8c55e34f85a 100644 --- a/ai/cv/image_classification/resize_computer.cpp +++ b/ai/cv/image_classification/resize_computer.cpp @@ -13,8 +13,8 @@ * limitations under the License. */ -#include "ic_retcode.h" #include "resize_computer.h" +#include "ic_retcode.h" namespace IC { const int RESIZE_CONSTANT = 2; diff --git a/launcher/launcher/src/main/cpp/app_manage.cpp b/launcher/launcher/src/main/cpp/app_manage.cpp index 8cfd7fa51ad015e64706aa2bf13aecc3256e19aa..d3cf1b7ab556355579f53e4e94a1d719bd0f4d7b 100755 --- a/launcher/launcher/src/main/cpp/app_manage.cpp +++ b/launcher/launcher/src/main/cpp/app_manage.cpp @@ -42,16 +42,16 @@ bool AppManage::GetAailityInfosByBundleName(const char* bundleName, AppInfo* pAp BundleInfo* pBundleInfo = pBundleInfos; for (int i = 0; i < count; i++, pBundleInfo++) { if (memcmp(bundleName, pBundleInfo->bundleName, strlen(pBundleInfo->bundleName)) == 0) { - memcpy_s( + (void)memcpy_s( pApp->appName_, sizeof(pApp->appName_), pBundleInfo->bundleName, strlen(pBundleInfo->bundleName)); pApp->appName_[strlen(pBundleInfo->bundleName)] = 0; if (pBundleInfo->abilityInfos[0].name) { - memcpy_s(pApp->abilityName_, sizeof(pApp->abilityName_), pBundleInfo->abilityInfos[0].name, + (void)memcpy_s(pApp->abilityName_, sizeof(pApp->abilityName_), pBundleInfo->abilityInfos[0].name, strlen(pBundleInfo->abilityInfos[0].name)); pApp->abilityName_[strlen(pBundleInfo->abilityInfos[0].name)] = 0; } if (pBundleInfo->bigIconPath) { - memcpy_s(pApp->appIconDir_, sizeof(pApp->appIconDir_), pBundleInfo->bigIconPath, + (void)memcpy_s(pApp->appIconDir_, sizeof(pApp->appIconDir_), pBundleInfo->bigIconPath, strlen(pBundleInfo->bigIconPath)); pApp->appIconDir_[strlen(pBundleInfo->bigIconPath)] = 0; } @@ -106,7 +106,7 @@ void AppManage::MyBundleStateCallback( void AppManage::MyBundleOwnCallback(const uint8_t resultCode, const void* resultMessage) { - // todo uninstall callback + // uninstall callback } bool AppManage::LauncherApp(BundleInfo** info, int& count) diff --git a/launcher/launcher/src/main/cpp/swipe_view.cpp b/launcher/launcher/src/main/cpp/swipe_view.cpp index 1fe53480ca7d84d98dcc2c574f0d1dd7af9f1a4b..785973ee6341d52a35319d4cda5206c64b5d9281 100755 --- a/launcher/launcher/src/main/cpp/swipe_view.cpp +++ b/launcher/launcher/src/main/cpp/swipe_view.cpp @@ -59,6 +59,9 @@ UIViewGroup* SwipeView::AddViewGroup() return nullptr; } UIViewGroup* viewGroup = new UIViewGroup(); + if (viewGroup == nullptr) { + return viewGroup; + } viewGroup->SetPosition(0, LABLE_TITLE_HEIGHT, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight() - LABLE_TITLE_HEIGHT - LABLE_TAIL_HEIGHT); viewGroup->SetStyle(STYLE_BACKGROUND_OPA, TOTAL_OPACITY); @@ -135,17 +138,17 @@ void SwipeView::OnSetUpView() app->funcclick_ = AppEvent::ClickEvent; app->funclPress_ = AppEvent::LongPressEvent; if (pBundleInfos[j].bundleName) { - memcpy_s(app->appName_, sizeof(app->appName_), pBundleInfos[j].bundleName, + (void)memcpy_s(app->appName_, sizeof(app->appName_), pBundleInfos[j].bundleName, strlen(pBundleInfos[j].bundleName)); app->appName_[strlen(pBundleInfos[j].bundleName)] = 0; } if (pBundleInfos[j].abilityInfos[0].name) { - memcpy_s(app->abilityName_, sizeof(app->abilityName_), pBundleInfos[j].abilityInfos[0].name, + (void)memcpy_s(app->abilityName_, sizeof(app->abilityName_), pBundleInfos[j].abilityInfos[0].name, strlen(pBundleInfos[j].abilityInfos[0].name)); app->abilityName_[strlen(pBundleInfos[j].abilityInfos[0].name)] = 0; } if (pBundleInfos[j].bigIconPath) { - memcpy_s(app->appIconDir_, sizeof(app->appIconDir_), pBundleInfos[j].bigIconPath, + (void)memcpy_s(app->appIconDir_, sizeof(app->appIconDir_), pBundleInfos[j].bigIconPath, strlen(pBundleInfos[j].bigIconPath)); app->appIconDir_[strlen(pBundleInfos[j].bigIconPath)] = 0; } diff --git a/launcher/launcher/src/main/cpp/swipe_view.h b/launcher/launcher/src/main/cpp/swipe_view.h index 4b100ca58aee9f3bae4bcbad2dd09e167438c821..6034ae823be0e7dba9dd15b4761846af5c342bdc 100755 --- a/launcher/launcher/src/main/cpp/swipe_view.h +++ b/launcher/launcher/src/main/cpp/swipe_view.h @@ -56,7 +56,9 @@ public: virtual void OnSwipe(UISwipeView& view) override { char buf[TMP_BUF_SIZE] = { 0 }; - sprintf_s(buf, sizeof(buf), ".%d.", swipe_->GetCurrentPage() + 1); + if (sprintf_s(buf, sizeof(buf), ".%d.", swipe_->GetCurrentPage() + 1) < 0) { + return; + } lable_->SetText(buf); view_->RemoveLview(); } diff --git a/launcher/launcher/src/main/cpp/time_weather_view.cpp b/launcher/launcher/src/main/cpp/time_weather_view.cpp index d5b7b5ef66589edc257f963bcc2878909f39775f..b63619a4564a3287d15f4fb3be4cbb6a9b3a6a24 100755 --- a/launcher/launcher/src/main/cpp/time_weather_view.cpp +++ b/launcher/launcher/src/main/cpp/time_weather_view.cpp @@ -33,10 +33,7 @@ TimeWeatherView::TimeWeatherView(UIViewGroup* viewGroup) { viewGroup_ = viewGroup; } -TimeWeatherView::~TimeWeatherView() -{ - // todo other release -} +TimeWeatherView::~TimeWeatherView() {} void TimeWeatherView::SetStyle(Style sty) { diff --git a/setting/setting/src/main/cpp/app_ability_slice.cpp b/setting/setting/src/main/cpp/app_ability_slice.cpp index e5873edb7b5c2232a87240674964b21f51eb6388..da1c662fb187dd492003c7ee973b987dba492b3e 100755 --- a/setting/setting/src/main/cpp/app_ability_slice.cpp +++ b/setting/setting/src/main/cpp/app_ability_slice.cpp @@ -144,7 +144,6 @@ void AppAbilitySlice::SetAnAppInfo(const int count, BundleInfo& pBundleInfo) itemView->Add(imageView); } - void AppAbilitySlice::SetScrollView() { scrollView_ = new UIScrollView(); diff --git a/setting/setting/src/main/cpp/app_info_ability_slice.cpp b/setting/setting/src/main/cpp/app_info_ability_slice.cpp index 16c34add051ec984945d073ba1a88b6f547fa763..947292a2b53f1438440f8577463f3d29eb778e6f 100755 --- a/setting/setting/src/main/cpp/app_info_ability_slice.cpp +++ b/setting/setting/src/main/cpp/app_info_ability_slice.cpp @@ -70,10 +70,10 @@ void AppInfoAbilitySlice::SetHead() imageView->SetPosition(DE_HEAD_IMAGE_X, DE_HEAD_IMAGE_Y, DE_HEAD_IMAGE_WIDTH, DE_HEAD_IMAGE_HEIGHT); imageView->SetSrc(DE_IMAGE_BACK); - printf("[LOG] bundleName_-> %s +11->%s \n", bundleName_, bundleName_ + 11); // 11 + printf("[LOG] bundleName_-> %s +11->%s \n", bundleName_, bundleName_ + 11); // 11:jump behind bundleName UILabel* lablelFont = new UILabel(); lablelFont->SetPosition(DE_HEAD_TEXT_X, DE_HEAD_TEXT_Y, DE_HEAD_TEXT_WIDTH, DE_HEAD_TEXT_HEIGHT); - lablelFont->SetText(bundleName_ + 11); // use 11 + lablelFont->SetText(bundleName_ + 11); // 11:jump behind bundleName lablelFont->SetFont(DE_FONT_OTF, DE_HEAD_TEXT_SIZE); lablelFont->SetStyle(STYLE_TEXT_COLOR, DE_HEAD_TEXT_COLOR); headView_->Add(lablelFont); @@ -82,6 +82,9 @@ void AppInfoAbilitySlice::SetHead() void AppInfoAbilitySlice::SetAppPermissionInfo(int index, PermissionSaved& permissions) { UIViewGroup* itemView = new UIViewGroup(); + if (itemView == nullptr) { + return; + } int useX = 0; int useY = index * DE_ITEM_INTERVAL; itemView->SetPosition(useX, useY, DE_BUTTON_WIDTH, DE_BUTTON_HEIGHT); diff --git a/setting/setting/src/main/cpp/main_ability_slice.cpp b/setting/setting/src/main/cpp/main_ability_slice.cpp index d0ac8237b046d3954ac44e99aad585874c3f5136..f59d47bfb2f9ef2f8021bda95fa66a3a10bb9ef9 100755 --- a/setting/setting/src/main/cpp/main_ability_slice.cpp +++ b/setting/setting/src/main/cpp/main_ability_slice.cpp @@ -173,7 +173,7 @@ void MainAbilitySlice::SetWifiButtonView(void) lablelFontWifi->SetStyle(STYLE_TEXT_COLOR, DE_TITLE_TEXT_COLOR); buttonView->Add(lablelFontWifi); - char buff[64] = {0}; + char buff[64] = {0}; // 64 is the longest in this sample int myX = WIFI_BUTTON_TEXT_SSID_X; int myY = WIFI_BUTTON_TEXT_SSID_Y; int ret = GetCurrentConnInfo(buff, sizeof(buff)); @@ -269,7 +269,7 @@ void MainAbilitySlice::SetAboutButtonView(void) lablelFontAbout->SetStyle(STYLE_TEXT_COLOR, DE_TITLE_TEXT_COLOR); buttonView->Add(lablelFontAbout); - char buff[62]; + char buff[62]; // 62 is the longest in this sample const char* gDV = GetDisplayVersion(); int err = sprintf_s(buff, sizeof(buff), "系统版本: %s", gDV); if (err < 0) { diff --git a/setting/setting/src/main/cpp/setting_display_ability_slice.cpp b/setting/setting/src/main/cpp/setting_display_ability_slice.cpp index 9ad7b5a816950a90aa7ca30f5dcd8bb69b6a219e..5b70ba16753bb71f5c0bb076b0d1ad993a9d325a 100755 --- a/setting/setting/src/main/cpp/setting_display_ability_slice.cpp +++ b/setting/setting/src/main/cpp/setting_display_ability_slice.cpp @@ -22,10 +22,6 @@ namespace OHOS { REGISTER_AS(SettingDisplayAbilitySlice) -#define COM_SET_ON 0 -#define COM_SET_OFF 1 -#define COM_GET_STATUS 2 - SettingDisplayAbilitySlice::~SettingDisplayAbilitySlice() { if (toggleButtonView_) { diff --git a/setting/setting/src/main/cpp/wpa_work.c b/setting/setting/src/main/cpp/wpa_work.c index 9b23390b2b5af61272c788fc69237feb43f7fc81..a3170e8b927cbddfefd82e1dfa527d0b2f907602 100755 --- a/setting/setting/src/main/cpp/wpa_work.c +++ b/setting/setting/src/main/cpp/wpa_work.c @@ -56,9 +56,7 @@ static void DumpString(const char *buf, int len, const char *tag) for (int i = 0; i < len; i++) { printf("%c", buf[i]); } - printf("\n"); - - printf("\n"); + printf("\n\n"); SAMPLE_INFO("%s dump end.", tag); }