未验证 提交 33c4e194 编写于 作者: O openharmony_ci 提交者: Gitee

!851 增加队列支持变长读操作

Merge pull request !851 from chenliming_kh/master
...@@ -223,6 +223,7 @@ STATIC VOID OsQueueBufferOperate(LosQueueCB *queueCB, UINT32 operateType, VOID * ...@@ -223,6 +223,7 @@ STATIC VOID OsQueueBufferOperate(LosQueueCB *queueCB, UINT32 operateType, VOID *
PRINT_ERR("get msgdatasize failed\n"); PRINT_ERR("get msgdatasize failed\n");
return; return;
} }
msgDataSize = (*bufferSize < msgDataSize) ? *bufferSize : msgDataSize;
if (memcpy_s(bufferAddr, *bufferSize, queueNode, msgDataSize) != EOK) { if (memcpy_s(bufferAddr, *bufferSize, queueNode, msgDataSize) != EOK) {
PRINT_ERR("copy message to buffer failed\n"); PRINT_ERR("copy message to buffer failed\n");
return; return;
...@@ -249,9 +250,7 @@ STATIC UINT32 OsQueueOperateParamCheck(const LosQueueCB *queueCB, UINT32 queueID ...@@ -249,9 +250,7 @@ STATIC UINT32 OsQueueOperateParamCheck(const LosQueueCB *queueCB, UINT32 queueID
return LOS_ERRNO_QUEUE_NOT_CREATE; return LOS_ERRNO_QUEUE_NOT_CREATE;
} }
if (OS_QUEUE_IS_READ(operateType) && (*bufferSize < (queueCB->queueSize - sizeof(UINT32)))) { if (OS_QUEUE_IS_WRITE(operateType) && (*bufferSize > (queueCB->queueSize - sizeof(UINT32)))) {
return LOS_ERRNO_QUEUE_READ_SIZE_TOO_SMALL;
} else if (OS_QUEUE_IS_WRITE(operateType) && (*bufferSize > (queueCB->queueSize - sizeof(UINT32)))) {
return LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG; return LOS_ERRNO_QUEUE_WRITE_SIZE_TOO_BIG;
} }
return LOS_OK; return LOS_OK;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册