mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
style: Fix coding style violations in nuttx-apps
Fix various coding style issues including: - Case statement formatting - Include placement and ordering - Whitespace issues - Long line formatting - Bracket alignment Affected modules: - audioutils, examples, include - netutils, system Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
This commit is contained in:
parent
63f61d080a
commit
4e8a0ae4c4
15 changed files with 64 additions and 38 deletions
|
|
@ -169,15 +169,33 @@ static int calc_samples(int fs, int tempo, int num, int dots)
|
|||
|
||||
switch (num)
|
||||
{
|
||||
case 0: n = 3; break;
|
||||
case 1: n = 2; break;
|
||||
case 2: n = 1; break;
|
||||
case 4: n = 0; break;
|
||||
case 8: div = 1; break;
|
||||
case 16: div = 2; break;
|
||||
case 32: div = 3; break;
|
||||
case 64: div = 4; break;
|
||||
default: div = -1; break;
|
||||
case 0:
|
||||
n = 3;
|
||||
break;
|
||||
case 1:
|
||||
n = 2;
|
||||
break;
|
||||
case 2:
|
||||
n = 1;
|
||||
break;
|
||||
case 4:
|
||||
n = 0;
|
||||
break;
|
||||
case 8:
|
||||
div = 1;
|
||||
break;
|
||||
case 16:
|
||||
div = 2;
|
||||
break;
|
||||
case 32:
|
||||
div = 3;
|
||||
break;
|
||||
case 64:
|
||||
div = 4;
|
||||
break;
|
||||
default:
|
||||
div = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (dots <= 4)
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ static int sigusr2_rcvd = 0;
|
|||
* Name: siguser_action
|
||||
****************************************************************************/
|
||||
|
||||
/* 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,
|
||||
/* NOTE: it is necessary for functions that are referred to by function
|
||||
* pointers to be declared with global scope (at least for ARM). Otherwise,
|
||||
* a relocation type that is not supported by ELF is generated by GCC.
|
||||
*/
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Verify that the handler that was removed was siguser_action */
|
||||
|
||||
if ((void*)act.sa_handler != (void*)siguser_action)
|
||||
if ((void *)act.sa_handler != (void *)siguser_action)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Old SIGUSR2 signal handler (%p) is not siguser_action (%p)\n",
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
const struct struct_dummy_s dummy_struct =
|
||||
{
|
||||
DUMMY_SCALAR_VALUE3
|
||||
DUMMY_SCALAR_VALUE3
|
||||
};
|
||||
|
||||
int dummy_scalar = DUMMY_SCALAR_VALUE2;
|
||||
|
|
|
|||
|
|
@ -97,8 +97,8 @@ int create_ramdisk(void)
|
|||
ret = mkfatfs(g_source, &g_fmt);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("create_ramdisk: Failed to create FAT filesystem on ramdisk at %s\n",
|
||||
g_source);
|
||||
printf("create_ramdisk: Failed to create FAT filesystem on "
|
||||
"ramdisk at %s\n", g_source);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
* buffering s not yet support for UDP)
|
||||
*/
|
||||
|
||||
|
||||
#ifndef CONFIG_NET
|
||||
# error Network socket support not enabled
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -66,8 +66,8 @@ static int sigusr2_rcvd = 0;
|
|||
* Name: siguser_action
|
||||
****************************************************************************/
|
||||
|
||||
/* 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,
|
||||
/* NOTE: it is necessary for functions that are referred to by function
|
||||
* pointers to be declared with global scope (at least for ARM). Otherwise,
|
||||
* a relocation type that is not supported by ELF is generated by GCC.
|
||||
*/
|
||||
|
||||
|
|
@ -225,7 +225,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* Verify that the handler that was removed was siguser_action */
|
||||
|
||||
if ((void*)act.sa_handler != (void*)siguser_action)
|
||||
if ((void *)act.sa_handler != (void *)siguser_action)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Old SIGUSR2 signal handler (%p) is not siguser_action (%p)\n",
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
const struct struct_dummy_s dummy_struct =
|
||||
{
|
||||
DUMMY_SCALAR_VALUE3
|
||||
DUMMY_SCALAR_VALUE3
|
||||
};
|
||||
|
||||
int dummy_scalar = DUMMY_SCALAR_VALUE2;
|
||||
|
|
|
|||
|
|
@ -51,10 +51,14 @@ static void show_usage(FAR const char *progname, FAR FILE *stream,
|
|||
int exit_code)
|
||||
{
|
||||
fprintf(stream, "USAGE:\n");
|
||||
fprintf(stream, "\t%s -uid <uid> - Show user info by ID\n", progname);
|
||||
fprintf(stream, "\t%s -uname <name> - Show user info by name\n", progname);
|
||||
fprintf(stream, "\t%s -gid <gid> - Show group info by ID\n", progname);
|
||||
fprintf(stream, "\t%s -gname <name> - Show group info by name\n", progname);
|
||||
fprintf(stream, "\t%s -uid <uid> - Show user info by ID\n",
|
||||
progname);
|
||||
fprintf(stream, "\t%s -uname <name> - Show user info by name\n",
|
||||
progname);
|
||||
fprintf(stream, "\t%s -gid <gid> - Show group info by ID\n",
|
||||
progname);
|
||||
fprintf(stream, "\t%s -gname <name> - Show group info by name\n",
|
||||
progname);
|
||||
fprintf(stream, "\t%s -h - Show this help info\n", progname);
|
||||
exit(exit_code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,13 +96,13 @@ int obd_send_request(FAR struct obd_dev_s *dev, uint8_t opmode, uint8_t pid);
|
|||
* Wait for a message from ECUs with requested PID that was sent using
|
||||
* obd_send_request().
|
||||
*
|
||||
* It will return an error case it doesn't receive the msg after the elapsed
|
||||
* "timeout" time.
|
||||
* It will return an error case it doesn't receive the msg after the
|
||||
* elapsed "timeout" time.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int obd_wait_response(FAR struct obd_dev_s *dev, uint8_t opmode, uint8_t pid,
|
||||
int timeout);
|
||||
int obd_wait_response(FAR struct obd_dev_s *dev, uint8_t opmode,
|
||||
uint8_t pid, int timeout);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: obd_decode_pid
|
||||
|
|
@ -116,4 +116,4 @@ int obd_wait_response(FAR struct obd_dev_s *dev, uint8_t opmode, uint8_t pid,
|
|||
|
||||
FAR char *obd_decode_pid(FAR struct obd_dev_s *dev, uint8_t pid);
|
||||
|
||||
#endif /*__APPS_INCLUDE_CANUTILS_OBD_H */
|
||||
#endif /* __APPS_INCLUDE_CANUTILS_OBD_H */
|
||||
|
|
|
|||
|
|
@ -104,7 +104,8 @@ uint8_t abnt_codi_checksum(FAR const uint8_t *data);
|
|||
|
||||
/* Parse a specific ABNT CODI sequence. */
|
||||
|
||||
bool abnt_codi_parse(FAR const uint8_t *data, FAR struct abnt_codi_proto_s *proto);
|
||||
bool abnt_codi_parse(FAR const uint8_t *data,
|
||||
FAR struct abnt_codi_proto_s *proto);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,9 +68,9 @@ bool netlib_ipv4addrconv(FAR const char *addrstr, FAR uint8_t *ipaddr)
|
|||
{
|
||||
ch = *addrstr++;
|
||||
if (++j > 4)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ch == '.' || ch == 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ void ahdlc_rx_ready(FAR struct ppp_context_s *ctx);
|
|||
|
||||
uint8_t ahdlc_rx(FAR struct ppp_context_s *ctx, uint8_t);
|
||||
uint8_t ahdlc_tx(FAR struct ppp_context_s *ctx, uint16_t protocol,
|
||||
FAR uint8_t *header, FAR uint8_t *buffer, uint16_t headerlen,
|
||||
uint16_t datalen);
|
||||
FAR uint8_t *header, FAR uint8_t *buffer,
|
||||
uint16_t headerlen, uint16_t datalen);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
/* PAP state machine flags */
|
||||
|
||||
/* Client only */
|
||||
|
||||
#define PAP_TX_UP 0x01
|
||||
|
|
|
|||
|
|
@ -54,7 +54,9 @@
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/* 'file' must be allocated by caller and will be filled in by the function. */
|
||||
/* 'file' must be allocated by caller and will be filled in by the
|
||||
* function.
|
||||
*/
|
||||
|
||||
#if defined(CONFIG_NETUTILS_HTTPD_SENDFILE)
|
||||
|
||||
|
|
|
|||
|
|
@ -103,8 +103,9 @@ static void show_usage(FAR const char *progrname, int exitcode)
|
|||
fprintf(stderr, "-a:\n");
|
||||
fprintf(stderr, "\tAppend to the file (vs. truncating)\n");
|
||||
fprintf(stderr, "file:\n");
|
||||
fprintf(stderr, "\tArbitrary number of options output files. Output\n");
|
||||
fprintf(stderr, "\twill go to stdout in addition to each of these files.\n");
|
||||
fprintf(stderr, "\tArbitrary number of options output files. Output\n");
|
||||
fprintf(stderr, "\twill go to stdout in addition to each of these\n");
|
||||
fprintf(stderr, "\tfiles.\n");
|
||||
fprintf(stderr, "-h:\n");
|
||||
fprintf(stderr, "\tShows this message and exits\n");
|
||||
exit(exitcode);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue