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
This commit is contained in:
simbit18 2024-04-17 15:18:50 +02:00 committed by Xiang Xiao
parent 7159f09375
commit 000a8bcdf1
16 changed files with 81 additions and 67 deletions

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -30,7 +30,9 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* This test depends on these specific CAN configurations settings (your /* This test depends on these specific CAN configurations settings (your
* specific CAN settings might require additional settings). * specific CAN settings might require additional settings).
* *
@ -41,7 +43,8 @@
* Specific configuration options for this example include: * Specific configuration options for this example include:
* *
* CONFIG_CAN_LOOPBACK * 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 * CONFIG_EXAMPLES_CAN_NMSGS - This number of CAN message is collected and
* the program terminates. Default: 32. * the program terminates. Default: 32.
* CONFIG_EXAMPLES_CAN_READ - Only receive messages * CONFIG_EXAMPLES_CAN_READ - Only receive messages

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -47,9 +47,11 @@ static char no_name[] = "<noname>";
* Privite Functions * Privite Functions
****************************************************************************/ ****************************************************************************/
/* NOTE: it is necessary for functions that are referred to by function pointers /* NOTE: it is necessary for functions that are referred to by
* pointer to be declared with global scope (at least for ARM). Otherwise, * function pointers pointer to be declared with global scope
* a relocation type that is not supported by ELF is generated by GCC. * (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) int child_task(int argc, char **argv)
@ -113,7 +115,8 @@ int main(int argc, char **argv)
child_argv[0] = child_arg; child_argv[0] = child_arg;
child_argv[1] = 0; 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) if (child_pid < 0)
{ {
printf("Parent: task_create failed: %d\n", errno); printf("Parent: task_create failed: %d\n", errno);

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -46,7 +46,7 @@ FAR void *nxdemo_listener(FAR void *arg)
/* Process events forever */ /* Process events forever */
for (;;) for (; ; )
{ {
/* Handle the next event. If we were configured blocking, then /* Handle the next event. If we were configured blocking, then
* we will stay right here until the next event is received. Since * we will stay right here until the next event is received. Since

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -46,7 +46,7 @@ FAR void *nximage_listener(FAR void *arg)
/* Process events forever */ /* Process events forever */
for (;;) for (; ; )
{ {
/* Handle the next event. If we were configured blocking, then /* Handle the next event. If we were configured blocking, then
* we will stay right here until the next event is received. Since * we will stay right here until the next event is received. Since

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -46,7 +46,7 @@ FAR void *nxlines_listener(FAR void *arg)
/* Process events forever */ /* Process events forever */
for (;;) for (; ; )
{ {
/* Handle the next event. If we were configured blocking, then /* Handle the next event. If we were configured blocking, then
* we will stay right here until the next event is received. Since * we will stay right here until the next event is received. Since

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -33,10 +33,13 @@
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* 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 /* This is a simple unit test for the TIFF creation library at
* tested in any other environment. * 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: * Other configuration options:
* *
@ -88,7 +91,7 @@
int main(int argc, FAR char *argv[]) int main(int argc, FAR char *argv[])
{ {
struct tiff_info_s info; struct tiff_info_s info;
uint8_t strip[3*256]; uint8_t strip[3 * 256];
uint8_t *ptr; uint8_t *ptr;
int green; int green;
int blue; int blue;
@ -144,5 +147,6 @@ int main(int argc, FAR char *argv[])
printf("tiff_finalize() failed: %d\n", ret); printf("tiff_finalize() failed: %d\n", ret);
exit(1); exit(1);
} }
return 0; return 0;
} }

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -30,7 +30,9 @@
/**************************************************************************** /****************************************************************************
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
/* Configuration ************************************************************/ /* Configuration ************************************************************/
/* CONFIG_NSH_BUILTIN_APPS - Build the WATCHDOG test as an NSH built-in /* CONFIG_NSH_BUILTIN_APPS - Build the WATCHDOG test as an NSH built-in
* function. * function.
* CONFIG_EXAMPLES_WATCHDOG_DEVPATH - The path to the Watchdog device. * CONFIG_EXAMPLES_WATCHDOG_DEVPATH - The path to the Watchdog device.

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* apps/interpreters/minibasic/basic.c * apps/include/interpreters/minibasic.h
* *
* Copyright (C) 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2016 Gregory Nutt. All rights reserved.
* *

View File

@ -1,6 +1,5 @@
/**************************************************************************** /****************************************************************************
* apps/interpreters/minibasic/sript.c * apps/interpreters/minibasic/script.c
* Driver file for MiniBasic. * Driver file for MiniBasic.
* *
* Copyright (C) 2016 Gregory Nutt. All rights reserved. * Copyright (C) 2016 Gregory Nutt. All rights reserved.

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* apps/netutils/pppd/lpc.h * apps/netutils/pppd/lcp.h
* Link Configuration Protocol header file * Link Configuration Protocol header file
* *
* Version: .1 Original Version June 3, 2000 * Version: .1 Original Version June 3, 2000

View File

@ -1,5 +1,5 @@
/**************************************************************************** /****************************************************************************
* apps/netutitls/smtp/smtp.c * apps/netutils/smtp/smtp.c
* smtp SMTP E-mail sender * smtp SMTP E-mail sender
* *
* Copyright (C) 2007, 2009, 2011, 2015, 2020 Gregory Nutt. All rights * 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; return ERROR;
} }
if (send(sockfd, g_smtpcrnlperiodcrnl, strlen(g_smtpcrnlperiodcrnl), 0) < 0) if (send(sockfd, g_smtpcrnlperiodcrnl,
strlen(g_smtpcrnlperiodcrnl), 0) < 0)
{ {
return ERROR; 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); net_ipv4addr_copy(server.sin_addr.s_addr, psmtp->smtpserver);
server.sin_port = psmtp->port; 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); close(sockfd);
return ERROR; return ERROR;
@ -368,7 +370,8 @@ void *smtp_open(void)
{ {
/* Allocate the handle */ /* 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) if (psmtp)
{ {
/* Initialize the handle */ /* Initialize the handle */

View File

@ -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. * Copyright (c) 2011, B.ZaaR, All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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, * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer. * this list of conditions and the following disclaimer.
@ -17,17 +19,17 @@
* products derived from this software without specific prior written * products derived from this software without specific prior written
* permission. * permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* POSSIBILITY OF SUCH DAMAGE. * 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) switch (optc)
{ {
case 0: case 0: /* Set source */
/* Set source */ {
cmd->opts.src = v;
optc++;
}
break;
cmd->opts.src = v; case 1: /* Set destination */
optc++; {
break; cmd->opts.dest = v;
optc++;
}
break;
case 1: case 2: /* Set length */
/* Set destination */ {
cmd->opts.len = v;
cmd->opts.bytes = cmd->opts.len * cmd->opts.word;
optc = 0;
}
break;
cmd->opts.dest = v; default: /* Too many options specified */
optc++; return -E2BIG;
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; return optc;