From c02d35ad7a7127057de7d0189b0d3c5baccaaa45 Mon Sep 17 00:00:00 2001 From: bwx1095090 Date: Tue, 25 Oct 2022 11:11:56 +0800 Subject: [PATCH] =?UTF-8?q?Codecheck=20=E6=95=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: bwx1095090 --- .../common/platform/threadpool/include/aie_thread_unix.h | 2 +- .../common/platform/threadpool/source/aie_thread_unix.cpp | 8 ++++---- test/common/dl_operation/dl_operation_test.cpp | 2 +- test/common/threadpool/thread_pool_test.cpp | 2 +- test/function/plugin_label/plugin_label_test.cpp | 4 ++-- test/function/prepare/prepare_function_test.cpp | 4 ++-- test/function/sa_client/sa_client_test.cpp | 4 ++-- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/services/common/platform/threadpool/include/aie_thread_unix.h b/services/common/platform/threadpool/include/aie_thread_unix.h index a04e3ba..51f7cd1 100755 --- a/services/common/platform/threadpool/include/aie_thread_unix.h +++ b/services/common/platform/threadpool/include/aie_thread_unix.h @@ -30,7 +30,7 @@ extern "C" { #define THREAD_DEFAULT_STACK_SIZE 0 typedef struct { - size_t stack_size; + size_t stackSize; int scope; } PthreadAttr; diff --git a/services/common/platform/threadpool/source/aie_thread_unix.cpp b/services/common/platform/threadpool/source/aie_thread_unix.cpp index 08585bf..f9a5137 100644 --- a/services/common/platform/threadpool/source/aie_thread_unix.cpp +++ b/services/common/platform/threadpool/source/aie_thread_unix.cpp @@ -51,13 +51,13 @@ bool IsThreadRunning(unsigned long tid) void InitThreadAttr(PthreadAttr &attr) { - attr.stack_size = THREAD_DEFAULT_STACK_SIZE; + attr.stackSize = THREAD_DEFAULT_STACK_SIZE; attr.scope = THREAD_SCOPE_SYSTEM; } void SetThreadAttrStackSize(PthreadAttr &attr, size_t size) { - attr.stack_size = size; + attr.stackSize = size; } void SetThreadAttrScope(PthreadAttr &attr, int32_t scope) @@ -80,8 +80,8 @@ int CreateOneThread(PthreadData &tr, PthreadAttr *attr, PthreadRoutine func, voi pthread_attr_setscope(&pthreadAttr, PTHREAD_SCOPE_SYSTEM); } - if (attr != nullptr && attr->stack_size > 0) { - pthread_attr_setstacksize(&pthreadAttr, attr->stack_size); + if (attr != nullptr && attr->stackSize > 0) { + pthread_attr_setstacksize(&pthreadAttr, attr->stackSize); } pthread_attr_setdetachstate(&pthreadAttr, PTHREAD_CREATE_JOINABLE); diff --git a/test/common/dl_operation/dl_operation_test.cpp b/test/common/dl_operation/dl_operation_test.cpp index f99c701..efc9a3d 100644 --- a/test/common/dl_operation/dl_operation_test.cpp +++ b/test/common/dl_operation/dl_operation_test.cpp @@ -56,7 +56,7 @@ HWTEST_F(DlOperationTest, TestDlOption001, TestSize.Level1) void *handle = AieDlopen(TEST_SO_PATH); HILOGD("[Test]Begin to excute handle."); ASSERT_NE(handle, nullptr); - FUNC_ADD addFunc = (FUNC_ADD)AieDlsym(handle, "AddFunc"); + FUNC_ADD addFunc = reinterpret_cast(AieDlsym(handle, "AddFunc")); ASSERT_NE(addFunc, nullptr); int result = addFunc(AIE_NUM1, AIE_NUM2); ASSERT_EQ(result, AIE_RESULT); diff --git a/test/common/threadpool/thread_pool_test.cpp b/test/common/threadpool/thread_pool_test.cpp index 8c6e885..3a7b7ef 100755 --- a/test/common/threadpool/thread_pool_test.cpp +++ b/test/common/threadpool/thread_pool_test.cpp @@ -121,7 +121,7 @@ HWTEST_F(ThreadPoolTest, TestWorker001, TestSize.Level1) ASSERT_FALSE(worker.isHung(HUNG_TIME)); ASSERT_EQ(worker.GetStackSize(), THREAD_DEFAULT_STACK_SIZE); ASSERT_EQ(worker.Status(), 0); - ASSERT_EQ((int)worker.GetThreadId(), INVALID_THREAD_ID); + ASSERT_EQ(static_cast(worker.GetThreadId()), INVALID_THREAD_ID); Thread thread; worker.SetThread(&thread); HILOGD("[Test]Test worker end, GetThreadId is %lu.", worker.GetThreadId()); diff --git a/test/function/plugin_label/plugin_label_test.cpp b/test/function/plugin_label/plugin_label_test.cpp index c3f7afa..557afab 100644 --- a/test/function/plugin_label/plugin_label_test.cpp +++ b/test/function/plugin_label/plugin_label_test.cpp @@ -27,7 +27,7 @@ using namespace testing::ext; namespace { const std::string AID_DEMO_PLUGIN_SYNC = "cv_card_rectification"; - long long AID_DEMO_PLUGIN_VERSION = 20001001; + long long AID_DEMO_PLUGIN_VERSION = 20001001; } class PluginLabelTest : public testing::Test { @@ -68,5 +68,5 @@ static HWTEST_F(PluginLabelTest, TestPluginLabel001, TestSize.Level0) { HILOGI("[Test]TestPluginLabel001."); std::string libPath; - TestPluginLabel(AID_DEMO_PLUGIN_SYNC, AID_DEMO_PLUGIN_VERSION, libPath); + TestPluginLabel(AID_DEMO_PLUGIN_SYNC, AID_DEMO_PLUGIN_VERSION , libPath); } \ No newline at end of file diff --git a/test/function/prepare/prepare_function_test.cpp b/test/function/prepare/prepare_function_test.cpp index f2e4579..1dde977 100644 --- a/test/function/prepare/prepare_function_test.cpp +++ b/test/function/prepare/prepare_function_test.cpp @@ -444,8 +444,8 @@ HWTEST_F(PrepareFunctionTest, TestCallback002, TestSize.Level1) static HWTEST_F(PrepareFunctionTest, TestRegisterCallbackProxy001, TestSize.Level1) { HILOGI("[Test]TestRegisterCallbackProxy001."); - const char *str = PREPARE_INPUT_ASYNC; - char *inputData = const_cast(str); + char *str = "Async prepare inputData"; + char *inputData = str; int len = strlen(str) + 1; ConfigInfo configInfo {.description = CONFIG_DESCRIPTION}; diff --git a/test/function/sa_client/sa_client_test.cpp b/test/function/sa_client/sa_client_test.cpp index af0f501..f4e1a5e 100644 --- a/test/function/sa_client/sa_client_test.cpp +++ b/test/function/sa_client/sa_client_test.cpp @@ -26,7 +26,7 @@ using namespace OHOS::AI; using namespace testing::ext; namespace { - char INPUT_CHARACTER[] = "inputData"; + const char * INPUT_CHARACTER = "inputData"; const char * const CONFIG_DESCRIPTION = "config information"; const long long CLIENT_INFO_VERSION = 1; const int CLIENT_ID = -1; @@ -65,7 +65,7 @@ static HWTEST_F(SaClientTest, TestSaClient001, TestSize.Level0) HILOGI("[Test]TestSaClient001."); ConfigInfo configInfo {.description = CONFIG_DESCRIPTION}; - char *inputData = INPUT_CHARACTER; + const char *inputData = const_cast(INPUT_CHARACTER); int len = strlen(inputData) + 1; ClientInfo clientInfo = { -- Gitee