apps: examples: nxstyle fixes

Fix for errors reported by the nxstyle tool.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
Alin Jerpelea 2022-03-08 09:57:25 +00:00 committed by Petro Karashchenko
parent abf34e5d5a
commit 3984796156
9 changed files with 128 additions and 105 deletions

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/examples/touchscreen/tp_cal.c
* apps/examples/lvgldemo/tp_cal.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with

View File

@ -47,7 +47,7 @@ extern "C"
void tp_cal_create(void);
#ifdef __cplusplus
} /* extern "C" */
}
#endif
#endif /* __APPS_EXAMPLES_LVGLDEMO_TP_CAL_H */

View File

@ -87,7 +87,9 @@ int main(int argc, FAR char *argv[])
printf("Channel SSP0/SPI1 Device 0: ");
if (fd0 < 0)
{
/* The file could not be open, probably the device is not registered */
/* The file could not be open,
* probably the device is not registered
*/
printf("Not enabled!\n");
}
@ -113,7 +115,9 @@ int main(int argc, FAR char *argv[])
printf("Channel SSP0/SPI1 Device 1: ");
if (fd1 < 0)
{
/* The file could not be open, probably the device is not registered */
/* The file could not be open,
* probably the device is not registered
*/
printf("Not enabled!\n");
}
@ -122,8 +126,8 @@ int main(int argc, FAR char *argv[])
ret = read(fd1, &temp, 2);
if (ret < 0)
{
/* The file could not be read, probably some max31855 pin is not
* connected to the channel.
/* The file could not be read, probably some max31855 pin is
* not connected to the channel.
*/
printf("Disconnected!\n");
@ -139,7 +143,9 @@ int main(int argc, FAR char *argv[])
printf("Channel SSP1/SPI2 Device 0: ");
if (fd2 < 0)
{
/* The file could not be open, probably the device is not registered */
/* The file could not be open,
* probably the device is not registered
*/
printf("Not enabled!\n");
}
@ -148,8 +154,8 @@ int main(int argc, FAR char *argv[])
ret = read(fd2, &temp, 2);
if (ret < 0)
{
/* The file could not be read, probably some max31855 pin is not
* connected to the channel.
/* The file could not be read, probably some max31855 pin is
* not connected to the channel.
*/
printf("Disconnected!\n");
@ -165,7 +171,9 @@ int main(int argc, FAR char *argv[])
printf("Channel SSP1/SPI2 Device 1: ");
if (fd3 < 0)
{
/* The file could not be open, probably the device is not registered */
/* The file could not be open,
* probably the device is not registered
*/
printf("Not enabled!\n");
}

View File

@ -1,5 +1,5 @@
/****************************************************************************
* net/recvfrom.c
* apps/examples/netpkt/netpkt_main.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -122,8 +122,15 @@ int main(int argc, FAR char *argv[])
int rxc;
uint8_t *buf;
const int buflen = 128;
const char da[6] = {0xf0, 0xde, 0xf1, 0x02, 0x43, 0x01};
const char sa[6] = {0x00, 0xe0, 0xde, 0xad, 0xbe, 0xef};
const char da[6] =
{
0xf0, 0xde, 0xf1, 0x02, 0x43, 0x01
};
const char sa[6] =
{
0x00, 0xe0, 0xde, 0xad, 0xbe, 0xef
};
int opt;
int verbose = 0;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* apps/examples/nxdemo/nxdemo.h
* apps/examples/nxdemo/images.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@ -33,10 +33,14 @@
static uint8_t g_battery[] =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0xfc, 0x10, 0x00, 0x04, 0x37, 0x77,
0x74, 0x37, 0x77, 0x74, 0x37, 0x77, 0x74, 0x37, 0x77, 0x74, 0x10, 0x00, 0x04, 0x0f, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0f, 0xff, 0xfc, 0x10, 0x00, 0x04, 0x37, 0x77,
0x74, 0x37, 0x77, 0x74, 0x37, 0x77, 0x74, 0x37,
0x77, 0x74, 0x10, 0x00, 0x04, 0x0f, 0xff, 0xfc,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

View File

@ -80,7 +80,8 @@
static void nxdemo_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
bool morem, FAR void *arg);
static void nxdemo_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
static void nxdemo_position(NXWINDOW hwnd,
FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg);
@ -137,7 +138,8 @@ static void nxdemo_redraw(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect,
* Name: nxdemo_position
****************************************************************************/
static void nxdemo_position(NXWINDOW hwnd, FAR const struct nxgl_size_s *size,
static void nxdemo_position(NXWINDOW hwnd,
FAR const struct nxgl_size_s *size,
FAR const struct nxgl_point_s *pos,
FAR const struct nxgl_rect_s *bounds,
FAR void *arg)
@ -276,7 +278,7 @@ static void nxdemo_demo_1(NXWINDOW hwnd)
center.x = g_nxdemo.xres >> 1;
center.y = g_nxdemo.yres >> 1;
for (i = 0; i<MIN(g_nxdemo.xres, g_nxdemo.yres)>> 1; i++)
for (i = 0; i < (MIN(g_nxdemo.xres, g_nxdemo.yres) >> 1); i++)
{
circle_radius = i;
@ -334,7 +336,7 @@ static void nxdemo_demo_2(NXWINDOW hwnd)
center.x = g_nxdemo.xres >> 1;
center.y = g_nxdemo.yres >> 1;
for (i = 0; i<MIN(g_nxdemo.xres, g_nxdemo.yres)>> 1; i++)
for (i = 0; i < (MIN(g_nxdemo.xres, g_nxdemo.yres) >> 1); i++)
{
rect.pt1.x = center.x - i;
rect.pt1.y = center.y - i;
@ -360,7 +362,6 @@ static void nxdemo_demo_2(NXWINDOW hwnd)
for (i = MIN(g_nxdemo.xres, g_nxdemo.yres) >> 1; i > 1; i--)
{
rect.pt1.x = center.x - i;
rect.pt1.y = center.y - i;
rect.pt2.x = center.x + i;

View File

@ -58,6 +58,7 @@
****************************************************************************/
/* Configuration ************************************************************/
/* If not specified, assume that the hardware supports one video plane */
#ifndef CONFIG_EXAMPLES_NXDEMO_VPLANE
@ -115,7 +116,8 @@ static inline int nxdemo_initialize(void)
ret = boardctl(BOARDIOC_NX_START, 0);
if (ret < 0)
{
printf("nxdemo_initialize: Failed to start the NX server: %d\n", errno);
printf("nxdemo_initialize: "
"Failed to start the NX server: %d\n", errno);
return ERROR;
}
@ -143,15 +145,16 @@ static inline int nxdemo_initialize(void)
}
#endif
/* Start a separate thread to listen for server events. This is probably
* the least efficient way to do this, but it makes this example flow more
* smoothly.
/* Start a separate thread to listen for server events.
* This is probably the least efficient way to do this,
* but it makes this example flow more smoothly.
*/
pthread_attr_init(&attr);
param.sched_priority = CONFIG_EXAMPLES_NXDEMO_LISTENERPRIO;
pthread_attr_setschedparam(&attr, &param);
pthread_attr_setstacksize(&attr, CONFIG_EXAMPLES_NXDEMO_LISTENER_STACKSIZE);
pthread_attr_setstacksize(&attr,
CONFIG_EXAMPLES_NXDEMO_LISTENER_STACKSIZE);
ret = pthread_create(&thread, &attr, nxdemo_listener, NULL);
if (ret != 0)

View File

@ -110,7 +110,7 @@ int main(int argc, FAR char *argv[])
if (optind == argc - 1)
{
stat = argv[optind];
set_stat = (!strcmp(stat,"on") || !strcmp(stat,"ON")) ? true : false ;
set_stat = (strcmp(stat, "on") == 0 || strcmp(stat, "ON") == 0);
}
up_relaysinit();

View File

@ -744,7 +744,7 @@ int lesp_read_ans_ok(int timeout_ms)
{
ret = lesp_read(timeout_ms);
if ((ret < 0) || (g_lesp_state.and == LESP_ERR) || \
if ((ret < 0) || (g_lesp_state.and == LESP_ERR) ||
(time(NULL) > end))
{
ret = -1;
@ -1888,7 +1888,7 @@ int lesp_set_dhcp(lesp_mode_t mode, bool enable)
if (ret >= 0)
{
ret = lesp_ask_ans_ok(LESP_TIMEOUT_MS, "AT+CWDHCP_CUR=%d,%c\r\n",
mode, (enable)?'1':'0');
mode, enable ? '1' : '0');
}
pthread_mutex_unlock(&g_lesp_state.mutex);
@ -2281,8 +2281,8 @@ int lesp_bind(int sockfd, FAR const struct sockaddr *addr, socklen_t addrlen)
*
****************************************************************************/
int lesp_connect(int sockfd,
FAR const struct sockaddr *addr, socklen_t addrlen)
int lesp_connect(int sockfd, FAR const struct sockaddr *addr,
socklen_t addrlen)
{
int ret = 0;
const char *proto_str;
@ -2339,8 +2339,8 @@ int lesp_connect(int sockfd,
{
ret = lesp_ask_ans_ok(LESP_TIMEOUT_MS, "AT+CIPSTART=%d,\"%s\","
"\"%d.%d.%d.%d\",%d\r\n", sockfd, proto_str,
*((uint8_t *)&(ip)+0), *((uint8_t *)&(ip)+1),
*((uint8_t *)&(ip)+2), *((uint8_t *)&(ip)+3),
*((uint8_t *)&ip + 0), *((uint8_t *)&ip +1),
*((uint8_t *)&ip + 2), *((uint8_t *)&ip + 3),
port);
if (ret < 0)
{