Skip to content

Commit

Permalink
memset io input output
Browse files Browse the repository at this point in the history
  • Loading branch information
ZHEQIUSHUI committed Dec 19, 2023
1 parent a9f9941 commit 496f123
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/ax620/middleware/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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;
Expand All @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions examples/ax650/middleware/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
{
Expand Down

0 comments on commit 496f123

Please sign in to comment.