Fix the nxstyle warning

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2023-03-06 00:40:05 +08:00 committed by Petro Karashchenko
parent 575582ca85
commit f95d60366a
9 changed files with 108 additions and 66 deletions

View File

@ -316,8 +316,8 @@ int main(int argc, FAR char *argv[])
curs_set(0); curs_set(0);
noecho(); noecho();
/* Refresh stdscr so that reading from it will not cause it to overwrite the /* Refresh stdscr so that reading from it will not cause it to overwrite
* other windows that are being created. * the other windows that are being created.
*/ */
refresh(); refresh();

View File

@ -134,7 +134,8 @@ int main(int argc, FAR char *argv[])
ret = pthread_create(&tid2, NULL, select_listener, NULL); ret = pthread_create(&tid2, NULL, select_listener, NULL);
if (ret != 0) 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; exitcode = 6;
goto errout; goto errout;
} }

View File

@ -52,6 +52,7 @@ static inline void fill_buffer(unsigned char *buf, int offset)
{ {
j = 1; j = 1;
} }
buf[j] = ch; buf[j] = ch;
} }
} }

View File

@ -53,9 +53,11 @@ static inline int check_buffer(unsigned char *buf)
{ {
j = 1; j = 1;
} }
if (buf[j] != ch) 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; ret = 0;
} }
} }
@ -122,10 +124,11 @@ int main(int argc, FAR char *argv[])
return 1; 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", printf("server: %d. ERROR Received %d bytes from client with "
offset, nbytes, recvlen); "invalid length %d\n", offset, nbytes, recvlen);
} }
else if (recvlen == sizeof(sa_family_t)) else if (recvlen == sizeof(sa_family_t))
{ {
@ -143,7 +146,7 @@ int main(int argc, FAR char *argv[])
} }
} }
else /* if (recvlen > sizeof(sa_family_t) + 1 && else /* if (recvlen > sizeof(sa_family_t) + 1 &&
recvlen <= sizeof(struct sockaddr_un)) */ * recvlen <= sizeof(struct sockaddr_un)) */
{ {
int pathlen = recvlen - sizeof(sa_family_t) - 1; int pathlen = recvlen - sizeof(sa_family_t) - 1;

View File

@ -41,14 +41,14 @@
* Public Functions * Public Functions
****************************************************************************/ ****************************************************************************/
int main(int argc, FAR char *argv[]) int main(int argc, char *argv[])
{ {
#ifdef CONFIG_EXAMPLES_USTREAM_USE_POLL #ifdef CONFIG_EXAMPLES_USTREAM_USE_POLL
struct pollfd pfd; struct pollfd pfd;
#endif #endif
struct sockaddr_un myaddr; struct sockaddr_un myaddr;
socklen_t addrlen; socklen_t addrlen;
FAR char *buffer; char *buffer;
int listensd; int listensd;
int acceptsd; int acceptsd;
int nbytesread; int nbytesread;
@ -98,7 +98,8 @@ int main(int argc, FAR char *argv[])
/* Listen for connections on the bound socket */ /* 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) if (listen(listensd, 5) < 0)
{ {
@ -169,7 +170,8 @@ int main(int argc, FAR char *argv[])
#endif #endif
printf("server: Reading...\n"); 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) if (nbytesread < 0)
{ {
printf("server: recv failed: %d\n", errno); printf("server: recv failed: %d\n", errno);
@ -189,7 +191,8 @@ int main(int argc, FAR char *argv[])
if (totalbytesread != SENDSIZE) 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; goto errout_with_acceptsd;
} }
@ -198,7 +201,8 @@ int main(int argc, FAR char *argv[])
{ {
if (buffer[i] != ch) 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; goto errout_with_acceptsd;
} }

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -151,7 +151,10 @@
#ifndef CONFIG_PDCURSES_MULTITHREAD #ifndef CONFIG_PDCURSES_MULTITHREAD
PANEL *_bottom_panel = (PANEL *)0; PANEL *_bottom_panel = (PANEL *)0;
PANEL *_top_panel = (PANEL *)0; PANEL *_top_panel = (PANEL *)0;
PANEL _stdscr_pseudo_panel = { (WINDOW *) 0 }; PANEL _stdscr_pseudo_panel =
{
(WINDOW *)0
};
#else #else
typedef struct panel_ctx_s typedef struct panel_ctx_s
{ {
@ -177,7 +180,8 @@ static void dpanel(char *text, PANEL *pan)
{ {
PDC_LOG(("%s id=%s b=%s a=%s y=%d x=%d", text, pan->user, PDC_LOG(("%s id=%s b=%s a=%s y=%d x=%d", text, pan->user,
pan->below ? pan->below->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) static void dstack(char *fmt, int num, PANEL *pan)
@ -686,7 +690,8 @@ WINDOW *panel_window(const PANEL *pan)
int replace_panel(PANEL *pan, WINDOW *win) int replace_panel(PANEL *pan, WINDOW *win)
{ {
int maxy, maxx; int maxy;
int maxx;
if (!pan) if (!pan)
{ {

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with
@ -69,7 +69,8 @@
* Private Functions * 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 *dest, size_t size)
{ {
FAR char *p = strrchr(filename, '.'); FAR char *p = strrchr(filename, '.');
@ -104,8 +105,15 @@ static void replace_extension(FAR const char *filename, FAR const char *newext,
int save_screenshot(FAR const char *filename) int save_screenshot(FAR const char *filename)
{ {
struct tiff_info_s info; struct tiff_info_s info;
struct nx_callback_s cb = {}; struct nx_callback_s cb =
struct nxgl_size_s size = {CONFIG_SCREENSHOT_WIDTH, CONFIG_SCREENSHOT_HEIGHT}; {
};
struct nxgl_size_s size =
{
CONFIG_SCREENSHOT_WIDTH, CONFIG_SCREENSHOT_HEIGHT
};
#ifdef CONFIG_VNCSERVER #ifdef CONFIG_VNCSERVER
struct boardioc_vncstart_s vnc; struct boardioc_vncstart_s vnc;
#endif #endif
@ -193,7 +201,16 @@ int save_screenshot(FAR const char *filename)
for (row = 0; row < size.h; row++) for (row = 0; row < size.h; row++)
{ {
struct nxgl_rect_s rect = {{0, row}, {size.w - 1, row}}; struct nxgl_rect_s rect =
{
{
0, row
},
{
size.w - 1, row
}
};
nx_getrectangle(window, &rect, 0, strip, 0); nx_getrectangle(window, &rect, 0, strip, 0);
ret = tiff_addstrip(&info, strip); ret = tiff_addstrip(&info, strip);

View File

@ -67,7 +67,8 @@ struct Xref
{ {
struct Pc line; struct Pc line;
struct LineNumber *next; struct LineNumber *next;
} *lines; }
*lines;
struct Xref *l; struct Xref *l;
struct Xref *r; struct Xref *r;
}; };
@ -175,8 +176,8 @@ static void Xref_print(struct Xref *root,
static int cmpLine(const void *a, const void *b) static int cmpLine(const void *a, const void *b)
{ {
const register struct Pc *pcA = (const struct Pc *)a, *pcB = const register struct Pc *pcA = (const struct Pc *)a;
(const struct Pc *)b; const register struct Pc *pcB = (const struct Pc *)b;
return pcA->line - pcB->line; return pcA->line - pcB->line;
} }
@ -192,7 +193,8 @@ static void printLine(const void *k, struct Program *p, int chn)
static int cmpName(const void *a, const void *b) 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); return strcmp(funcA, funcB);
} }
@ -317,7 +319,9 @@ void Program_store(struct Program *this, struct Token *line, long int where)
void Program_delete(struct Program *this, const struct Pc *from, void Program_delete(struct Program *this, const struct Pc *from,
const struct Pc *to) const struct Pc *to)
{ {
int i, first, last; int i;
int first;
int last;
this->runnable = 0; this->runnable = 0;
this->unsaved = 1; this->unsaved = 1;
@ -696,13 +700,16 @@ struct Value *Program_merge(struct Program *this, int dev,
int Program_lineNumberWidth(struct Program *this) int Program_lineNumberWidth(struct Program *this)
{ {
int i, w = 0; int i;
int w = 0;
for (i = 0; i < this->size; ++i) for (i = 0; i < this->size; ++i)
{ {
if (this->code[i]->type == T_INTEGER) 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); for (ln = this->code[i]->u.integer, nw = 1; ln /= 10; ++nw);
if (nw > w) if (nw > w)
{ {
@ -718,7 +725,8 @@ struct Value *Program_list(struct Program *this, int dev, int watchIntr,
struct Pc *from, struct Pc *to, struct Pc *from, struct Pc *to,
struct Value *value) struct Value *value)
{ {
int i, w; int i;
int w;
int indent = 0; int indent = 0;
struct String s; struct String s;
@ -940,7 +948,10 @@ int Program_setname(struct Program *this, const char *filename)
void Program_xref(struct Program *this, int chn) void Program_xref(struct Program *this, int chn)
{ {
struct Pc pc; struct Pc pc;
struct Xref *func, *var, *gosub, *goto_; struct Xref *func;
struct Xref *var;
struct Xref *gosub;
struct Xref *goto_;
int nl = 0; int nl = 0;
assert(this->runnable); assert(this->runnable);

View File

@ -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 * Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with * contributor license agreements. See the NOTICE file distributed with