From 961ebc2ad5ab6a839f2746ee5ca3d0739620d09d Mon Sep 17 00:00:00 2001 From: JasonYujia Date: Tue, 26 Oct 2021 08:02:13 +0000 Subject: [PATCH] Modify reviewbot of display Signed-off-by: JasonYujia --- .../display_device/hdi_gfx_composition.cpp | 34 +++++++++---------- .../src/display_device/hdi_gfx_composition.h | 6 ++-- .../src/display_gralloc/display_gralloc.c | 4 +-- .../standard/display_gfx/display_gfx_test.cpp | 34 +++++++++---------- 4 files changed, 39 insertions(+), 39 deletions(-) diff --git a/display/hal/default_standard/src/display_device/hdi_gfx_composition.cpp b/display/hal/default_standard/src/display_device/hdi_gfx_composition.cpp index f3899fafeb..ee2c238d5c 100644 --- a/display/hal/default_standard/src/display_device/hdi_gfx_composition.cpp +++ b/display/hal/default_standard/src/display_device/hdi_gfx_composition.cpp @@ -41,24 +41,24 @@ int32_t HdiGfxComposition::GfxModuleInit(void) { DISPLAY_LOGD(); mGfxModule = dlopen(LIB_HDI_GFX_NAME, RTLD_NOW | RTLD_NOLOAD); - if (mGfxModule != nullptr) { - DISPLAY_LOGI("Module '%{public}s' already loaded", LIB_HDI_GFX_NAME); - } else { - DISPLAY_LOGI("Loading module '%{public}s'", LIB_HDI_GFX_NAME); - mGfxModule = dlopen(LIB_HDI_GFX_NAME, RTLD_NOW); - if (mGfxModule == nullptr) { - DISPLAY_LOGE("Failed to load module: %{public}s", dlerror()); - return DISPLAY_FAILURE; - } - } + if (mGfxModule != nullptr) { + DISPLAY_LOGI("Module '%{public}s' already loaded", LIB_HDI_GFX_NAME); + } else { + DISPLAY_LOGI("Loading module '%{public}s'", LIB_HDI_GFX_NAME); + mGfxModule = dlopen(LIB_HDI_GFX_NAME, RTLD_NOW); + if (mGfxModule == nullptr) { + DISPLAY_LOGE("Failed to load module: %{public}s", dlerror()); + return DISPLAY_FAILURE; + } + } - typedef int32_t (*InitFunc)(GfxFuncs **funcs); + using InitFunc = int32_t (*)(GfxFuncs **funcs); InitFunc func = reinterpret_cast(dlsym(mGfxModule, LIB_GFX_FUNC_INIT)); if (func == nullptr) { - DISPLAY_LOGE("Failed to lookup %{public}s function: %s", LIB_GFX_FUNC_INIT, dlerror()); - dlclose(mGfxModule); - return DISPLAY_FAILURE; - } + DISPLAY_LOGE("Failed to lookup %{public}s function: %s", LIB_GFX_FUNC_INIT, dlerror()); + dlclose(mGfxModule); + return DISPLAY_FAILURE; + } return func(&mGfxFuncs); } @@ -67,7 +67,7 @@ int32_t HdiGfxComposition::GfxModuleDeinit(void) DISPLAY_LOGD(); int32_t ret = DISPLAY_SUCCESS; if (mGfxModule == nullptr) { - typedef int32_t (*DeinitFunc)(GfxFuncs *funcs); + using DeinitFunc = int32_t (*)(GfxFuncs *funcs); DeinitFunc func = reinterpret_cast(dlsym(mGfxModule, LIB_GFX_FUNC_DEINIT)); if (func == nullptr) { DISPLAY_LOGE("Failed to lookup %{public}s function: %s", LIB_GFX_FUNC_DEINIT, dlerror()); @@ -117,7 +117,7 @@ void HdiGfxComposition::InitGfxSurface(ISurface &surface, HdiLayerBuffer &buffer surface.bAlphaMax255 = true; surface.alpha0 = 0XFF; surface.alpha1 = 0XFF; - DISPLAY_LOGD("surface info w: %{public}d h: %{public}d addr: 0x%{public}" PRIx64 " fmt %{public}d stride %{public}d", + DISPLAY_LOGD("surface w:%{public}d h:%{public}d addr:0x%{public}" PRIx64 " fmt:%{public}d stride:%{public}d", surface.width, surface.height, surface.phyAddr, surface.enColorFmt, surface.stride); } diff --git a/display/hal/default_standard/src/display_device/hdi_gfx_composition.h b/display/hal/default_standard/src/display_device/hdi_gfx_composition.h index ecb368fc40..7d09be44c9 100644 --- a/display/hal/default_standard/src/display_device/hdi_gfx_composition.h +++ b/display/hal/default_standard/src/display_device/hdi_gfx_composition.h @@ -22,9 +22,9 @@ namespace HDI { namespace DISPLAY { class HdiGfxComposition : public HdiComposition { public: - int32_t Init(void); - int32_t SetLayers(std::vector &layers, HdiLayer &clientLayer); - int32_t Apply(bool modeSet); + int32_t Init(void) override; + int32_t SetLayers(std::vector &layers, HdiLayer &clientLayer) override; + int32_t Apply(bool modeSet) override; virtual ~HdiGfxComposition() { (void)GfxModuleDeinit(); diff --git a/display/hal/default_standard/src/display_gralloc/display_gralloc.c b/display/hal/default_standard/src/display_gralloc/display_gralloc.c index 9807360c55..932d11bd9c 100644 --- a/display/hal/default_standard/src/display_gralloc/display_gralloc.c +++ b/display/hal/default_standard/src/display_gralloc/display_gralloc.c @@ -106,9 +106,9 @@ int32_t GrallocInitialize(GrallocFuncs **funcs) int ret; DISPLAY_CHK_RETURN((funcs == NULL), DISPLAY_PARAM_ERR, DISPLAY_LOGE("funcs is null")); GrallocFuncs *grallocFuncs = (GrallocFuncs *)malloc(sizeof(GrallocFuncs)); - DISPLAY_CHK_RETURN((grallocFuncs == NULL), DISPLAY_PARAM_ERR, DISPLAY_LOGE("memset_s failed")); + DISPLAY_CHK_RETURN((grallocFuncs == NULL), DISPLAY_NULL_PTR, DISPLAY_LOGE("memset_s failed")); errno_t eok = memset_s(grallocFuncs, sizeof(GrallocFuncs), 0, sizeof(GrallocFuncs)); - DISPLAY_CHK_RETURN((eok != EOK), DISPLAY_PARAM_ERR, DISPLAY_LOGE("memset_s failed")); + DISPLAY_CHK_RETURN((eok != EOK), DISPLAY_FAILURE, DISPLAY_LOGE("memset_s failed")); // initialize gbm gralloc #ifdef GRALLOC_GBM_SUPPORT ret = GbmGrallocInitialize(); diff --git a/display/test/unittest/standard/display_gfx/display_gfx_test.cpp b/display/test/unittest/standard/display_gfx/display_gfx_test.cpp index c1c0e84350..68a675d692 100644 --- a/display/test/unittest/standard/display_gfx/display_gfx_test.cpp +++ b/display/test/unittest/standard/display_gfx/display_gfx_test.cpp @@ -292,24 +292,24 @@ void GfxTestBase::DeInitTestBuffer() int32_t GfxTestBase::GfxTestModuleInit(void) { mGfxTestModule = dlopen(LIB_HDI_GFX_NAME, RTLD_NOW | RTLD_NOLOAD); - if (mGfxTestModule != nullptr) { - DISPLAY_TEST_LOGD("Module %s already loaded", LIB_HDI_GFX_NAME); - } else { - DISPLAY_TEST_LOGD("Loading module %s", LIB_HDI_GFX_NAME); - mGfxTestModule = dlopen(LIB_HDI_GFX_NAME, RTLD_NOW); - if (mGfxTestModule == nullptr) { - DISPLAY_TEST_LOGE("Failed to load module: %s", dlerror()); - return DISPLAY_FAILURE; - } - } - - typedef int32_t (*InitFunc)(GfxFuncs **funcs); + if (mGfxTestModule != nullptr) { + DISPLAY_TEST_LOGD("Module %s already loaded", LIB_HDI_GFX_NAME); + } else { + DISPLAY_TEST_LOGD("Loading module %s", LIB_HDI_GFX_NAME); + mGfxTestModule = dlopen(LIB_HDI_GFX_NAME, RTLD_NOW); + if (mGfxTestModule == nullptr) { + DISPLAY_TEST_LOGE("Failed to load module: %s", dlerror()); + return DISPLAY_FAILURE; + } + } + + using InitFunc = int32_t (*)(GfxFuncs **funcs); InitFunc func = reinterpret_cast(dlsym(mGfxTestModule, LIB_GFX_FUNC_INIT)); if (func == nullptr) { - DISPLAY_TEST_LOGE("Failed to lookup %s function: %s", LIB_GFX_FUNC_INIT, dlerror()); - dlclose(mGfxTestModule); - return DISPLAY_FAILURE; - } + DISPLAY_TEST_LOGE("Failed to lookup %s function: %s", LIB_GFX_FUNC_INIT, dlerror()); + dlclose(mGfxTestModule); + return DISPLAY_FAILURE; + } return func(&mGfxFuncs); } @@ -317,7 +317,7 @@ int32_t GfxTestBase::GfxTestModuleDeinit(void) { int32_t ret = DISPLAY_SUCCESS; if (mGfxTestModule == nullptr) { - typedef int32_t (*DeinitFunc)(GfxFuncs *funcs); + using DeinitFunc = int32_t (*)(GfxFuncs *funcs); DeinitFunc func = reinterpret_cast(dlsym(mGfxTestModule, LIB_GFX_FUNC_DEINIT)); if (func == nullptr) { DISPLAY_TEST_LOGE("Failed to lookup %s function: %s", LIB_GFX_FUNC_DEINIT, dlerror()); -- Gitee