This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
commit ccd6aec427c48d643d5725514febfdd12bd76728 Author: wanggang26 <[email protected]> AuthorDate: Thu Jul 27 21:12:57 2023 +0800 ofloader: fix warning and typo Signed-off-by: wanggang26 <[email protected]> --- system/ofloader/ofloader.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/system/ofloader/ofloader.c b/system/ofloader/ofloader.c index bbd6801d1..4f6252ed0 100644 --- a/system/ofloader/ofloader.c +++ b/system/ofloader/ofloader.c @@ -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) @@ -144,7 +144,7 @@ again: devinfo[*index].pos = devinfo[*index].base; p = strtok_r(NULL, ";", &save_once); (*index)++; - } + } return devinfo; @@ -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 (; ; ) { } @@ -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); @@ -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); @@ -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; }
