From 0924c48b384d5b15f25cc7af6ab149561c2ce8be Mon Sep 17 00:00:00 2001 From: bwx1095090 Date: Tue, 25 Oct 2022 11:11:56 +0800 Subject: [PATCH 1/2] =?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 | 5 +++-- test/function/sa_client/sa_client_test.cpp | 4 ++-- 5 files changed, 11 insertions(+), 10 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..b6aa4e5 100755 --- a/test/common/threadpool/thread_pool_test.cpp +++ b/test/common/threadpool/thread_pool_test.cpp @@ -82,7 +82,8 @@ public: const char *GetName() const override { - return workerName_.c_str(); + const char *name = workerName_.c_str(); + return name; } bool OneAction() override @@ -121,7 +122,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/sa_client/sa_client_test.cpp b/test/function/sa_client/sa_client_test.cpp index af0f501..7e9bbef 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 = INPUT_CHARACTER; int len = strlen(inputData) + 1; ClientInfo clientInfo = { -- Gitee From c21572d5742b4dc78389319491cff193db59d363 Mon Sep 17 00:00:00 2001 From: bwx1095090 Date: Mon, 31 Oct 2022 17:39:55 +0800 Subject: [PATCH 2/2] =?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 --- .../feature/source/norm_processor.cpp | 6 +-- .../feature/source/slide_window_processor.cpp | 2 +- .../utils/encdec/source/data_encoder.cpp | 2 +- .../keyword_spotting/source/kws_plugin.cpp | 4 +- test/common/semaphore/semaphore_test.cpp | 4 +- .../async_process_function_test.cpp | 10 ++--- .../destroy/destroy_function_test.cpp | 26 ++++++------- test/function/init/init_function_test.cpp | 24 ++++++------ .../prepare/prepare_function_test.cpp | 38 +++++++++---------- .../release/release_function_test.cpp | 24 ++++++------ test/function/sa_client/sa_client_test.cpp | 4 +- .../set_get_option/option_function_test.cpp | 20 +++++----- .../sync_process_function_test.cpp | 20 +++++----- .../async_process_delay_test.cpp | 7 ++-- .../sync_process/sync_process_delay_test.cpp | 7 ++-- .../aie_client_reliability_test.cpp | 12 +++--- 16 files changed, 104 insertions(+), 106 deletions(-) diff --git a/services/common/platform/os_wrapper/feature/source/norm_processor.cpp b/services/common/platform/os_wrapper/feature/source/norm_processor.cpp index 35b40a0..f4879c2 100644 --- a/services/common/platform/os_wrapper/feature/source/norm_processor.cpp +++ b/services/common/platform/os_wrapper/feature/source/norm_processor.cpp @@ -201,11 +201,9 @@ int32_t NormProcessor::Process(const FeatureData &input, FeatureData &output) converter_->Process(input, output); } float *data = reinterpret_cast(output.data); - float meanVal = 0.0f; - float stdVal = 0.0f; for (size_t i = 0; i < output.size; ++i) { - stdVal = std_[i % config_.numChannels]; - meanVal = mean_[i % config_.numChannels]; + float stdVal = std_[i % config_.numChannels]; + float meanVal = mean_[i % config_.numChannels]; workBuffer_[i] = (std::abs(stdVal) < EPSILON) ? 0.0f : ((data[i] - meanVal) / stdVal) * config_.scale; } output.data = static_cast(workBuffer_); diff --git a/services/common/platform/os_wrapper/feature/source/slide_window_processor.cpp b/services/common/platform/os_wrapper/feature/source/slide_window_processor.cpp index 91d1246..7f08779 100644 --- a/services/common/platform/os_wrapper/feature/source/slide_window_processor.cpp +++ b/services/common/platform/os_wrapper/feature/source/slide_window_processor.cpp @@ -135,7 +135,7 @@ int32_t SlideWindowProcessor::Process(const FeatureData &input, FeatureData &out inputFeature_ += stepSize_; // Post-processing if (bufferSize_ - startIndex_ < stepSize_) { - errno_t retCode = memmove_s(workBuffer_, bufferSize_, inputFeature_, initIndex_); + retCode = memmove_s(workBuffer_, bufferSize_, inputFeature_, initIndex_); if (retCode != EOK) { HILOGE("[SlideWindowProcessor]Fail with memory move. Error code[%d]", retCode); return RETCODE_FAILURE; diff --git a/services/common/utils/encdec/source/data_encoder.cpp b/services/common/utils/encdec/source/data_encoder.cpp index 5608b23..13b7fcf 100755 --- a/services/common/utils/encdec/source/data_encoder.cpp +++ b/services/common/utils/encdec/source/data_encoder.cpp @@ -72,7 +72,7 @@ int DataEncoder::GetSerializedData(DataInfo &dataInfo) return RETCODE_FAILURE; } dataInfo.length = pos_; - dataInfo.data = (unsigned char*)malloc(dataInfo.length); + dataInfo.data = reinterpret_cast(malloc(dataInfo.length)); if (dataInfo.data == nullptr) { return RETCODE_OUT_OF_MEMORY; } diff --git a/services/server/plugin/asr/keyword_spotting/source/kws_plugin.cpp b/services/server/plugin/asr/keyword_spotting/source/kws_plugin.cpp index 91f3ccf..333c045 100644 --- a/services/server/plugin/asr/keyword_spotting/source/kws_plugin.cpp +++ b/services/server/plugin/asr/keyword_spotting/source/kws_plugin.cpp @@ -382,7 +382,7 @@ int32_t KWSPlugin::MakeInference(intptr_t handle, Array &input, PluginC HILOGE("[KWSPlugin]The input size is not equal to the size of model input"); return RETCODE_FAILURE; } - int32_t *inputData = (int32_t *)config.inputAddr; + int32_t *inputData = reinterpret_cast(config.inputAddr); size_t bufferSize = config.inputSize * sizeof(input.data[0]); errno_t retCode = memcpy_s(inputData, bufferSize, input.data, bufferSize); if (retCode != EOK) { @@ -396,7 +396,7 @@ int32_t KWSPlugin::MakeInference(intptr_t handle, Array &input, PluginC } Array result; result.size = config.outputSize; - result.data = (int32_t *)config.outputAddr; + result.data = reinterpret_cast(config.outputAddr); return EncdecFacade::ProcessEncode(outputInfo, handle, result); } diff --git a/test/common/semaphore/semaphore_test.cpp b/test/common/semaphore/semaphore_test.cpp index 19861ed..5a7043a 100644 --- a/test/common/semaphore/semaphore_test.cpp +++ b/test/common/semaphore/semaphore_test.cpp @@ -82,7 +82,9 @@ HWTEST_F(SemaphoreTest, SimpleNotifierTest001, TestSize.Level1) simpleNotifier.AddToBack(itemIn); sleep(INTERVAL_TIME_S); int ret = simpleNotifier.GetFromFront(TIME_OUT, itemOut); - ASSERT_EQ(*itemOut, CONST_VALUE); + if (itemOut != nullptr) { + ASSERT_EQ(*itemOut, CONST_VALUE); + } ASSERT_TRUE(ret); AIE_DELETE(itemIn); } diff --git a/test/function/async_process/async_process_function_test.cpp b/test/function/async_process/async_process_function_test.cpp index d50bce7..d988df3 100644 --- a/test/function/async_process/async_process_function_test.cpp +++ b/test/function/async_process/async_process_function_test.cpp @@ -87,7 +87,7 @@ static void PreBuildInfo(ConfigInfo &configInfo, ClientInfo &clientInfo, Algorit .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)extendMsg, + .extendMsg = reinterpret_cast(extendMsg), }; algoInfo = { @@ -99,7 +99,7 @@ static void PreBuildInfo(ConfigInfo &configInfo, ClientInfo &clientInfo, Algorit .operateId = OPERATE_ID, .requestId = requestId, .extendLen = len, - .extendMsg = (unsigned char*)extendMsg, + .extendMsg = reinterpret_cast(extendMsg), }; } @@ -127,7 +127,7 @@ HWTEST_F(AsyncProcessFunctionTest, TestAieClientAsyncProcess001, TestSize.Level0 const char *str = INPUT_DATA; char *inputData = const_cast(str); int len = strlen(str) + 1; - inputInfo.data = (unsigned char *)inputData; + inputInfo.data = reinterpret_cast(inputData); inputInfo.length = len; ClientCallback callback = ClientCallback(); @@ -173,7 +173,7 @@ HWTEST_F(AsyncProcessFunctionTest, TestAieClientAsyncProcess002, TestSize.Level0 const char *str = INPUT_DATA; char *inputData = const_cast(str); int len = strlen(str) + 1; - inputInfo.data = (unsigned char *)inputData; + inputInfo.data = reinterpret_cast(inputData); inputInfo.length = len; ClientCallback callback = ClientCallback(); @@ -219,7 +219,7 @@ HWTEST_F(AsyncProcessFunctionTest, TestAieClientAsyncProcess003, TestSize.Level0 const char *str = INPUT_DATA; char *inputData = const_cast(str); int len = strlen(str) + 1; - inputInfo.data = (unsigned char *)inputData; + inputInfo.data = reinterpret_cast(inputData); inputInfo.length = len; ClientCallback callback = ClientCallback(); diff --git a/test/function/destroy/destroy_function_test.cpp b/test/function/destroy/destroy_function_test.cpp index 9866db6..467bb75 100644 --- a/test/function/destroy/destroy_function_test.cpp +++ b/test/function/destroy/destroy_function_test.cpp @@ -90,7 +90,7 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy001, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -102,7 +102,7 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy001, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb deadCb = ServiceDeadCb(); @@ -138,7 +138,7 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy002, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -150,11 +150,11 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy002, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -205,7 +205,7 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy003, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -217,11 +217,11 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy003, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -273,7 +273,7 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy004, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -285,7 +285,7 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy004, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; int resultCodeInit = AieClientInit(configInfo, clientInfo, algoInfo, nullptr); @@ -320,7 +320,7 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy005, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -332,11 +332,11 @@ HWTEST_F(DestroyFunctionTest, TestAieClientDestroy005, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; diff --git a/test/function/init/init_function_test.cpp b/test/function/init/init_function_test.cpp index 92308a2..d84dd1f 100644 --- a/test/function/init/init_function_test.cpp +++ b/test/function/init/init_function_test.cpp @@ -111,7 +111,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitConfigInfo001, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -123,7 +123,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitConfigInfo001, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -159,7 +159,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitConfigInfo002, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -171,7 +171,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitConfigInfo002, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -207,7 +207,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitConfigInfo003, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -219,7 +219,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitConfigInfo003, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -253,7 +253,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitClientInfo001, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -265,7 +265,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitClientInfo001, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -298,7 +298,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitAlgoInfo001, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -310,7 +310,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitAlgoInfo001, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -343,7 +343,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitAlgoInfo002, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -355,7 +355,7 @@ HWTEST_F(InitFunctionTest, TestAieClientInitAlgoInfo002, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); diff --git a/test/function/prepare/prepare_function_test.cpp b/test/function/prepare/prepare_function_test.cpp index f2e4579..5393cfe 100644 --- a/test/function/prepare/prepare_function_test.cpp +++ b/test/function/prepare/prepare_function_test.cpp @@ -92,7 +92,7 @@ HWTEST_F(PrepareFunctionTest, TestAlgorithmInfo001, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -104,7 +104,7 @@ HWTEST_F(PrepareFunctionTest, TestAlgorithmInfo001, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -113,7 +113,7 @@ HWTEST_F(PrepareFunctionTest, TestAlgorithmInfo001, TestSize.Level1) ASSERT_TRUE(clientInfo.clientId > 0); DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -149,7 +149,7 @@ HWTEST_F(PrepareFunctionTest, TestAlgorithmInfo002, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -161,7 +161,7 @@ HWTEST_F(PrepareFunctionTest, TestAlgorithmInfo002, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -170,7 +170,7 @@ HWTEST_F(PrepareFunctionTest, TestAlgorithmInfo002, TestSize.Level1) ASSERT_TRUE(clientInfo.clientId > 0); DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -211,7 +211,7 @@ HWTEST_F(PrepareFunctionTest, TestInputInfo001, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -223,7 +223,7 @@ HWTEST_F(PrepareFunctionTest, TestInputInfo001, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -272,7 +272,7 @@ HWTEST_F(PrepareFunctionTest, TestInputInfo002, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -284,7 +284,7 @@ HWTEST_F(PrepareFunctionTest, TestInputInfo002, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -334,7 +334,7 @@ HWTEST_F(PrepareFunctionTest, TestCallback001, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -346,7 +346,7 @@ HWTEST_F(PrepareFunctionTest, TestCallback001, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -355,7 +355,7 @@ HWTEST_F(PrepareFunctionTest, TestCallback001, TestSize.Level1) ASSERT_TRUE(clientInfo.clientId > 0); DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -396,7 +396,7 @@ HWTEST_F(PrepareFunctionTest, TestCallback002, TestSize.Level1) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -408,7 +408,7 @@ HWTEST_F(PrepareFunctionTest, TestCallback002, TestSize.Level1) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -417,7 +417,7 @@ HWTEST_F(PrepareFunctionTest, TestCallback002, TestSize.Level1) ASSERT_TRUE(clientInfo.clientId > 0); DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -457,7 +457,7 @@ static HWTEST_F(PrepareFunctionTest, TestRegisterCallbackProxy001, TestSize.Leve .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -469,7 +469,7 @@ static HWTEST_F(PrepareFunctionTest, TestRegisterCallbackProxy001, TestSize.Leve .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -478,7 +478,7 @@ static HWTEST_F(PrepareFunctionTest, TestRegisterCallbackProxy001, TestSize.Leve ASSERT_TRUE(clientInfo.clientId > 0); DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; diff --git a/test/function/release/release_function_test.cpp b/test/function/release/release_function_test.cpp index b5870d5..e423857 100755 --- a/test/function/release/release_function_test.cpp +++ b/test/function/release/release_function_test.cpp @@ -90,7 +90,7 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease001, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -102,11 +102,11 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease001, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -152,7 +152,7 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease002, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -164,11 +164,11 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease002, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -214,7 +214,7 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease003, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -226,11 +226,11 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease003, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -280,7 +280,7 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease004, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -292,11 +292,11 @@ HWTEST_F(ReleaseFunctionTest, TestAieClientRelease004, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; diff --git a/test/function/sa_client/sa_client_test.cpp b/test/function/sa_client/sa_client_test.cpp index 7e9bbef..133ee21 100644 --- a/test/function/sa_client/sa_client_test.cpp +++ b/test/function/sa_client/sa_client_test.cpp @@ -75,7 +75,7 @@ static HWTEST_F(SaClientTest, TestSaClient001, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(const_cast(inputData)), }; AlgorithmInfo algoInfo = { .clientVersion = ALGORITHM_INFO_CLIENT_VERSION, @@ -86,7 +86,7 @@ static HWTEST_F(SaClientTest, TestSaClient001, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(const_cast(inputData)), }; ServiceDeadCb deadCb = ServiceDeadCb(); diff --git a/test/function/set_get_option/option_function_test.cpp b/test/function/set_get_option/option_function_test.cpp index 71b2df8..46b6dde 100755 --- a/test/function/set_get_option/option_function_test.cpp +++ b/test/function/set_get_option/option_function_test.cpp @@ -90,7 +90,7 @@ static void GetClientInfo(ClientInfo &clientInfo) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; } @@ -109,7 +109,7 @@ static void GetSyncAlgorithmInfo(AlgorithmInfo &algoInfo) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; } @@ -128,7 +128,7 @@ static void GetAsyncAlgorithmInfo(AlgorithmInfo &algoInfo) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; } @@ -167,7 +167,7 @@ HWTEST_F(OptionFunctionTest, TestOption001, TestSize.Level0) int len = strlen(str) + 1; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -190,7 +190,7 @@ HWTEST_F(OptionFunctionTest, TestOption001, TestSize.Level0) len = strlen(str) + 1; inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; int optionType = 0; @@ -245,7 +245,7 @@ HWTEST_F(OptionFunctionTest, TestOption002, TestSize.Level0) char *inputData = const_cast(str); int len = strlen(str) + 1; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -271,7 +271,7 @@ HWTEST_F(OptionFunctionTest, TestOption002, TestSize.Level0) inputData = const_cast(str); len = strlen(str) + 1; inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; int optionType = 0; @@ -285,7 +285,7 @@ HWTEST_F(OptionFunctionTest, TestOption002, TestSize.Level0) inputData = const_cast(str); len = strlen(str) + 1; inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -337,7 +337,7 @@ HWTEST_F(OptionFunctionTest, TestOption003, TestSize.Level0) int len = strlen(str) + 1; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; int optionType = 0; @@ -396,7 +396,7 @@ HWTEST_F(OptionFunctionTest, TestOption004, TestSize.Level0) int len = strlen(str) + 1; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; diff --git a/test/function/sync_process/sync_process_function_test.cpp b/test/function/sync_process/sync_process_function_test.cpp index f2ce059..bd65f4b 100755 --- a/test/function/sync_process/sync_process_function_test.cpp +++ b/test/function/sync_process/sync_process_function_test.cpp @@ -82,7 +82,7 @@ static void TestGetRightInfo(ConfigInfo &configInfo, ClientInfo &clientInfo, Alg clientInfo.serverUid = INVALID_UID, clientInfo.clientUid = INVALID_UID, clientInfo.extendLen = EXTEND_LENGTH; - clientInfo.extendMsg = (unsigned char*)inputData; + clientInfo.extendMsg = reinterpret_cast(inputData); algoInfo.clientVersion = ALGORITHM_INFO_CLIENT_VERSION; algoInfo.isAsync = false; @@ -92,7 +92,7 @@ static void TestGetRightInfo(ConfigInfo &configInfo, ClientInfo &clientInfo, Alg algoInfo.operateId = OPERATE_ID; algoInfo.requestId = REQUEST_ID; algoInfo.extendLen = EXTEND_LENGTH; - algoInfo.extendMsg = (unsigned char*)inputData; + algoInfo.extendMsg = reinterpret_cast(inputData); HILOGI("[Test]End TestGetRightInfo"); } @@ -117,7 +117,7 @@ HWTEST_F(SyncProcessFunctionTest, TestAieClientSyncProcess001, TestSize.Level0) TestGetRightInfo(configInfo, clientInfo, algoInfo); DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -166,7 +166,7 @@ HWTEST_F(SyncProcessFunctionTest, TestAieClientSyncProcess002, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -178,7 +178,7 @@ HWTEST_F(SyncProcessFunctionTest, TestAieClientSyncProcess002, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb cb = ServiceDeadCb(); @@ -191,7 +191,7 @@ HWTEST_F(SyncProcessFunctionTest, TestAieClientSyncProcess002, TestSize.Level0) }; DataInfo prepareInputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -238,7 +238,7 @@ HWTEST_F(SyncProcessFunctionTest, TestAieClientSyncProcess003, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -250,11 +250,11 @@ HWTEST_F(SyncProcessFunctionTest, TestAieClientSyncProcess003, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = EXTEND_LENGTH, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -305,7 +305,7 @@ HWTEST_F(SyncProcessFunctionTest, TestAieClientSyncProcess004, TestSize.Level0) TestGetRightInfo(configInfo, clientInfo, algoInfo); DataInfo inputInfo = { - .data = (unsigned char *)inputData, + .data = reinterpret_cast(inputData), .length = len, }; diff --git a/test/performance/delay/async_process/async_process_delay_test.cpp b/test/performance/delay/async_process/async_process_delay_test.cpp index 92d6249..b760246 100644 --- a/test/performance/delay/async_process/async_process_delay_test.cpp +++ b/test/performance/delay/async_process/async_process_delay_test.cpp @@ -93,7 +93,6 @@ static int Random(void) #endif int r = -1; int fd = open("/dev/random", O_RDONLY); - fd = open("/dev/random", O_RDONLY); if (fd > 0) { (void)read(fd, &r, sizeof(int)); } @@ -222,7 +221,7 @@ HWTEST_F(AsyncProcessTimeTest, TestAsyncTime001, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -234,7 +233,7 @@ HWTEST_F(AsyncProcessTimeTest, TestAsyncTime001, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; std::time_t initStartTime = GetCurTimeMillSec(); @@ -247,7 +246,7 @@ HWTEST_F(AsyncProcessTimeTest, TestAsyncTime001, TestSize.Level0) g_initTotalTime += initEndTime - initStartTime; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; DataInfo outputInfo; diff --git a/test/performance/delay/sync_process/sync_process_delay_test.cpp b/test/performance/delay/sync_process/sync_process_delay_test.cpp index 4694fce..814ba9c 100644 --- a/test/performance/delay/sync_process/sync_process_delay_test.cpp +++ b/test/performance/delay/sync_process/sync_process_delay_test.cpp @@ -81,7 +81,6 @@ static int Random(void) #endif int r = -1; int fd = open("/dev/random", O_RDONLY); - fd = open("/dev/random", O_RDONLY); if (fd > 0) { (void)read(fd, &r, sizeof(int)); } @@ -141,7 +140,7 @@ HWTEST_F(SyncProcessTimeTest, TestSyncTime001, TestSize.Level0) .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -153,7 +152,7 @@ HWTEST_F(SyncProcessTimeTest, TestSyncTime001, TestSize.Level0) .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; ServiceDeadCb *cb = nullptr; @@ -163,7 +162,7 @@ HWTEST_F(SyncProcessTimeTest, TestSyncTime001, TestSize.Level0) ASSERT_EQ(resultCode, RETCODE_SUCCESS); DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; DataInfo outputInfo; diff --git a/test/performance/reliability/aie_client/aie_client_reliability_test.cpp b/test/performance/reliability/aie_client/aie_client_reliability_test.cpp index 669839e..e502c7a 100644 --- a/test/performance/reliability/aie_client/aie_client_reliability_test.cpp +++ b/test/performance/reliability/aie_client/aie_client_reliability_test.cpp @@ -104,7 +104,7 @@ HWTEST_F(AieClientReliabilityTest, AieClientSyncReliabilityTest001, TestSize.Lev .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -116,11 +116,11 @@ HWTEST_F(AieClientReliabilityTest, AieClientSyncReliabilityTest001, TestSize.Lev .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; @@ -176,7 +176,7 @@ HWTEST_F(AieClientReliabilityTest, AieClientAsyncReliabilityTest001, TestSize.Le .serverUid = INVALID_UID, .clientUid = INVALID_UID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; AlgorithmInfo algoInfo = { @@ -188,11 +188,11 @@ HWTEST_F(AieClientReliabilityTest, AieClientAsyncReliabilityTest001, TestSize.Le .operateId = OPERATE_ID, .requestId = REQUEST_ID, .extendLen = len, - .extendMsg = (unsigned char*)inputData, + .extendMsg = reinterpret_cast(inputData), }; DataInfo inputInfo = { - .data = (unsigned char*)inputData, + .data = reinterpret_cast(inputData), .length = len, }; -- Gitee