From 7251645685cb72727ba63cc19209b7e13a0c709d Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Wed, 16 Aug 2023 01:41:18 +0800 Subject: [PATCH] Fix some coding style issue Signed-off-by: Xiang Xiao --- examples/ft80x/ft80x_main.c | 16 +++--- examples/pdcurses/testcurs_main.c | 43 +++++++++------- lte/alt1250/alt1250_util.h | 2 +- netutils/thttpd/mime_types.h | 2 +- netutils/thttpd/tdate_parse.c | 72 +++++++++++++++++---------- testing/crypto/hmac.c | 2 +- testing/drivertest/drivertest_audio.c | 2 +- 7 files changed, 82 insertions(+), 57 deletions(-) diff --git a/examples/ft80x/ft80x_main.c b/examples/ft80x/ft80x_main.c index c889197472..06a1111233 100644 --- a/examples/ft80x/ft80x_main.c +++ b/examples/ft80x/ft80x_main.c @@ -61,13 +61,13 @@ struct ft80x_exampleinfo_s * ft80x_prim_lines LINES Line drawing primitive * ft80x_prim_linestrip LINE_STRIP Line strip drawing primitive * ft80x_prim_edgestrip_r EDGE_STRIP_R Edge strip right side drawing - primitive + * primitive * (To be provided) EDGE_STRIP_L Edge strip left side drawing - primitive + * primitive * (To be provided) EDGE_STRIP_A Edge strip above side drawing - primitive + * primitive * (To be provided) EDGE_STRIP_B Edge strip below side drawing - primitive + * primitive * ft80x_prim_rectangles RECTS Rectangle drawing primitive * ft80x_prim_scissor SCISSOR Scissor primitive * ft80x_prim_stencil STENCIL Stencil primitives @@ -96,7 +96,7 @@ static const struct ft80x_exampleinfo_s g_primitives[] = * possible options. * * FUNCTION CoProc CMD USED DESCRIPTION - * ------------------------ --------------- ---------------------------------- + * ------------------------ --------------- -------------------------------- * ft80x_coproc_button CMD_BUTTON Draw a button * ft80x_coproc_clock CMD_CLOCK Draw an analog clock * ft80x_coproc_gauge CMD_GAUGE Draw a gauge @@ -109,12 +109,12 @@ static const struct ft80x_exampleinfo_s g_primitives[] = * ft80x_coproc_toggle CMD_TOGGLE Draw a toggle switch * ft80x_coproc_number CMD_NUMBER Draw a decimal number * ft80x_coproc_calibrate CMD_CALIBRATE Execute the touch screen - calibration routine + * calibration routine * ft80x_coproc_spinner CMD_SPINNER Start an animated spinner * ft80x_coproc_screensaver CMD_SCREENSAVER Start an animated screensaver * (To be provided) CMD_SKETCH Start a continuous sketch update * (To be provided) CMD_SNAPSHOT Take a snapshot of the current - screen + * screen * ft80x_coproc_logo CMD_LOGO Play device log animation */ @@ -180,7 +180,7 @@ static int ft80x_showname(int fd, FAR struct ft80x_dlbuffer_s *buffer, /* Clear the display */ cmds.clearrgb.cmd = FT80X_CLEAR_COLOR_RGB(0, 0, 0x80); - cmds.clear.cmd = FT80X_CLEAR(1 ,1, 1); + cmds.clear.cmd = FT80X_CLEAR(1, 1, 1); cmds.colorrgb.cmd = FT80X_COLOR_RGB(0xff, 0xff, 0xff); /* Use the CMD_TEXT co-processor command to show the name of the next diff --git a/examples/pdcurses/testcurs_main.c b/examples/pdcurses/testcurs_main.c index 14d2951d2f..abec88a9d9 100644 --- a/examples/pdcurses/testcurs_main.c +++ b/examples/pdcurses/testcurs_main.c @@ -33,10 +33,6 @@ #include "graphics/curses.h" -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - #ifdef WACS_S1 # define HAVE_WIDE 1 #else @@ -49,6 +45,10 @@ # include #endif +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + #ifdef A_COLOR # define HAVE_COLOR 1 #else @@ -112,15 +112,15 @@ static const COMMAND command[] = {"Scroll Test", scroll_test}, {"Input Test", input_test}, {"Output Test", output_test}, - {"ACS Test", acs_test} + {"ACS Test", acs_test}, #if HAVE_COLOR - , {"Color Test", color_test} + {"Color Test", color_test}, #endif #if HAVE_CLIPBOARD - , {"Clipboard Test", clipboard_test} + {"Clipboard Test", clipboard_test}, #endif #if HAVE_WIDE - , {"Wide Input", wide_test} + {"Wide Input", wide_test}, #endif }; @@ -139,9 +139,9 @@ static const char *acs_names[] = "ACS_PLMINUS", "ACS_BULLET", "ACS_LARROW", "ACS_RARROW", "ACS_UARROW", "ACS_DARROW", - "ACS_BOARD", "ACS_LANTERN", "ACS_BLOCK" + "ACS_BOARD", "ACS_LANTERN", "ACS_BLOCK", #ifdef ACS_S3 - , "ACS_S3", "ACS_S7", "ACS_LEQUAL", "ACS_GEQUAL", + "ACS_S3", "ACS_S7", "ACS_LEQUAL", "ACS_GEQUAL", "ACS_PI", "ACS_NEQUAL", "ACS_STERLING" #endif }; @@ -240,6 +240,7 @@ static int init_test(WINDOW ** win, int argc, char *argv[]) start_color(); } #endif + /* Create a drawing window */ width = 60; @@ -357,7 +358,7 @@ static void input_test(WINDOW *win) sw = w / 3; sh = h / 3; - if ((subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2)) == NULL) + if (!(subWin = subwin(win, sh, sw, by + h - sh - 2, bx + w - sw - 2))) { return; } @@ -679,7 +680,7 @@ static void output_test(WINDOW *win) wattron(win1, A_BLINK); mvwaddstr(win1, 4, 1, - "This blinking text should appear in only the second window"); + "This blinking text should appear in only the second window"); wattroff(win1, A_BLINK); mvwin(win1, by, bx); @@ -726,7 +727,7 @@ static void output_test(WINDOW *win) wclear(win); wmove(win, 2, 2); - wprintw(win, "This is a formatted string in a window: %d %s\n", 42, "is it"); + wprintw(win, "This is a formatted string in a window: %d is it\n", 42); mvwaddstr(win, 10, 1, "Enter a string: "); wrefresh(win); echo(); @@ -890,7 +891,8 @@ static void clipboard_test(WINDOW *win) FAR struct pdc_context_s *ctx = PDC_ctx(); #endif - mvaddstr(1, 1, "This test will display the contents of the system clipboard"); + mvaddstr(1, 1, + "This test will display the contents of the system clipboard"); continue2(); @@ -923,7 +925,7 @@ static void clipboard_test(WINDOW *win) clear(); mvaddstr(1, 1, - "This test will place the following string in the system clipboard:"); + "This test will place the following string in the system clipboard:"); mvaddstr(2, 1, text); i = PDC_setclipboard(text, strlen(text)); @@ -1077,7 +1079,8 @@ static void color_test(WINDOW *win) for (j = 0; j < 16; j++) { mvaddch(tmarg + i + 5, col2 + j, fill | COLOR_PAIR(i + 4)); - mvaddch(tmarg + i + 5, col3 + j, fill | COLOR_PAIR(i + 4) | A_BOLD); + mvaddch(tmarg + i + 5, col3 + j, + fill | COLOR_PAIR(i + 4) | A_BOLD); } } @@ -1094,7 +1097,7 @@ static void color_test(WINDOW *win) short red; short green; short blue; - } orgcolors[16]; + }orgcolors[16]; int MAXCOL = (COLORS >= 16) ? 16 : 8; @@ -1130,7 +1133,8 @@ static void color_test(WINDOW *win) for (i = 0; i < MAXCOL; i++) { - init_color(i, orgcolors[i].red, orgcolors[i].green, orgcolors[i].blue); + init_color(i, orgcolors[i].red, + orgcolors[i].green, orgcolors[i].blue); } } } @@ -1175,7 +1179,8 @@ void display_menu(int old_option, int new_option) #ifdef CONFIG_PDCURSES_MULTITHREAD FAR struct pdc_context_s *ctx = PDC_ctx(); #endif - int lmarg = (COLS - 14) / 2, tmarg = (LINES - (MAX_OPTIONS + 2)) / 2; + int lmarg = (COLS - 14) / 2; + int tmarg = (LINES - (MAX_OPTIONS + 2)) / 2; if (old_option == -1) { diff --git a/lte/alt1250/alt1250_util.h b/lte/alt1250/alt1250_util.h index edff6203fa..85be0c992e 100644 --- a/lte/alt1250/alt1250_util.h +++ b/lte/alt1250/alt1250_util.h @@ -25,7 +25,7 @@ * Included Files ****************************************************************************/ -#include +#include #include "alt1250_daemon.h" diff --git a/netutils/thttpd/mime_types.h b/netutils/thttpd/mime_types.h index 6b6b290054..8889cd3f73 100644 --- a/netutils/thttpd/mime_types.h +++ b/netutils/thttpd/mime_types.h @@ -1,6 +1,6 @@ /**************************************************************************** * apps/netutils/thttpd/mime_types.h - * Provides mappings between filename extensions and MIME types and encodings. + * Provides mappings between filename extensions, MIME types and encodings. * * Based on mime_encodings.txt and mime_types.txt by Jef Poskanser which * contained no copyright information. diff --git a/netutils/thttpd/tdate_parse.c b/netutils/thttpd/tdate_parse.c index 995af3a950..3622ffe972 100644 --- a/netutils/thttpd/tdate_parse.c +++ b/netutils/thttpd/tdate_parse.c @@ -91,7 +91,7 @@ static int strlong_compare(const void *v1, const void *v2) #endif #ifdef HAVE_DAY_OF_WEEK /* Day of week not yet supported by NuttX */ -static int strlong_search(char *str, struct strlong *tab, int n, long *lP) +static int strlong_search(char *str, struct strlong *tab, int n, long *lp) { int i; int h; @@ -114,7 +114,7 @@ static int strlong_search(char *str, struct strlong *tab, int n, long *lP) } else { - *lP = tab[i].l; + *lp = tab[i].l; return 1; } @@ -127,16 +127,24 @@ static int strlong_search(char *str, struct strlong *tab, int n, long *lP) #endif #ifdef HAVE_DAY_OF_WEEK /* Day of week not yet supported by NuttX */ -static int scan_wday(char *str_wday, long *tm_wdayP) +static int scan_wday(char *str_wday, long *tm_wdayp) { - static struct strlong wday_tab[] = { - {"sun", 0}, {"sunday", 0}, - {"mon", 1}, {"monday", 1}, - {"tue", 2}, {"tuesday", 2}, - {"wed", 3}, {"wednesday", 3}, - {"thu", 4}, {"thursday", 4}, - {"fri", 5}, {"friday", 5}, - {"sat", 6}, {"saturday", 6}, + static struct strlong wday_tab[] = + { + {"sun", 0}, + {"sunday", 0}, + {"mon", 1}, + {"monday", 1}, + {"tue", 2}, + {"tuesday", 2}, + {"wed", 3}, + {"wednesday", 3}, + {"thu", 4}, + {"thursday", 4}, + {"fri", 5}, + {"friday", 5}, + {"sat", 6}, + {"saturday", 6}, }; static int sorted = 0; @@ -149,26 +157,38 @@ static int scan_wday(char *str_wday, long *tm_wdayP) } pound_case(str_wday); - return strlong_search(str_wday, wday_tab, nitems(wday_tab), tm_wdayP); + return strlong_search(str_wday, wday_tab, nitems(wday_tab), tm_wdayp); } #endif /* Day of week not yet supported by NuttX */ #ifdef TDATE_PARSE_WORKS -static int scan_mon(char *str_mon, long *tm_monP) +static int scan_mon(char *str_mon, long *tm_monp) { - static struct strlong mon_tab[] = { - {"jan", 0}, {"january", 0}, - {"feb", 1}, {"february", 1}, - {"mar", 2}, {"march", 2}, - {"apr", 3}, {"april", 3}, + static struct strlong mon_tab[] = + { + {"jan", 0}, + {"january", 0}, + {"feb", 1}, + {"february", 1}, + {"mar", 2}, + {"march", 2}, + {"apr", 3}, + {"april", 3}, {"may", 4}, - {"jun", 5}, {"june", 5}, - {"jul", 6}, {"july", 6}, - {"aug", 7}, {"august", 7}, - {"sep", 8}, {"september", 8}, - {"oct", 9}, {"october", 9}, - {"nov", 10}, {"november", 10}, - {"dec", 11}, {"december", 11}, + {"jun", 5}, + {"june", 5}, + {"jul", 6}, + {"july", 6}, + {"aug", 7}, + {"august", 7}, + {"sep", 8}, + {"september", 8}, + {"oct", 9}, + {"october", 9}, + {"nov", 10}, + {"november", 10}, + {"dec", 11}, + {"december", 11}, }; static int sorted = 0; @@ -181,7 +201,7 @@ static int scan_mon(char *str_mon, long *tm_monP) } pound_case(str_mon); - return strlong_search(str_mon, mon_tab, nitems(mon_tab), tm_monP); + return strlong_search(str_mon, mon_tab, nitems(mon_tab), tm_monp); } #endif diff --git a/testing/crypto/hmac.c b/testing/crypto/hmac.c index cbad8decb1..a90762da51 100644 --- a/testing/crypto/hmac.c +++ b/testing/crypto/hmac.c @@ -193,7 +193,7 @@ int main(void) { char output[32]; int ret = 0; - for (int i = 0; i < nitems(testcase) i++) + for (int i = 0; i < nitems(testcase); i++) { ret += syshmac(CRYPTO_MD5_HMAC, testcase[i].key, testcase[i].keylen, diff --git a/testing/drivertest/drivertest_audio.c b/testing/drivertest/drivertest_audio.c index 9b7fe9d5ea..e7b10981ca 100644 --- a/testing/drivertest/drivertest_audio.c +++ b/testing/drivertest/drivertest_audio.c @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include