Browse Source

Fixed msgQReceive() return value error.

master
Hanhui 6 years ago
parent
commit
fab66f2a30
  1. 2
      target/h/msgQLibCommon.h
  2. 4
      target/src/msgQLib.c

2
target/h/msgQLibCommon.h

@ -69,7 +69,7 @@ MSG_Q_ID msgQCreate(int maxMsgs, int maxMsgLength, int options);
STATUS msgQDelete(MSG_Q_ID msgQId);
STATUS msgQSend(MSG_Q_ID msgQId, char *buffer, UINT nBytes,
int timeout, int priority);
int msgQReceive(MSG_Q_ID msgQId, char *buffer, UINT maxNBytes,
ssize_t msgQReceive(MSG_Q_ID msgQId, char *buffer, UINT maxNBytes,
int timeout);
STATUS msgQInfoGet(MSG_Q_ID msgQId, MSG_Q_INFO *pInfo);
int msgQNumMsgs(MSG_Q_ID msgQId);

4
target/src/msgQLib.c

@ -176,7 +176,7 @@ STATUS msgQSend (MSG_Q_ID msgQId, char *buffer, UINT nBytes,
/*
* recv a msg from msgqueue
*/
int msgQReceive (MSG_Q_ID msgQId, char *buffer, UINT maxNBytes, int timeout)
ssize_t msgQReceive (MSG_Q_ID msgQId, char *buffer, UINT maxNBytes, int timeout)
{
ULONG ulError;
size_t stLen;
@ -194,7 +194,7 @@ int msgQReceive (MSG_Q_ID msgQId, char *buffer, UINT maxNBytes, int timeout)
return (ERROR);
} else {
return (OK);
return ((ssize_t)stLen);
}
}

Loading…
Cancel
Save