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
The following commit(s) were added to refs/heads/master by this push: new 000a8bcdf Fix nuttx coding style 000a8bcdf is described below commit 000a8bcdf114e90fbde924cc21dd31488d3b7479 Author: simbit18 <101105604+simbi...@users.noreply.github.com> AuthorDate: Wed Apr 17 15:18:50 2024 +0200 Fix nuttx coding style fix error: Relative file path does not match actual file error: Long line found error: Operator/assignment must be preceded with whitespace error: Missing blank line after comment --- examples/can/can.h | 7 +- examples/elf/tests/task/task.c | 13 ++-- examples/nettest/nettest_cmdline.c | 2 +- examples/nettest/nettest_server.c | 2 +- examples/nxdemo/nxdemo_listener.c | 4 +- examples/nximage/nximage_listener.c | 4 +- examples/nxlines/nxlines_listener.c | 4 +- examples/pdcurses/tui.h | 2 +- examples/tiff/tiff_main.c | 14 ++-- .../usrsocktest/usrsocktest_remote_disconnect.c | 2 +- examples/watchdog/watchdog.h | 4 +- include/interpreters/minibasic.h | 2 +- interpreters/minibasic/script.c | 3 +- netutils/pppd/lcp.h | 2 +- netutils/smtp/smtp.c | 11 +-- system/hexed/src/hexcopy.c | 78 +++++++++++----------- 16 files changed, 84 insertions(+), 70 deletions(-) diff --git a/examples/can/can.h b/examples/can/can.h index b9446c5ab..9d598483b 100644 --- a/examples/can/can.h +++ b/examples/can/can.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/examples/can/can.h + * apps/examples/can/can.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -30,7 +30,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* This test depends on these specific CAN configurations settings (your * specific CAN settings might require additional settings). * @@ -41,7 +43,8 @@ * Specific configuration options for this example include: * * CONFIG_CAN_LOOPBACK - * CONFIG_EXAMPLES_CAN_DEVPATH - The path to the CAN device. Default: /dev/can0 + * CONFIG_EXAMPLES_CAN_DEVPATH - The path to the CAN device. + * Default: /dev/can0 * CONFIG_EXAMPLES_CAN_NMSGS - This number of CAN message is collected and * the program terminates. Default: 32. * CONFIG_EXAMPLES_CAN_READ - Only receive messages diff --git a/examples/elf/tests/task/task.c b/examples/elf/tests/task/task.c index 8bbc819d9..dfaf9834a 100644 --- a/examples/elf/tests/task/task.c +++ b/examples/elf/tests/task/task.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/elf/tests/task/parent.c + * apps/examples/elf/tests/task/task.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -47,9 +47,11 @@ static char no_name[] = "<noname>"; * Privite Functions ****************************************************************************/ -/* NOTE: it is necessary for functions that are referred to by function pointers - * pointer to be declared with global scope (at least for ARM). Otherwise, - * a relocation type that is not supported by ELF is generated by GCC. +/* NOTE: it is necessary for functions that are referred to by + * function pointers pointer to be declared with global scope + * (at least for ARM). + * Otherwise, a relocation type that is not supported by ELF + * is generated by GCC. */ int child_task(int argc, char **argv) @@ -113,7 +115,8 @@ int main(int argc, char **argv) child_argv[0] = child_arg; child_argv[1] = 0; - child_pid = task_create(child_name, 50, 2048, child_task, (FAR char * const *)child_argv); + child_pid = task_create(child_name, 50, 2048, child_task, + (FAR char * const *)child_argv); if (child_pid < 0) { printf("Parent: task_create failed: %d\n", errno); diff --git a/examples/nettest/nettest_cmdline.c b/examples/nettest/nettest_cmdline.c index 76736d79d..af8ed5e69 100644 --- a/examples/nettest/nettest_cmdline.c +++ b/examples/nettest/nettest_cmdline.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/nettest/netest_cmdline.c + * apps/examples/nettest/nettest_cmdline.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/examples/nettest/nettest_server.c b/examples/nettest/nettest_server.c index 1710af57b..4ce399f15 100644 --- a/examples/nettest/nettest_server.c +++ b/examples/nettest/nettest_server.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/nettest/nettest-server.c + * apps/examples/nettest/nettest_server.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/examples/nxdemo/nxdemo_listener.c b/examples/nxdemo/nxdemo_listener.c index a5042a077..430b90039 100644 --- a/examples/nxdemo/nxdemo_listener.c +++ b/examples/nxdemo/nxdemo_listener.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/nxterm/nxdemo_listener.c + * apps/examples/nxdemo/nxdemo_listener.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -46,7 +46,7 @@ FAR void *nxdemo_listener(FAR void *arg) /* Process events forever */ - for (;;) + for (; ; ) { /* Handle the next event. If we were configured blocking, then * we will stay right here until the next event is received. Since diff --git a/examples/nximage/nximage_listener.c b/examples/nximage/nximage_listener.c index 84d4e47ca..f92f10b87 100644 --- a/examples/nximage/nximage_listener.c +++ b/examples/nximage/nximage_listener.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/nxterm/nximage_listener.c + * apps/examples/nximage/nximage_listener.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -46,7 +46,7 @@ FAR void *nximage_listener(FAR void *arg) /* Process events forever */ - for (;;) + for (; ; ) { /* Handle the next event. If we were configured blocking, then * we will stay right here until the next event is received. Since diff --git a/examples/nxlines/nxlines_listener.c b/examples/nxlines/nxlines_listener.c index 8bb4d9d94..452e2b658 100644 --- a/examples/nxlines/nxlines_listener.c +++ b/examples/nxlines/nxlines_listener.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/nxterm/nxlines_listener.c + * apps/examples/nxlines/nxlines_listener.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -46,7 +46,7 @@ FAR void *nxlines_listener(FAR void *arg) /* Process events forever */ - for (;;) + for (; ; ) { /* Handle the next event. If we were configured blocking, then * we will stay right here until the next event is received. Since diff --git a/examples/pdcurses/tui.h b/examples/pdcurses/tui.h index f7abba784..c15db5610 100644 --- a/examples/pdcurses/tui.h +++ b/examples/pdcurses/tui.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/pdcurses/tui.c + * apps/examples/pdcurses/tui.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/examples/tiff/tiff_main.c b/examples/tiff/tiff_main.c index f511e9791..72d5afb16 100644 --- a/examples/tiff/tiff_main.c +++ b/examples/tiff/tiff_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/graphics/tiff/tiff_main.c + * apps/examples/tiff/tiff_main.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -33,10 +33,13 @@ /**************************************************************************** * Pre-Processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ -/* This is a simple unit test for the TIFF creation library at apps/graphic/tiff. - * It is configured to work in the Linux user-mode simulation and has not been - * tested in any other environment. + +/* This is a simple unit test for the TIFF creation library at + * apps/graphic/tiff. + * It is configured to work in the Linux user-mode simulation and + * has not been tested in any other environment. * * Other configuration options: * @@ -88,7 +91,7 @@ int main(int argc, FAR char *argv[]) { struct tiff_info_s info; - uint8_t strip[3*256]; + uint8_t strip[3 * 256]; uint8_t *ptr; int green; int blue; @@ -144,5 +147,6 @@ int main(int argc, FAR char *argv[]) printf("tiff_finalize() failed: %d\n", ret); exit(1); } + return 0; } diff --git a/examples/usrsocktest/usrsocktest_remote_disconnect.c b/examples/usrsocktest/usrsocktest_remote_disconnect.c index 85aaf58d3..b5397df1f 100644 --- a/examples/usrsocktest/usrsocktest_remote_disconnect.c +++ b/examples/usrsocktest/usrsocktest_remote_disconnect.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/usrsocktest/usrsocktest_remote_disconnect.c + * apps/examples/usrsocktest/usrsocktest_remote_disconnect.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/examples/watchdog/watchdog.h b/examples/watchdog/watchdog.h index 4ab44dd5a..7c90ca6ff 100644 --- a/examples/watchdog/watchdog.h +++ b/examples/watchdog/watchdog.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/examples/watchdog/watchdog.h + * apps/examples/watchdog/watchdog.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -30,7 +30,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* CONFIG_NSH_BUILTIN_APPS - Build the WATCHDOG test as an NSH built-in * function. * CONFIG_EXAMPLES_WATCHDOG_DEVPATH - The path to the Watchdog device. diff --git a/include/interpreters/minibasic.h b/include/interpreters/minibasic.h index 083911c14..1520f30d6 100644 --- a/include/interpreters/minibasic.h +++ b/include/interpreters/minibasic.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/interpreters/minibasic/basic.c + * apps/include/interpreters/minibasic.h * * Copyright (C) 2016 Gregory Nutt. All rights reserved. * diff --git a/interpreters/minibasic/script.c b/interpreters/minibasic/script.c index 8d87ad0b8..1710433b6 100644 --- a/interpreters/minibasic/script.c +++ b/interpreters/minibasic/script.c @@ -1,6 +1,5 @@ - /**************************************************************************** - * apps/interpreters/minibasic/sript.c + * apps/interpreters/minibasic/script.c * Driver file for MiniBasic. * * Copyright (C) 2016 Gregory Nutt. All rights reserved. diff --git a/netutils/pppd/lcp.h b/netutils/pppd/lcp.h index a53a10dfa..c0d6951ba 100644 --- a/netutils/pppd/lcp.h +++ b/netutils/pppd/lcp.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/netutils/pppd/lpc.h + * apps/netutils/pppd/lcp.h * Link Configuration Protocol header file * * Version: .1 Original Version June 3, 2000 diff --git a/netutils/smtp/smtp.c b/netutils/smtp/smtp.c index 0b6d10514..83081361d 100644 --- a/netutils/smtp/smtp.c +++ b/netutils/smtp/smtp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/netutitls/smtp/smtp.c + * apps/netutils/smtp/smtp.c * smtp SMTP E-mail sender * * Copyright (C) 2007, 2009, 2011, 2015, 2020 Gregory Nutt. All rights @@ -258,7 +258,8 @@ static inline int smtp_send_message(int sockfd, struct smtp_state *psmtp) return ERROR; } - if (send(sockfd, g_smtpcrnlperiodcrnl, strlen(g_smtpcrnlperiodcrnl), 0) < 0) + if (send(sockfd, g_smtpcrnlperiodcrnl, + strlen(g_smtpcrnlperiodcrnl), 0) < 0) { return ERROR; } @@ -350,7 +351,8 @@ int smtp_send(void *handle, const char *to, const char *cc, const char *from, net_ipv4addr_copy(server.sin_addr.s_addr, psmtp->smtpserver); server.sin_port = psmtp->port; - if (connect(sockfd, (struct sockaddr *)&server, sizeof(struct sockaddr_in)) < 0) + if (connect(sockfd, (struct sockaddr *)&server, + sizeof(struct sockaddr_in)) < 0) { close(sockfd); return ERROR; @@ -368,7 +370,8 @@ void *smtp_open(void) { /* Allocate the handle */ - struct smtp_state *psmtp = (struct smtp_state *)malloc(sizeof(struct smtp_state)); + struct smtp_state *psmtp = + (struct smtp_state *)malloc(sizeof(struct smtp_state)); if (psmtp) { /* Initialize the handle */ diff --git a/system/hexed/src/hexcopy.c b/system/hexed/src/hexcopy.c index b735dda88..99b94c5f5 100644 --- a/system/hexed/src/hexcopy.c +++ b/system/hexed/src/hexcopy.c @@ -1,10 +1,12 @@ /**************************************************************************** - * apps/system/hexed/src/hexcopy.c - hexed copy command + * apps/system/hexed/src/hexcopy.c + * hexed copy command * * Copyright (c) 2011, B.ZaaR, All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * modification, are permitted provided that the following conditions are + * met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. @@ -17,17 +19,17 @@ * products derived from this software without specific prior written * permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ @@ -131,32 +133,30 @@ static int setcopy(FAR struct command_s *cmd, int optc, char *opt) switch (optc) { - case 0: - /* Set source */ - - cmd->opts.src = v; - optc++; - break; - - case 1: - /* Set destination */ - - cmd->opts.dest = v; - optc++; - break; - - case 2: - /* Set length */ - - cmd->opts.len = v; - cmd->opts.bytes = cmd->opts.len * cmd->opts.word; - optc = 0; - break; - - default: - /* Too many options specified */ - - return -E2BIG; + case 0: /* Set source */ + { + cmd->opts.src = v; + optc++; + } + break; + + case 1: /* Set destination */ + { + cmd->opts.dest = v; + optc++; + } + break; + + case 2: /* Set length */ + { + cmd->opts.len = v; + cmd->opts.bytes = cmd->opts.len * cmd->opts.word; + optc = 0; + } + break; + + default: /* Too many options specified */ + return -E2BIG; } return optc;