Fix the nxstyle warning
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
diff --git a/examples/pdcurses/newdemo_main.c b/examples/pdcurses/newdemo_main.c
index d9ce582..b6583a9 100644
--- a/examples/pdcurses/newdemo_main.c
+++ b/examples/pdcurses/newdemo_main.c
@@ -316,8 +316,8 @@
curs_set(0);
noecho();
- /* Refresh stdscr so that reading from it will not cause it to overwrite the
- * other windows that are being created.
+ /* Refresh stdscr so that reading from it will not cause it to overwrite
+ * the other windows that are being created.
*/
refresh();
@@ -335,7 +335,7 @@
return 1;
}
- for (;;)
+ for (; ; )
{
init_pair(1, COLOR_WHITE, COLOR_BLUE);
wbkgd(win, COLOR_PAIR(1));
diff --git a/examples/poll/poll_main.c b/examples/poll/poll_main.c
index 39d2d31..4c4219a 100644
--- a/examples/poll/poll_main.c
+++ b/examples/poll/poll_main.c
@@ -134,7 +134,8 @@
ret = pthread_create(&tid2, NULL, select_listener, NULL);
if (ret != 0)
{
- printf("poll_main: Failed to create select_listener thread: %d\n", ret);
+ printf("poll_main: Failed to create select_listener thread: %d\n",
+ ret);
exitcode = 6;
goto errout;
}
diff --git a/examples/udgram/udgram_client.c b/examples/udgram/udgram_client.c
index 411729e..2dde6e6 100644
--- a/examples/udgram/udgram_client.c
+++ b/examples/udgram/udgram_client.c
@@ -52,6 +52,7 @@
{
j = 1;
}
+
buf[j] = ch;
}
}
diff --git a/examples/udgram/udgram_server.c b/examples/udgram/udgram_server.c
index b213cfe..4fab950 100644
--- a/examples/udgram/udgram_server.c
+++ b/examples/udgram/udgram_server.c
@@ -53,9 +53,11 @@
{
j = 1;
}
+
if (buf[j] != ch)
{
- printf("server: Buffer content error for offset=%d, index=%d\n", offset, j);
+ printf("server: Buffer content error for offset=%d, index=%d\n",
+ offset, j);
ret = 0;
}
}
@@ -100,7 +102,7 @@
addrlen += sizeof(sa_family_t) + 1;
- if (bind(sockfd, (struct sockaddr*)&server, addrlen) < 0)
+ if (bind(sockfd, (struct sockaddr *)&server, addrlen) < 0)
{
printf("server: ERROR bind failure: %d\n", errno);
return 1;
@@ -113,7 +115,7 @@
printf("server: %d. Receiving up 1024 bytes\n", offset);
recvlen = addrlen;
nbytes = recvfrom(sockfd, inbuf, 1024, 0,
- (struct sockaddr*)&client, &recvlen);
+ (struct sockaddr *)&client, &recvlen);
if (nbytes < 0)
{
@@ -122,10 +124,11 @@
return 1;
}
- if (recvlen < sizeof(sa_family_t) || recvlen > sizeof(struct sockaddr_un))
+ if (recvlen < sizeof(sa_family_t) ||
+ recvlen > sizeof(struct sockaddr_un))
{
- printf("server: %d. ERROR Received %d bytes from client with invalid length %d\n",
- offset, nbytes, recvlen);
+ printf("server: %d. ERROR Received %d bytes from client with "
+ "invalid length %d\n", offset, nbytes, recvlen);
}
else if (recvlen == sizeof(sa_family_t))
{
@@ -142,8 +145,8 @@
printf("server: ERROR path not NUL terminated\n");
}
}
- else /* if (recvlen > sizeof(sa_family_t)+1 &&
- recvlen <= sizeof(struct sockaddr_un)) */
+ else /* if (recvlen > sizeof(sa_family_t) + 1 &&
+ * recvlen <= sizeof(struct sockaddr_un)) */
{
int pathlen = recvlen - sizeof(sa_family_t) - 1;
diff --git a/examples/ustream/ustream_server.c b/examples/ustream/ustream_server.c
index 7148c73..b5f5ccf 100644
--- a/examples/ustream/ustream_server.c
+++ b/examples/ustream/ustream_server.c
@@ -41,14 +41,14 @@
* Public Functions
****************************************************************************/
-int main(int argc, FAR char *argv[])
+int main(int argc, char *argv[])
{
#ifdef CONFIG_EXAMPLES_USTREAM_USE_POLL
struct pollfd pfd;
#endif
struct sockaddr_un myaddr;
socklen_t addrlen;
- FAR char *buffer;
+ char *buffer;
int listensd;
int acceptsd;
int nbytesread;
@@ -60,7 +60,7 @@
/* Allocate a BIG buffer */
- buffer = (char*)malloc(2*SENDSIZE);
+ buffer = (char *)malloc(2 * SENDSIZE);
if (!buffer)
{
printf("server: failed to allocate buffer\n");
@@ -89,7 +89,7 @@
myaddr.sun_path[addrlen] = '\0';
addrlen += sizeof(sa_family_t) + 1;
- ret = bind(listensd, (struct sockaddr*)&myaddr, addrlen);
+ ret = bind(listensd, (struct sockaddr *)&myaddr, addrlen);
if (ret < 0)
{
printf("server: bind failure: %d\n", errno);
@@ -98,7 +98,8 @@
/* Listen for connections on the bound socket */
- printf("server: Accepting connections on %s ...\n", CONFIG_EXAMPLES_USTREAM_ADDR);
+ printf("server: Accepting connections on %s ...\n",
+ CONFIG_EXAMPLES_USTREAM_ADDR);
if (listen(listensd, 5) < 0)
{
@@ -131,7 +132,7 @@
}
#endif
- acceptsd = accept(listensd, (struct sockaddr*)&myaddr, &addrlen);
+ acceptsd = accept(listensd, (struct sockaddr *)&myaddr, &addrlen);
if (acceptsd < 0)
{
printf("server: accept failure: %d\n", errno);
@@ -169,7 +170,8 @@
#endif
printf("server: Reading...\n");
- nbytesread = recv(acceptsd, &buffer[totalbytesread], 2*SENDSIZE - totalbytesread, 0);
+ nbytesread = recv(acceptsd, &buffer[totalbytesread],
+ 2 * SENDSIZE - totalbytesread, 0);
if (nbytesread < 0)
{
printf("server: recv failed: %d\n", errno);
@@ -189,7 +191,8 @@
if (totalbytesread != SENDSIZE)
{
- printf("server: Received %d / Expected %d bytes\n", totalbytesread, SENDSIZE);
+ printf("server: Received %d / Expected %d bytes\n",
+ totalbytesread, SENDSIZE);
goto errout_with_acceptsd;
}
@@ -198,7 +201,8 @@
{
if (buffer[i] != ch)
{
- printf("server: Byte %d is %02x / Expected %02x\n", i, buffer[i], ch);
+ printf("server: Byte %d is %02x / Expected %02x\n",
+ i, buffer[i], ch);
goto errout_with_acceptsd;
}
diff --git a/graphics/pdcurs34/pdcurses/pdc_panel.c b/graphics/pdcurs34/pdcurses/pdc_panel.c
index 62f0e93..e864836 100644
--- a/graphics/pdcurs34/pdcurses/pdc_panel.c
+++ b/graphics/pdcurs34/pdcurses/pdc_panel.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * apps/graphics/pdcurses/pdc_panel.c
+ * apps/graphics/pdcurs34/pdcurses/pdc_panel.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -149,9 +149,12 @@
****************************************************************************/
#ifndef CONFIG_PDCURSES_MULTITHREAD
-PANEL *_bottom_panel = (PANEL *) 0;
-PANEL *_top_panel = (PANEL *) 0;
-PANEL _stdscr_pseudo_panel = { (WINDOW *) 0 };
+PANEL *_bottom_panel = (PANEL *)0;
+PANEL *_top_panel = (PANEL *)0;
+PANEL _stdscr_pseudo_panel =
+{
+ (WINDOW *)0
+};
#else
typedef struct panel_ctx_s
{
@@ -177,7 +180,8 @@
{
PDC_LOG(("%s id=%s b=%s a=%s y=%d x=%d", text, pan->user,
pan->below ? pan->below->user : "--",
- pan->above ? pan->above->user : "--", pan->wstarty, pan->wstartx));
+ pan->above ? pan->above->user : "--",
+ pan->wstarty, pan->wstartx));
}
static void dstack(char *fmt, int num, PANEL *pan)
@@ -686,7 +690,8 @@
int replace_panel(PANEL *pan, WINDOW *win)
{
- int maxy, maxx;
+ int maxy;
+ int maxx;
if (!pan)
{
diff --git a/graphics/screenshot/screenshot_main.c b/graphics/screenshot/screenshot_main.c
index 5e6c8c6..7ed5809 100644
--- a/graphics/screenshot/screenshot_main.c
+++ b/graphics/screenshot/screenshot_main.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * apps/examples/screenshot/screenshot_main.c
+ * apps/graphics/screenshot/screenshot_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -69,7 +69,8 @@
* Private Functions
****************************************************************************/
-static void replace_extension(FAR const char *filename, FAR const char *newext,
+static void replace_extension(FAR const char *filename,
+ FAR const char *newext,
FAR char *dest, size_t size)
{
FAR char *p = strrchr(filename, '.');
@@ -104,8 +105,15 @@
int save_screenshot(FAR const char *filename)
{
struct tiff_info_s info;
- struct nx_callback_s cb = {};
- struct nxgl_size_s size = {CONFIG_SCREENSHOT_WIDTH, CONFIG_SCREENSHOT_HEIGHT};
+ struct nx_callback_s cb =
+ {
+ };
+
+ struct nxgl_size_s size =
+ {
+ CONFIG_SCREENSHOT_WIDTH, CONFIG_SCREENSHOT_HEIGHT
+ };
+
#ifdef CONFIG_VNCSERVER
struct boardioc_vncstart_s vnc;
#endif
@@ -130,18 +138,18 @@
}
#ifdef CONFIG_VNCSERVER
- /* Setup the VNC server to support keyboard/mouse inputs */
+ /* Setup the VNC server to support keyboard/mouse inputs */
- vnc.display = 0;
- vnc.handle = server;
+ vnc.display = 0;
+ vnc.handle = server;
- ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc);
- if (ret < 0)
- {
- printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret);
- nx_disconnect(server);
- return 1;
- }
+ ret = boardctl(BOARDIOC_VNC_START, (uintptr_t)&vnc);
+ if (ret < 0)
+ {
+ printf("boardctl(BOARDIOC_VNC_START) failed: %d\n", ret);
+ nx_disconnect(server);
+ return 1;
+ }
#endif
/* Wait for "connected" event */
@@ -157,11 +165,11 @@
window = nx_openwindow(server, 0, &cb, NULL);
if (!window)
- {
- perror("nx_openwindow");
- nx_disconnect(server);
- return 1;
- }
+ {
+ perror("nx_openwindow");
+ nx_disconnect(server);
+ return 1;
+ }
nx_setsize(window, &size);
@@ -192,17 +200,26 @@
strip = malloc(size.w * 3);
for (row = 0; row < size.h; row++)
- {
- struct nxgl_rect_s rect = {{0, row}, {size.w - 1, row}};
- nx_getrectangle(window, &rect, 0, strip, 0);
-
- ret = tiff_addstrip(&info, strip);
- if (ret < 0)
+ {
+ struct nxgl_rect_s rect =
{
- printf("tiff_addstrip() #%d failed: %d\n", row, ret);
- break;
- }
- }
+ {
+ 0, row
+ },
+ {
+ size.w - 1, row
+ }
+ };
+
+ nx_getrectangle(window, &rect, 0, strip, 0);
+
+ ret = tiff_addstrip(&info, strip);
+ if (ret < 0)
+ {
+ printf("tiff_addstrip() #%d failed: %d\n", row, ret);
+ break;
+ }
+ }
free(strip);
diff --git a/interpreters/bas/bas_program.c b/interpreters/bas/bas_program.c
index 0cda508..b24db3d 100644
--- a/interpreters/bas/bas_program.c
+++ b/interpreters/bas/bas_program.c
@@ -67,7 +67,8 @@
{
struct Pc line;
struct LineNumber *next;
- } *lines;
+ }
+ *lines;
struct Xref *l;
struct Xref *r;
};
@@ -175,8 +176,8 @@
static int cmpLine(const void *a, const void *b)
{
- const register struct Pc *pcA = (const struct Pc *)a, *pcB =
- (const struct Pc *)b;
+ const register struct Pc *pcA = (const struct Pc *)a;
+ const register struct Pc *pcB = (const struct Pc *)b;
return pcA->line - pcB->line;
}
@@ -192,7 +193,8 @@
static int cmpName(const void *a, const void *b)
{
- const register char *funcA = (const char *)a, *funcB = (const char *)b;
+ const register char *funcA = (const char *)a;
+ const register char *funcB = (const char *)b;
return strcmp(funcA, funcB);
}
@@ -317,7 +319,9 @@
void Program_delete(struct Program *this, const struct Pc *from,
const struct Pc *to)
{
- int i, first, last;
+ int i;
+ int first;
+ int last;
this->runnable = 0;
this->unsaved = 1;
@@ -696,13 +700,16 @@
int Program_lineNumberWidth(struct Program *this)
{
- int i, w = 0;
+ int i;
+ int w = 0;
for (i = 0; i < this->size; ++i)
{
if (this->code[i]->type == T_INTEGER)
{
- int nw, ln;
+ int nw;
+ int ln;
+
for (ln = this->code[i]->u.integer, nw = 1; ln /= 10; ++nw);
if (nw > w)
{
@@ -718,7 +725,8 @@
struct Pc *from, struct Pc *to,
struct Value *value)
{
- int i, w;
+ int i;
+ int w;
int indent = 0;
struct String s;
@@ -940,7 +948,10 @@
void Program_xref(struct Program *this, int chn)
{
struct Pc pc;
- struct Xref *func, *var, *gosub, *goto_;
+ struct Xref *func;
+ struct Xref *var;
+ struct Xref *gosub;
+ struct Xref *goto_;
int nl = 0;
assert(this->runnable);
diff --git a/system/ntpc/ntpcstatus_main.c b/system/ntpc/ntpcstatus_main.c
index 376525b..efed5b8 100644
--- a/system/ntpc/ntpcstatus_main.c
+++ b/system/ntpc/ntpcstatus_main.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * apps/system/ntpc/ntpc_status.c
+ * apps/system/ntpc/ntpcstatus_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with