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 35b40a06dc3a21b90da63ed6363f1ca8a2ad0027..f4879c20f25b43d6f6698b512d5270fb84e72982 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 91d1246dbb9d80b62a7368a32a0b933ea8a5ccea..7f087797780cbda738fdd9334a141a0084688073 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/platform/threadpool/include/aie_thread_unix.h b/services/common/platform/threadpool/include/aie_thread_unix.h index a04e3ba653f2fff5d6f96ad17d4fbde0523edfa6..51f7cd10213b16754982bfd0fe32598481b9ff73 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 08585bf67ff4790c70716ec7e273ccbc0e04fcac..f9a5137a82df54d485106001f7ce6270c45d250c 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/services/common/utils/encdec/source/data_encoder.cpp b/services/common/utils/encdec/source/data_encoder.cpp index 5608b235d95db435ba60d7c0f56e82d8c57edb11..13b7fcf5793a221a44de7e301e50dfbcad6161fe 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 91f3ccfff2a53b9b3f7fa3480b8c84db04ce281a..333c0451aa243e04cafcf190d3c085ac1ca3006b 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/dl_operation/dl_operation_test.cpp b/test/common/dl_operation/dl_operation_test.cpp index f99c7015dc3967b32088737ca611229fab5ae1f3..efc9a3df7b043c2b0b2f8c9e8d5f89214d4e4c5e 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/semaphore/semaphore_test.cpp b/test/common/semaphore/semaphore_test.cpp index 19861ed2fcb92ef6917e88e4837e7f1d2c5787f1..5a7043a0e97b421b94b4114163cacfb87a4e5a5f 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/common/threadpool/thread_pool_test.cpp b/test/common/threadpool/thread_pool_test.cpp index 8c6e8858e2f24d4825bbda67050dbfac8401694f..b6aa4e5f3ae42603470da4069f7ea519713378b8 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/async_process/async_process_function_test.cpp b/test/function/async_process/async_process_function_test.cpp index d50bce77da2309b56c3fbfdcb5977e7569c6c806..d988df3bf71eece00423897bff4f576690cae4a7 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 9866db646b9d77aeeca1bc5bbb722463d5413549..467bb7545d4b0cc96f97885c766c541ec7df482f 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 92308a2c63c5df3f7d7a57df7de0abaca0c0dce0..d84dd1f87599d1be41f50826fdef9c3c2dc5341c 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 f2e4579767c5ee7f2754fa6d37cee835f8b5336d..5393cfe7bf7579b31b30da3fb16d6eed7213d6bb 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 b5870d55c4047316a9de5a0b9f3dd55f2bc70860..e4238570557b2e904bd8ffa4645f8cd2ef025846 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 af0f50114f4e9da94756c9a3c80b0f5c69f94c89..133ee21c7b17f27308900140ff0d128cfa4706c8 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 = { @@ -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 71b2df8f421bfb22e20e719eb5c40d5146b76df1..46b6dde58f5c26421a784ce8e24ea2e74195466f 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 f2ce059964babbea2f3ef8370c01af1991d20fe4..bd65f4bce53859f504b0d6f7b3dbba0811925f0a 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 92d624927b696ab958c74119dd50e7e097675e7c..b7602466abd5467c2aa29548ace1198f53f33dbe 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 4694fce0b88773c4090a9d8d6f6b433f4d55fbf3..814ba9c5b32b72769207dcb85321f5ad9013db09 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 669839eaa268b84653cfb58284a2dabb1c9fe0db..e502c7a7bc250315088ca79b534ceba335dbc57a 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, };