Skip to content

Commit

Permalink
ofloader: fix warning and typo
Browse files Browse the repository at this point in the history
Signed-off-by: wanggang26 <[email protected]>
  • Loading branch information
wanggang26 authored and anjiahao1 committed Jul 31, 2023
1 parent 3bfdccb commit 2b528a7
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions system/ofloader/ofloader.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static FAR struct devinfo_s *parse_devinfo(FAR size_t *index)

*index = 0;
p = strtok_r(table, ";", &save_once);
while(p != NULL)
while (p != NULL)
{
p = strtok_r(p, ",", &save);
if (p == NULL)
Expand Down Expand Up @@ -144,7 +144,7 @@ static FAR struct devinfo_s *parse_devinfo(FAR size_t *index)
devinfo[*index].pos = devinfo[*index].base;
p = strtok_r(NULL, ";", &save_once);
(*index)++;
}
}

return devinfo;

Expand Down Expand Up @@ -291,7 +291,7 @@ static ssize_t handle(FAR struct ofloader_msg *msg,

static pthread_addr_t fake_idle(pthread_addr_t arg)
{
for (;;)
for (; ; )
{
}

Expand All @@ -310,12 +310,17 @@ int main(int argc, FAR char *argv[])
{
FAR struct devinfo_s *devinfo;
FAR struct ofloader_msg *msg;
struct mq_attr mqattr;
pthread_attr_t attr;
pthread_t thread;
size_t count;
size_t i;
mqd_t mq;

memset(&mqattr, 0, sizeof(struct mq_attr));
mqattr.mq_msgsize = sizeof(msg);
mqattr.mq_maxmsg = 10;

if (g_create_idle)
{
pthread_attr_init(&attr);
Expand All @@ -324,7 +329,7 @@ int main(int argc, FAR char *argv[])
pthread_attr_destroy(&attr);
}

mq = mq_open(OFLOADER_QNAME, O_CREAT | O_RDWR, 0660, NULL);
mq = mq_open(OFLOADER_QNAME, O_CREAT | O_RDWR, 0660, &mqattr);
if (mq < 0)
{
OFLOADER_DEBUG("mq_open error:%d\n", errno);
Expand All @@ -347,13 +352,13 @@ int main(int argc, FAR char *argv[])

while (1)
{
if (mq_receive(mq, (FAR void *)&msg, sizeof(msg), NULL) < 0)
if (mq_receive(mq, (FAR char *)&msg, sizeof(msg), NULL) < 0)
{
OFLOADER_DEBUG(" mq_receive error %d\n", -errno);
continue;
}

if(handle(msg, devinfo, count) < 0)
if (handle(msg, devinfo, count) < 0)
{
msg->atcion = OFLOADER_ERROR;
}
Expand Down

0 comments on commit 2b528a7

Please sign in to comment.