From 6734983f468ce3242bf85f80d15b49ac24e79412 Mon Sep 17 00:00:00 2001 From: Huang Qi Date: Sat, 27 Jul 2024 22:09:09 +0800 Subject: [PATCH] Fix some style issues Modified files: - examples/pdcurses/xmas_main.c - examples/system/system_main.c - examples/touchscreen/tc.h - fsutils/flash_eraseall/flash_eraseall.c - fsutils/passwd/passwd_append.c - fsutils/passwd/passwd_delete.c - fsutils/passwd/passwd_lock.c - graphics/pdcurs34/include/term.h - graphics/pdcurs34/pdcurses/pdc_keyname.c - graphics/pdcurs34/pdcurses/pdc_touch.c - graphics/tiff/tiff_internal.h - include/canutils/obd.h - include/industry/abnt_codi.h - netutils/chat/chat.h - netutils/netlib/netlib_ipv4addrconv.c - netutils/pppd/ahdlc.c - netutils/pppd/ahdlc.h - netutils/pppd/pap.h - netutils/webserver/httpd.h - netutils/webserver/httpd_fs.c Signed-off-by: Huang Qi --- examples/pdcurses/xmas_main.c | 4 ++-- examples/system/system_main.c | 6 +++++- examples/touchscreen/tc.h | 2 ++ fsutils/flash_eraseall/flash_eraseall.c | 3 ++- fsutils/passwd/passwd_append.c | 4 ++-- fsutils/passwd/passwd_delete.c | 8 ++++---- fsutils/passwd/passwd_lock.c | 1 + graphics/pdcurs34/include/term.h | 2 +- graphics/pdcurs34/pdcurses/pdc_keyname.c | 2 +- graphics/pdcurs34/pdcurses/pdc_touch.c | 2 +- graphics/tiff/tiff_internal.h | 2 +- include/canutils/obd.h | 6 +++--- include/industry/abnt_codi.h | 3 ++- netutils/chat/chat.h | 8 ++++---- netutils/netlib/netlib_ipv4addrconv.c | 6 +++--- netutils/pppd/ahdlc.c | 4 +++- netutils/pppd/ahdlc.h | 4 ++-- netutils/pppd/pap.h | 1 + netutils/webserver/httpd.h | 2 +- netutils/webserver/httpd_fs.c | 8 +++++--- 20 files changed, 46 insertions(+), 32 deletions(-) diff --git a/examples/pdcurses/xmas_main.c b/examples/pdcurses/xmas_main.c index 3168b509e20..1a337d75358 100644 --- a/examples/pdcurses/xmas_main.c +++ b/examples/pdcurses/xmas_main.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/examples/pdcurses/tui.c + * apps/examples/pdcurses/xams_main.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -53,7 +53,6 @@ #define SHOW(win, pause) mvwin(win, y_pos, x_pos); wrefresh(win); \ wrefresh(w_del_msg); napms(pause) - /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -849,6 +848,7 @@ int main(int argc, FAR char *argv[]) strng5(); /* set up the windows for our blinking trees */ + /* treescrn3 */ overlay(treescrn, treescrn3); diff --git a/examples/system/system_main.c b/examples/system/system_main.c index 7b48e5bc87e..61095711ecb 100644 --- a/examples/system/system_main.c +++ b/examples/system/system_main.c @@ -28,7 +28,11 @@ #include /**************************************************************************** - * Name: system_main + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: main ****************************************************************************/ int main(int argc, FAR char *argv[]) diff --git a/examples/touchscreen/tc.h b/examples/touchscreen/tc.h index d525eee5f4e..7d0ae9f188b 100644 --- a/examples/touchscreen/tc.h +++ b/examples/touchscreen/tc.h @@ -30,7 +30,9 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ + /* CONFIG_EXAMPLES_TOUCHSCREEN_MINOR - The minor device number. Minor=N * corresponds to touchscreen device /dev/input0. Note this value must * with CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH. Default 0. diff --git a/fsutils/flash_eraseall/flash_eraseall.c b/fsutils/flash_eraseall/flash_eraseall.c index 36a4cbd1ccd..1b031c698a3 100644 --- a/fsutils/flash_eraseall/flash_eraseall.c +++ b/fsutils/flash_eraseall/flash_eraseall.c @@ -69,7 +69,8 @@ int flash_eraseall(FAR const char *driver) if (ret < 0) { errcode = errno; - ferr("ERROR: MTD ioctl(%04x) failed: %d\n", MTDIOC_BULKERASE, errcode); + ferr("ERROR: MTD ioctl(%04x) failed: %d\n", + MTDIOC_BULKERASE, errcode); ret = -errcode; } diff --git a/fsutils/passwd/passwd_append.c b/fsutils/passwd/passwd_append.c index 32f7a038101..ed8f87a2689 100644 --- a/fsutils/passwd/passwd_append.c +++ b/fsutils/passwd/passwd_append.c @@ -64,11 +64,11 @@ int passwd_append(FAR const char *username, FAR const char *password) stream = fopen(CONFIG_FSUTILS_PASSWD_PATH, "a"); if (stream == NULL) - { + { int errcode = errno; DEBUGASSERT(errcode > 0); return errcode; - } + } /* The format of the password file is: * diff --git a/fsutils/passwd/passwd_delete.c b/fsutils/passwd/passwd_delete.c index 5ac12be9425..96d19589041 100644 --- a/fsutils/passwd/passwd_delete.c +++ b/fsutils/passwd/passwd_delete.c @@ -107,10 +107,10 @@ static int passwd_copyfile(FAR char *iobuffer, FILE *instream, { /* End of file encountered. * - * This occurs normally when copying to the end-of-the file. - * In that case, the caller just sticks a huge number in for - * copysize and lets the end-of-file indication terminate the - * copy. + * This occurs normally when copying to the end-of-the + * file. In that case, the caller just sticks a huge number + * in for copysize and lets the end-of-file indication + * terminate the copy. */ eof = true; diff --git a/fsutils/passwd/passwd_lock.c b/fsutils/passwd/passwd_lock.c index 1ed64d62e7d..03f12977151 100644 --- a/fsutils/passwd/passwd_lock.c +++ b/fsutils/passwd/passwd_lock.c @@ -55,6 +55,7 @@ static sem_t g_passwd_sem = SEM_INITIALIZER(1); /**************************************************************************** * Public Functions ****************************************************************************/ + /**************************************************************************** * Name: passwd_lock * diff --git a/graphics/pdcurs34/include/term.h b/graphics/pdcurs34/include/term.h index 2298f1def68..b15c45e4019 100644 --- a/graphics/pdcurs34/include/term.h +++ b/graphics/pdcurs34/include/term.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/graphics/pdcurses/term.h + * apps/graphics/pdcurs34/include/term.h * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/graphics/pdcurs34/pdcurses/pdc_keyname.c b/graphics/pdcurs34/pdcurses/pdc_keyname.c index 15d6d046fbd..c5a4921735a 100644 --- a/graphics/pdcurs34/pdcurses/pdc_keyname.c +++ b/graphics/pdcurs34/pdcurses/pdc_keyname.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/graphics/pdcurses/pdc_keyname.c + * apps/graphics/pdcurs34/pdcurses/pdc_keyname.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/graphics/pdcurs34/pdcurses/pdc_touch.c b/graphics/pdcurs34/pdcurses/pdc_touch.c index 3c4a2c7c52d..5eda71905e7 100644 --- a/graphics/pdcurs34/pdcurses/pdc_touch.c +++ b/graphics/pdcurs34/pdcurses/pdc_touch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/graphics/pdcurses/pdc_touch.c + * apps/graphics/pdcurs34/pdcurses/pdc_touch.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/graphics/tiff/tiff_internal.h b/graphics/tiff/tiff_internal.h index 00bc6515b6f..49e09dc1e3e 100644 --- a/graphics/tiff/tiff_internal.h +++ b/graphics/tiff/tiff_internal.h @@ -80,7 +80,7 @@ extern "C" #endif /**************************************************************************** - * Public Functions + * Public Function Prototypes ****************************************************************************/ /**************************************************************************** diff --git a/include/canutils/obd.h b/include/canutils/obd.h index 6d9b294d858..651a2cdda51 100644 --- a/include/canutils/obd.h +++ b/include/canutils/obd.h @@ -94,8 +94,8 @@ 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. * ****************************************************************************/ @@ -114,4 +114,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 */ diff --git a/include/industry/abnt_codi.h b/include/industry/abnt_codi.h index c84aee45f97..c20a344ba46 100644 --- a/include/industry/abnt_codi.h +++ b/include/industry/abnt_codi.h @@ -102,7 +102,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 } diff --git a/netutils/chat/chat.h b/netutils/chat/chat.h index 61fcef637a4..84dce4d5ea0 100644 --- a/netutils/chat/chat.h +++ b/netutils/chat/chat.h @@ -74,15 +74,15 @@ struct chat_line /* type-1 chat line expected string */ - FAR char* expect; + FAR char *expect; } lhs; /* type 0: command argument * type 1: string to be sent */ - FAR char* rhs; - FAR struct chat_line* next; /* pointer to the next line in the script */ + FAR char *rhs; + FAR struct chat_line *next; /* pointer to the next line in the script */ }; /* Chat private state. */ @@ -90,7 +90,7 @@ struct chat_line struct chat { struct chat_ctl ctl; /* Embedded 'chat_ctl' type. */ - FAR struct chat_line* script; /* first line of the script */ + FAR struct chat_line *script; /* first line of the script */ }; #endif /* __APPS_NETUTILS_CHAT_CHAT_H */ diff --git a/netutils/netlib/netlib_ipv4addrconv.c b/netutils/netlib/netlib_ipv4addrconv.c index 1341eab76fd..381eed59cec 100644 --- a/netutils/netlib/netlib_ipv4addrconv.c +++ b/netutils/netlib/netlib_ipv4addrconv.c @@ -71,9 +71,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) { diff --git a/netutils/pppd/ahdlc.c b/netutils/pppd/ahdlc.c index 1725cffc5ee..b1724e25935 100644 --- a/netutils/pppd/ahdlc.c +++ b/netutils/pppd/ahdlc.c @@ -161,7 +161,9 @@ uint8_t ahdlc_rx(FAR struct ppp_context_s *ctx, uint8_t c) ctx->ahdlc_flags &= ~PPP_ESCAPED; - /* If value is 0x7e then silently discard and reset receive packet */ + /* If value is 0x7e then silently discard and reset receive + * packet + */ if (c == 0x7e) { diff --git a/netutils/pppd/ahdlc.h b/netutils/pppd/ahdlc.h index 8ed51ff5d46..a3846f76aa3 100644 --- a/netutils/pppd/ahdlc.h +++ b/netutils/pppd/ahdlc.h @@ -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 diff --git a/netutils/pppd/pap.h b/netutils/pppd/pap.h index 402ef0f71e3..fa43c9827ac 100644 --- a/netutils/pppd/pap.h +++ b/netutils/pppd/pap.h @@ -56,6 +56,7 @@ ****************************************************************************/ /* PAP state machine flags */ + /* Client only */ #define PAP_TX_UP 0x01 diff --git a/netutils/webserver/httpd.h b/netutils/webserver/httpd.h index 0a28fce1259..3832f7e669c 100644 --- a/netutils/webserver/httpd.h +++ b/netutils/webserver/httpd.h @@ -56,7 +56,7 @@ * 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) diff --git a/netutils/webserver/httpd_fs.c b/netutils/webserver/httpd_fs.c index fb095c0636b..154201bed97 100644 --- a/netutils/webserver/httpd_fs.c +++ b/netutils/webserver/httpd_fs.c @@ -38,7 +38,7 @@ ****************************************************************************/ /**************************************************************************** - * Included Header Files + * Included Files ****************************************************************************/ #include @@ -69,7 +69,7 @@ static uint8_t httpd_fs_strcmp(const char *str1, const char *str2) int i; i = 0; - for (;;) + for (; ; ) { if (str2[i] == 0 || str1[i] == '\r' || str1[i] == '\n') { @@ -109,6 +109,7 @@ int httpd_fs_open(const char *name, struct httpd_fs_file *file) #endif return OK; } + #ifdef CONFIG_NETUTILS_HTTPDFSSTATS ++i; #endif @@ -122,7 +123,7 @@ void httpd_fs_init(void) #ifdef CONFIG_NETUTILS_HTTPDFSSTATS uint16_t i; - count = (uint16_t*)malloc(g_httpd_numfiles * sizeof(uint16_t)); + count = (uint16_t *)malloc(g_httpd_numfiles * sizeof(uint16_t)); for (i = 0; i < g_httpd_numfiles; i++) { @@ -146,6 +147,7 @@ uint16_t httpd_fs_count(char *name) { return count[i]; } + ++i; }