diff --git a/libdmabufheap/include/dmabuf_alloc.h b/libdmabufheap/include/dmabuf_alloc.h index 07ec54b86091ef90aa141b6462ae1b4036bef6e8..e8233198269f8a818663f971f00135d625e90ead 100644 --- a/libdmabufheap/include/dmabuf_alloc.h +++ b/libdmabufheap/include/dmabuf_alloc.h @@ -18,6 +18,7 @@ #include #include +#include #undef LOG_TAG #define LOG_TAG "dmabufheap" diff --git a/libdmabufheap/src/dmabuf_alloc.c b/libdmabufheap/src/dmabuf_alloc.c index e20a781751ba8551ce883e7eb92df75e40e0cfcb..b283b78b6f7a47b80f4cb110a89a012d7e1a1c49 100644 --- a/libdmabufheap/src/dmabuf_alloc.c +++ b/libdmabufheap/src/dmabuf_alloc.c @@ -20,8 +20,6 @@ #include #include #include -#include -#include #include "securec.h" #include "hilog/log.h" #include "dmabuf_alloc.h" diff --git a/libpurgeablemem/c/include/purgeable_mem_builder_c.h b/libpurgeablemem/c/include/purgeable_mem_builder_c.h index 2ccd3312f970fdf929f2681759d0da6e0f0ac7dd..488e5b251601aecebdfbe6f2baf03ec0a0a37e94 100644 --- a/libpurgeablemem/c/include/purgeable_mem_builder_c.h +++ b/libpurgeablemem/c/include/purgeable_mem_builder_c.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_BUILDER_C_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_BUILDER_C_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_BUILDER_C_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_BUILDER_C_H #include @@ -49,4 +49,4 @@ bool PurgMemBuilderBuildAll(struct PurgMemBuilder *builder, void *data, size_t s #endif /* End of #if __cplusplus */ #endif /* End of #ifdef __cplusplus */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_BUILDER_C_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_BUILDER_C_H */ diff --git a/libpurgeablemem/c/include/purgeable_mem_c.h b/libpurgeablemem/c/include/purgeable_mem_c.h index 3628ac78ababe7563b32227b0dadb044f3fe7421..fb341473d1d62b52348234de1d599a80a13ebf32 100644 --- a/libpurgeablemem/c/include/purgeable_mem_c.h +++ b/libpurgeablemem/c/include/purgeable_mem_c.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_C_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_C_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_C_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_C_H #include /* bool */ #include /* size_t */ @@ -30,7 +30,7 @@ struct PurgMem; /* * Function pointer, it points to a function which build content of a PurgMem obj. - * Input: void *: data ptr, ponits to start address of a PurgMem obj's content. + * Input: void *: data ptr, points to start address of a PurgMem obj's content. * Input: size_t: data size of the content. * Input: void *: other private parameters. * Return: build content result, true means success, while false is fail. @@ -128,4 +128,4 @@ bool PurgMemAppendModify(struct PurgMem *purgObj, PurgMemModifyFunc func, void * #endif /* End of #if __cplusplus */ #endif /* End of #ifdef __cplusplus */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_C_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_C_INCLUDE_PURGEABLE_MEM_C_H */ diff --git a/libpurgeablemem/common/include/pm_ptr_util.h b/libpurgeablemem/common/include/pm_ptr_util.h index 75d7f76bdce3b6d339319bc807b54beb0697098e..6180d6a87c90add3d9ba29474a1db1d1633d4ea4 100644 --- a/libpurgeablemem/common/include/pm_ptr_util.h +++ b/libpurgeablemem/common/include/pm_ptr_util.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H #include "hilog/log_c.h" @@ -33,4 +33,4 @@ } \ } while (0) -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_PTR_UTIL_H */ diff --git a/libpurgeablemem/common/include/pm_state_c.h b/libpurgeablemem/common/include/pm_state_c.h index 90b205771d1ddfb80b98ca4a6b320dea82168534..e18254d86ea9e6441a9758e1d9d91e85a598ce99 100644 --- a/libpurgeablemem/common/include/pm_state_c.h +++ b/libpurgeablemem/common/include/pm_state_c.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H #ifdef __cplusplus #if __cplusplus @@ -64,4 +64,4 @@ const char *GetPMStateName(PMState state); #endif /* End of #if __cplusplus */ #endif /* End of #ifdef __cplusplus */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_STATE_C_H */ diff --git a/libpurgeablemem/common/include/pm_util.h b/libpurgeablemem/common/include/pm_util.h index 94423255e52e897138c1868c8f9263dd85137b39..954e7ee4b5f79142097b88ba09aac2ecb5c7bb24 100644 --- a/libpurgeablemem/common/include/pm_util.h +++ b/libpurgeablemem/common/include/pm_util.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_UTIL_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_UTIL_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_UTIL_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_UTIL_H #ifdef __cplusplus #if __cplusplus @@ -57,4 +57,4 @@ extern "C" { #endif /* End of #if __cplusplus */ #endif /* End of #ifdef __cplusplus */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_UTIL_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_PM_UTIL_H */ diff --git a/libpurgeablemem/common/include/ux_page_table_c.h b/libpurgeablemem/common/include/ux_page_table_c.h index cbfdc1d03b50dae7b42ac667670a9a9cdca27599..1ee3625dce975de90d068949e83c51bd5658e248 100644 --- a/libpurgeablemem/common/include/ux_page_table_c.h +++ b/libpurgeablemem/common/include/ux_page_table_c.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_UX_PAGE_TABLE_C_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_UX_PAGE_TABLE_C_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_UX_PAGE_TABLE_C_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_UX_PAGE_TABLE_C_H #include /* uint64_t */ #include /* bool */ @@ -46,4 +46,4 @@ bool UxpteIsPresent(UxPageTableStruct *upt, uint64_t addr, size_t len); } #endif /* End of #if __cplusplus */ #endif /* End of #ifdef __cplusplus */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_COMMON_INCLUDE_UX_PAGE_TABLE_C_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_COMMON_INCLUDE_UX_PAGE_TABLE_C_H */ diff --git a/libpurgeablemem/cpp/include/purgeable_mem.h b/libpurgeablemem/cpp/include/purgeable_mem.h index 9f2d461de321cac4f384ca6e52c56982e7a34e2c..c77e91b94111c7030feb6d6941cd6c8c2e606833 100644 --- a/libpurgeablemem/cpp/include/purgeable_mem.h +++ b/libpurgeablemem/cpp/include/purgeable_mem.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_H #include /* unique_ptr */ #include /* shared_mutex */ @@ -113,4 +113,4 @@ private: }; } /* namespace PurgeableMem */ } /* namespace OHOS */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_H */ diff --git a/libpurgeablemem/cpp/include/purgeable_mem_builder.h b/libpurgeablemem/cpp/include/purgeable_mem_builder.h index b8e92690bdc425471747ded5c40210bc006352c5..7b09b4f560af1798c24857a8d258338211a48f77 100644 --- a/libpurgeablemem/cpp/include/purgeable_mem_builder.h +++ b/libpurgeablemem/cpp/include/purgeable_mem_builder.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_BUILDER_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_BUILDER_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_BUILDER_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_BUILDER_H #include /* unique_ptr */ @@ -47,4 +47,4 @@ private: }; } /* namespace PurgeableMem */ } /* namespace OHOS */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_BUILDER_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_PURGEABLE_MEM_BUILDER_H */ diff --git a/libpurgeablemem/cpp/include/ux_page_table.h b/libpurgeablemem/cpp/include/ux_page_table.h index 301640a87657c7326b703506958424767501ee00..a0481be1b5cc3fe424f579bb5709ed747e4b3bff 100644 --- a/libpurgeablemem/cpp/include/ux_page_table.h +++ b/libpurgeablemem/cpp/include/ux_page_table.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_UX_PAGE_TABLE_H -#define OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_UX_PAGE_TABLE_H +#ifndef OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_UX_PAGE_TABLE_H +#define OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_UX_PAGE_TABLE_H #include /* std::string */ @@ -38,4 +38,4 @@ private: }; } /* namespace PurgeableMem */ } /* namespace OHOS */ -#endif /* OHOS_UTILS_MEMOEY_LIBPURGEABLEMEM_CPP_INCLUDE_UX_PAGE_TABLE_H */ +#endif /* OHOS_UTILS_MEMORY_LIBPURGEABLEMEM_CPP_INCLUDE_UX_PAGE_TABLE_H */ diff --git a/libpurgeablemem/test/purgeable_c_test.cpp b/libpurgeablemem/test/purgeable_c_test.cpp index ae6fd3fb77b2989aa90dc9644029641058ec1203..b2c2f0f77331d09d5f06611dd84a8e46ec3b0acd 100644 --- a/libpurgeablemem/test/purgeable_c_test.cpp +++ b/libpurgeablemem/test/purgeable_c_test.cpp @@ -14,6 +14,7 @@ */ #include +#include #include #include "gtest/gtest.h" @@ -77,24 +78,24 @@ HWTEST_F(PurgeableCTest, MultiObjCreateTest, TestSize.Level1) struct PurgMem *pobj1 = PurgMemCreate(27, InitAlphabet, &initPara); LoopPrintAlphabet(pobj1, 1); struct AlphabetModifyParam a2b = {'A', 'B'}; - ModifyPurgMemByFunc(pobj1, ModifyAlphabetX2Y, (void *)&a2b); + ModifyPurgMemByFunc(pobj1, ModifyAlphabetX2Y, static_cast(&a2b)); LoopPrintAlphabet(pobj1, 1); LoopReclaimPurgeable(1); struct PurgMem *pobj2 = PurgMemCreate(27, InitAlphabet, &initPara); LoopPrintAlphabet(pobj2, 1); - ModifyPurgMemByFunc(pobj2, ModifyAlphabetX2Y, (void *)&a2b); + ModifyPurgMemByFunc(pobj2, ModifyAlphabetX2Y, static_cast(&a2b)); LoopPrintAlphabet(pobj2, 1); if (PurgMemBeginRead(pobj1)) { - ASSERT_STREQ(alphabetFinal, (char *)PurgMemGetContent(pobj1)); + ASSERT_STREQ(alphabetFinal, static_cast(PurgMemGetContent(pobj1))); PurgMemEndRead(pobj1); } else { std::cout << __func__ << ": ERROR! BeginRead failed." << std::endl; } if (PurgMemBeginRead(pobj2)) { - ASSERT_STREQ(alphabetFinal, (char *)PurgMemGetContent(pobj2)); + ASSERT_STREQ(alphabetFinal, static_cast(PurgMemGetContent(pobj2))); PurgMemEndRead(pobj2); } else { std::cout << __func__ << ": ERROR! BeginRead failed." << std::endl; @@ -109,7 +110,7 @@ HWTEST_F(PurgeableCTest, ReadTest, TestSize.Level1) const char alphabet[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ\0"; struct AlphabetInitParam initPara = {'A', 'Z'}; struct PurgMem *pobj = PurgMemCreate(27, InitAlphabet, &initPara); - std::thread reclaimThread(LoopReclaimPurgeable, (unsigned int)(-1)); + std::thread reclaimThread(LoopReclaimPurgeable, UINT_MAX); pthread_t reclaimPid = reclaimThread.native_handle(); reclaimThread.detach(); @@ -120,7 +121,7 @@ HWTEST_F(PurgeableCTest, ReadTest, TestSize.Level1) std::cout << __func__ << ": ERROR! BeginRead failed." << std::endl; continue; } - ASSERT_STREQ(alphabet, (char *)PurgMemGetContent(pobj)); + ASSERT_STREQ(alphabet, static_cast(PurgMemGetContent(pobj))); PurgMemEndRead(pobj); } @@ -133,17 +134,17 @@ HWTEST_F(PurgeableCTest, WriteTest, TestSize.Level1) const char alphabet[] = "CCCDEFGHIJKLMNOPQRSTUVWXYZ\0"; struct AlphabetInitParam initPara = {'A', 'Z'}; struct PurgMem *pobj = PurgMemCreate(27, InitAlphabet, &initPara); - std::thread reclaimThread(LoopReclaimPurgeable, (unsigned int)(-1)); + std::thread reclaimThread(LoopReclaimPurgeable, UINT_MAX); pthread_t reclaimPid = reclaimThread.native_handle(); reclaimThread.detach(); struct AlphabetModifyParam a2b = {'A', 'B'}; struct AlphabetModifyParam b2c = {'B', 'C'}; - ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, (void *)&a2b); - ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, (void *)&b2c); + ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, static_cast(&a2b)); + ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, static_cast(&b2c)); if (PurgMemBeginRead(pobj)) { - ASSERT_STREQ(alphabet, (char *)PurgMemGetContent(pobj)); + ASSERT_STREQ(alphabet, static_cast(PurgMemGetContent(pobj))); PurgMemEndRead(pobj); } else { std::cout << __func__ << ": ERROR! BeginRead failed." << std::endl; @@ -160,23 +161,23 @@ HWTEST_F(PurgeableCTest, ReadWriteTest, TestSize.Level1) struct AlphabetInitParam initPara = {'A', 'Z'}; struct PurgMem *pobj = PurgMemCreate(27, InitAlphabet, &initPara); /* loop reclaim thread */ - std::thread reclaimThread(LoopReclaimPurgeable, (unsigned int)(-1)); + std::thread reclaimThread(LoopReclaimPurgeable, UINT_MAX); pthread_t reclaimPid = reclaimThread.native_handle(); reclaimThread.detach(); /* loop read thread */ - std::thread readThread(LoopPrintAlphabet, pobj, (unsigned int)(-1)); + std::thread readThread(LoopPrintAlphabet, pobj, UINT_MAX); pthread_t readPid = readThread.native_handle(); readThread.detach(); struct AlphabetModifyParam a2b = {'A', 'B'}; struct AlphabetModifyParam b2c = {'B', 'C'}; struct AlphabetModifyParam c2d = {'C', 'D'}; - ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, (void *)&a2b); - ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, (void *)&b2c); - ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, (void *)&c2d); + ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, static_cast(&a2b)); + ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, static_cast(&b2c)); + ModifyPurgMemByFunc(pobj, ModifyAlphabetX2Y, static_cast(&c2d)); if (PurgMemBeginRead(pobj)) { - ASSERT_STREQ(alphabet, (char *)PurgMemGetContent(pobj)); + ASSERT_STREQ(alphabet, static_cast(PurgMemGetContent(pobj))); PurgMemEndRead(pobj); } else { std::cout << __func__ << ": ERROR! BeginRead failed." << std::endl; diff --git a/libpurgeablemem/test/purgeable_cpp_test.cpp b/libpurgeablemem/test/purgeable_cpp_test.cpp index afc2dc783f990a30192d6049b2d22d4886bb5f34..218c51323a7ba5f1df570623f9c1ff61f685d630 100644 --- a/libpurgeablemem/test/purgeable_cpp_test.cpp +++ b/libpurgeablemem/test/purgeable_cpp_test.cpp @@ -16,7 +16,7 @@ #include #include #include /* unique_ptr */ -#include +#include #include "gtest/gtest.h" #include "purgeable_mem.h" @@ -46,7 +46,7 @@ public: if (size <= 0) { return true; } - char *str = (char *)data; + char *str = static_cast(data); size_t len = 0; for (char ch = start; ch <= end && len < size; ch++) { str[len++] = ch; @@ -76,7 +76,7 @@ public: bool Build(void *data, size_t size) { - char *str = (char *)data; + char *str = static_cast(data); for (size_t i = 0; str[i] && i < size; i++) { if (str[i] == from) { str[i] = to; @@ -106,7 +106,7 @@ public: if (size <= 0) { return true; } - char *str = (char *)data; + char *str = static_cast(data); size_t len = 0; for (char ch = target; len < size;) { str[len++] = ch; @@ -174,7 +174,7 @@ HWTEST_F(PurgeableCppTest, MultiObjCreateTest, TestSize.Level1) int times2 = 0; while (times1++ < 10) { if (pobj1.BeginRead()) { - ret1 = strncmp(alphabetFinal, (char *)(pobj1.GetContent()), 26); + ret1 = strncmp(alphabetFinal, static_cast(pobj1.GetContent()), 26); pobj1.EndRead(); break; } else { @@ -184,7 +184,7 @@ HWTEST_F(PurgeableCppTest, MultiObjCreateTest, TestSize.Level1) while (times2++ < 10) { if (pobj2.BeginRead()) { - ret2 = strncmp(alphabetFinal, (char *)(pobj2.GetContent()), 26); + ret2 = strncmp(alphabetFinal, static_cast(pobj2.GetContent()), 26); pobj2.EndRead(); break; } else { @@ -207,7 +207,7 @@ HWTEST_F(PurgeableCppTest, ReadTest, TestSize.Level1) int ret = 1; while (times++ < 10) { if (pobj->BeginRead()) { - ret = strncmp(alphabet, (char *)(pobj->GetContent()), 26); + ret = strncmp(alphabet, static_cast(pobj->GetContent()), 26); pobj->EndRead(); break; } else { @@ -235,7 +235,7 @@ HWTEST_F(PurgeableCppTest, WriteTest, TestSize.Level1) int ret = 1; while (times++ < 10) { if (pobj->BeginRead()) { - ret = strncmp(alphabet, (char *)(pobj->GetContent()), 26); + ret = strncmp(alphabet, static_cast(pobj->GetContent()), 26); pobj->EndRead(); break; } else { @@ -267,7 +267,7 @@ HWTEST_F(PurgeableCppTest, ReadWriteTest, TestSize.Level1) int ret = 1; while (times++ < 10) { if (pobj->BeginRead()) { - ret = strncmp(alphabet, (char *)(pobj->GetContent()), 26); + ret = strncmp(alphabet, static_cast(pobj->GetContent()), 26); pobj->EndRead(); break; } else { @@ -296,7 +296,7 @@ HWTEST_F(PurgeableCppTest, MutiPageReadTest, TestSize.Level1) int ret = 1; while (times++ < 10) { if (pobj->BeginRead()) { - ret = strncmp(alphabet, (char *)(pobj->GetContent()), 4097); + ret = strncmp(alphabet, static_cast(pobj->GetContent()), 4097); pobj->EndRead(); break; } else { @@ -330,7 +330,7 @@ HWTEST_F(PurgeableCppTest, MutiPageWriteTest, TestSize.Level1) int ret = 1; while (times++ < 10) { if (pobj->BeginRead()) { - ret = strncmp(alphabet, (char *)(pobj->GetContent()), 4097); + ret = strncmp(alphabet, static_cast(pobj->GetContent()), 4097); pobj->EndRead(); break; } else { @@ -366,7 +366,7 @@ HWTEST_F(PurgeableCppTest, MutiPageReadWriteTest, TestSize.Level1) int ret = 1; while (times++ < 10) { if (pobj->BeginRead()) { - ret = strncmp(alphabet, (char *)(pobj->GetContent()), 4097); + ret = strncmp(alphabet, static_cast(pobj->GetContent()), 4097); pobj->EndRead(); break; } else { @@ -404,7 +404,7 @@ HWTEST_F(PurgeableCppTest, MutiMorePageReadWriteTest, TestSize.Level1) int ret = 1; while (times++ < 10) { if (pobj->BeginRead()) { - ret = strncmp(alphabet, (char *)(pobj->GetContent()), size - 1); + ret = strncmp(alphabet, static_cast(pobj->GetContent()), size - 1); pobj->EndRead(); break; } else {