Skip to content

Commit

Permalink
Fix some coding style issue
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Xiao <[email protected]>
  • Loading branch information
xiaoxiang781216 committed Aug 16, 2023
1 parent 263864a commit b5255df
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 57 deletions.
16 changes: 8 additions & 8 deletions examples/ft80x/ft80x_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
*/

Expand Down Expand Up @@ -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
Expand Down
43 changes: 24 additions & 19 deletions examples/pdcurses/testcurs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@

#include "graphics/curses.h"

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#ifdef WACS_S1
# define HAVE_WIDE 1
#else
Expand All @@ -49,6 +45,10 @@
# include <wchar.h>
#endif

/****************************************************************************
* Pre-processor Definitions
****************************************************************************/

#ifdef A_COLOR
# define HAVE_COLOR 1
#else
Expand Down Expand Up @@ -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
};

Expand All @@ -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
};
Expand Down Expand Up @@ -240,6 +240,7 @@ static int init_test(WINDOW ** win, int argc, char *argv[])
start_color();
}
#endif

/* Create a drawing window */

width = 60;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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;

Expand Down Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion lte/alt1250/alt1250_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* Included Files
****************************************************************************/

#include <sys/params.h>
#include <sys/param.h>

#include "alt1250_daemon.h"

Expand Down
2 changes: 1 addition & 1 deletion netutils/thttpd/mime_types.h
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
72 changes: 46 additions & 26 deletions netutils/thttpd/tdate_parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion testing/crypto/hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion testing/drivertest/drivertest_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/params.h>
#include <sys/param.h>

#include <stdarg.h>
#include <stddef.h>
Expand Down

0 comments on commit b5255df

Please sign in to comment.