From 496f123235744a75f668a41ad1a48a79bf94f9b6 Mon Sep 17 00:00:00 2001 From: ZHEQIUSHUI Date: Tue, 19 Dec 2023 14:25:56 +0800 Subject: [PATCH] memset io input output --- examples/ax620/middleware/io.hpp | 8 ++++++++ examples/ax650/middleware/io.hpp | 2 ++ 2 files changed, 10 insertions(+) diff --git a/examples/ax620/middleware/io.hpp b/examples/ax620/middleware/io.hpp index c7d4173..1eb6dc4 100644 --- a/examples/ax620/middleware/io.hpp +++ b/examples/ax620/middleware/io.hpp @@ -162,6 +162,7 @@ namespace middleware return nullptr; } io.pInputs = new AX_JOINT_IO_BUFFER_T[io.nInputSize]; + memset(io.pInputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nInputSize); // fill input @@ -202,6 +203,7 @@ namespace middleware // deal with output io.nOutputSize = io_info->nOutputSize; io.pOutputs = new AX_JOINT_IO_BUFFER_T[io.nOutputSize]; + memset(io.pOutputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nOutputSize); for (size_t i = 0; i < io.nOutputSize; ++i) { const AX_JOINT_IOMETA_T* pMeta = io_info->pOutputs + i; @@ -223,6 +225,7 @@ namespace middleware return -1; } io.pInputs = new AX_JOINT_IO_BUFFER_T[io.nInputSize]; + memset(io.pInputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nInputSize); // fill input { @@ -255,6 +258,7 @@ namespace middleware { io.nOutputSize = io_info->nOutputSize; io.pOutputs = new AX_JOINT_IO_BUFFER_T[io.nOutputSize]; + memset(io.pOutputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nOutputSize); for (size_t i = 0; i < io.nOutputSize; ++i) { const AX_JOINT_IOMETA_T* pMeta = io_info->pOutputs + i; @@ -277,6 +281,7 @@ namespace middleware return -1; } io.pInputs = new AX_JOINT_IO_BUFFER_T[io.nInputSize]; + memset(io.pInputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nInputSize); // fill input { @@ -319,6 +324,7 @@ namespace middleware { io.nOutputSize = io_info->nOutputSize; io.pOutputs = new AX_JOINT_IO_BUFFER_T[io.nOutputSize]; + memset(io.pOutputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nOutputSize); for (size_t i = 0; i < io.nOutputSize; ++i) { const AX_JOINT_IOMETA_T* pMeta = io_info->pOutputs + i; @@ -340,6 +346,7 @@ namespace middleware return -1; } io.pInputs = new AX_JOINT_IO_BUFFER_T[io.nInputSize]; + memset(io.pInputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nInputSize); // fill input { @@ -382,6 +389,7 @@ namespace middleware { io.nOutputSize = io_info->nOutputSize; io.pOutputs = new AX_JOINT_IO_BUFFER_T[io.nOutputSize]; + memset(io.pOutputs, 0, sizeof(AX_JOINT_IO_BUFFER_T) * io.nOutputSize); for (size_t i = 0; i < io.nOutputSize; ++i) { const AX_JOINT_IOMETA_T* pMeta = io_info->pOutputs + i; diff --git a/examples/ax650/middleware/io.hpp b/examples/ax650/middleware/io.hpp index 9f5b724..daafae1 100644 --- a/examples/ax650/middleware/io.hpp +++ b/examples/ax650/middleware/io.hpp @@ -85,6 +85,7 @@ namespace middleware { memset(io_data, 0, sizeof(*io_data)); io_data->pInputs = new AX_ENGINE_IO_BUFFER_T[info->nInputSize]; + memset(io_data->pInputs, 0, sizeof(AX_ENGINE_IO_BUFFER_T) * info->nInputSize); io_data->nInputSize = info->nInputSize; auto ret = 0; @@ -111,6 +112,7 @@ namespace middleware } io_data->pOutputs = new AX_ENGINE_IO_BUFFER_T[info->nOutputSize]; + memset(io_data->pOutputs, 0, sizeof(AX_ENGINE_IO_BUFFER_T) * info->nOutputSize); io_data->nOutputSize = info->nOutputSize; for (int i = 0; i < info->nOutputSize; ++i) {