Skip to content

Commit

Permalink
Fix the minor style issue
Browse files Browse the repository at this point in the history
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
  • Loading branch information
xiaoxiang781216 authored and pkarashchenko committed Oct 16, 2022
1 parent 4941182 commit 893387b
Show file tree
Hide file tree
Showing 112 changed files with 605 additions and 576 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,13 @@ clean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_clean)

distclean: $(foreach SDIR, $(CLEANDIRS), $(SDIR)_distclean)
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
$(Q) ( if exist external ( \
$(Q) (if exist external ( \
echo ********************************************************" \
echo * The external directory/link must be removed manually *" \
echo ********************************************************" \
)
else
$(Q) ( if [ -e external ]; then \
$(Q) (if [ -e external ]; then \
echo "********************************************************"; \
echo "* The external directory/link must be removed manually *"; \
echo "********************************************************"; \
Expand Down
2 changes: 1 addition & 1 deletion audioutils/fmsynth/fmsynth_op.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
****************************************************************************/

#define PHASE_ADJUST(th) \
( ((th) < 0 ? (FMSYNTH_PI) - (th) : (th)) % (FMSYNTH_PI * 2) )
(((th) < 0 ? (FMSYNTH_PI) - (th) : (th)) % (FMSYNTH_PI * 2))

/****************************************************************************
* Private Data
Expand Down
2 changes: 1 addition & 1 deletion audioutils/fmsynth/test/fmsynth_alsa_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ int main(void)
dump_count -= SAMPLE_NUM;
}

snd_pcm_writei(hndl, (const void *)samples, SAMPLE_NUM);
snd_pcm_writei(hndl, samples, SAMPLE_NUM);
}

snd_pcm_drain(hndl);
Expand Down
8 changes: 4 additions & 4 deletions examples/adxl372_test/adxl372_test_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ static int adxl372_test(int is_interactive, FAR char *path)
};

char bfr[32] __attribute__((aligned(2))); /* REVISIT: GCC dependent attribute */
FAR struct XYZ *pxyz = (FAR struct XYZ *) bfr;
FAR struct XYZ *pxyz = (FAR struct XYZ *)bfr;
int rc = PASSED;
int rc_step = PASSED;

Expand Down Expand Up @@ -335,11 +335,11 @@ static int adxl372_test(int is_interactive, FAR char *path)
goto error_exit;
}

printf("ADXL372 = ( %6d, %6d, %6d))\n",
printf("ADXL372 = (%6d, %6d, %6d))\n",
pxyz->d[0], pxyz->d[1], pxyz->d[2]);
printf("ADXL372 = ( 0x%04X, 0x%04X, 0x%04X)\n",
printf("ADXL372 = (0x%04X, 0x%04X, 0x%04X)\n",
pxyz->d[0], pxyz->d[1], pxyz->d[2]);
printf("ADXL372 raw = ( 0x%02X%02X, 0x%02X%02X, 0x%02X%02X)\n",
printf("ADXL372 raw = (0x%02X%02X, 0x%02X%02X, 0x%02X%02X)\n",
bfr[1], bfr[0], bfr[3], bfr[2], bfr[5], bfr[4]);

if (is_interactive)
Expand Down
4 changes: 2 additions & 2 deletions examples/apds9960/apds9960_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ int main(int argc, FAR char *argv[])
int nbytes;
char gest;

fd = open(CONFIG_EXAMPLES_APDS9960_DEVNAME, O_RDONLY|O_NONBLOCK);
fd = open(CONFIG_EXAMPLES_APDS9960_DEVNAME, O_RDONLY | O_NONBLOCK);
if (fd < 0)
{
int errcode = errno;
Expand All @@ -64,7 +64,7 @@ int main(int argc, FAR char *argv[])

while (1)
{
nbytes = read(fd, (void *)&gest, sizeof(gest));
nbytes = read(fd, &gest, sizeof(gest));
if (nbytes == 1)
{
switch (gest)
Expand Down
14 changes: 7 additions & 7 deletions examples/bridge/bridge_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ static int bridge_net1_worker(int argc, char *argv[])
/* Set socket to reuse address */

optval = 1;
if (setsockopt(recvsd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int)) < 0)
if (setsockopt(recvsd, SOL_SOCKET, SO_REUSEADDR,
&optval, sizeof(int)) < 0)
{
fprintf(stderr, "NET1 ERROR: setsockopt SO_REUSEADDR failure: %d\n",
errno);
Expand Down Expand Up @@ -399,8 +399,8 @@ static int bridge_net1_worker(int argc, char *argv[])
/* Set socket to reuse address */

optval = 1;
if (setsockopt(sndsd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int)) < 0)
if (setsockopt(sndsd, SOL_SOCKET, SO_REUSEADDR,
&optval, sizeof(int)) < 0)
{
fprintf(stderr, "NET1 ERROR: setsockopt SO_REUSEADDR failure: %d\n",
errno);
Expand Down Expand Up @@ -549,8 +549,8 @@ static int bridge_net2_worker(int argc, char *argv[])
/* Set socket to reuse address */

optval = 1;
if (setsockopt(recvsd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
sizeof(int)) < 0)
if (setsockopt(recvsd, SOL_SOCKET, SO_REUSEADDR,
&optval, sizeof(int)) < 0)
{
fprintf(stderr, "NET2 ERROR: setsockopt SO_REUSEADDR failure: %d\n",
errno);
Expand Down Expand Up @@ -590,7 +590,7 @@ static int bridge_net2_worker(int argc, char *argv[])
/* Set socket to reuse address */

optval = 1;
if (setsockopt(sndsd, SOL_SOCKET, SO_REUSEADDR, (void *)&optval,
if (setsockopt(sndsd, SOL_SOCKET, SO_REUSEADDR, &optval,
sizeof(int)) < 0)
{
fprintf(stderr, "NET2 ERROR: setsockopt SO_REUSEADDR failure: %d\n",
Expand Down
36 changes: 21 additions & 15 deletions examples/bridge/host_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,18 @@ int main(int argc, char *argv[])
sndsd = socket(PF_INET, SOCK_DGRAM, 0);
if (sndsd < 0)
{
fprintf(stderr, LABEL "ERROR: Failed to create send socket: %d\n", errno);
fprintf(stderr, LABEL "ERROR: Failed to create send socket: %d\n",
errno);
return EXIT_FAILURE;
}

/* Set socket to reuse address */

optval = 1;
if (setsockopt(sndsd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
if (setsockopt(sndsd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int)) < 0)
{
fprintf(stderr, LABEL "ERROR: setsockopt SO_REUSEADDR failure: %d\n", errno);
fprintf(stderr,
LABEL "ERROR: setsockopt SO_REUSEADDR failure: %d\n", errno);
goto errout_with_sendsd;
}

Expand All @@ -99,7 +101,8 @@ int main(int argc, char *argv[])
sender.sin_port = 0;
sender.sin_addr.s_addr = htonl(EXAMPLES_BRIDGE_SEND_IPHOST);

if (bind(sndsd, (struct sockaddr*)&sender, sizeof(struct sockaddr_in)) < 0)
if (bind(sndsd, (struct sockaddr *)&sender,
sizeof(struct sockaddr_in)) < 0)
{
printf(LABEL "bind failure: %d\n", errno);
goto errout_with_sendsd;
Expand All @@ -113,16 +116,18 @@ int main(int argc, char *argv[])
recvsd = socket(PF_INET, SOCK_DGRAM, 0);
if (recvsd < 0)
{
fprintf(stderr, LABEL "ERROR: Failed to create receive socket: %d\n", errno);
fprintf(stderr,
LABEL "ERROR: Failed to create receive socket: %d\n", errno);
goto errout_with_sendsd;
}

/* Set socket to reuse address */

optval = 1;
if (setsockopt(recvsd, SOL_SOCKET, SO_REUSEADDR, (void*)&optval, sizeof(int)) < 0)
if (setsockopt(recvsd, SOL_SOCKET, SO_REUSEADDR, &optval, sizeof(int)) < 0)
{
fprintf(stderr, LABEL "ERROR: setsockopt SO_REUSEADDR failure: %d\n", errno);
fprintf(stderr,
LABEL "ERROR: setsockopt SO_REUSEADDR failure: %d\n", errno);
goto errout_with_recvsd;
}

Expand All @@ -132,7 +137,8 @@ int main(int argc, char *argv[])
receiver.sin_port = htons(EXAMPLES_BRIDGE_SEND_HOSTPORT);
receiver.sin_addr.s_addr = htonl(EXAMPLES_BRIDGE_RECV_IPHOST);

if (bind(recvsd, (struct sockaddr*)&receiver, sizeof(struct sockaddr_in)) < 0)
if (bind(recvsd, (struct sockaddr *)&receiver,
sizeof(struct sockaddr_in)) < 0)
{
fprintf(stderr, LABEL "ERROR: bind failure: %d\n", errno);
goto errout_with_recvsd;
Expand All @@ -148,8 +154,8 @@ int main(int argc, char *argv[])
toaddr.sin_port = htons(EXAMPLES_BRIDGE_RECV_RECVPORT);
toaddr.sin_addr.s_addr = htonl(EXAMPLES_BRIDGE_RECV_IPADDR);

nsent = sendto(sndsd, g_sndmessage, sizeof(g_sndmessage), 0,
(struct sockaddr*)&toaddr, sizeof(struct sockaddr_in));
nsent = sendto(sndsd, g_sndmessage, sizeof(g_sndmessage), 0,
(struct sockaddr *)&toaddr, sizeof(struct sockaddr_in));

/* Check for send errors */

Expand All @@ -173,7 +179,7 @@ int main(int argc, char *argv[])

addrlen = sizeof(struct sockaddr_in);
nrecvd = recvfrom(recvsd, g_rdbuffer, EXAMPLES_BRIDGE_SEND_IOBUFIZE, 0,
(struct sockaddr*)&fromaddr, &addrlen);
(struct sockaddr *)&fromaddr, &addrlen);

tmpaddr = ntohl(fromaddr.sin_addr.s_addr);
printf(LABEL "Received %ld bytes from %d.%d.%d.%d:%d\n",
Expand Down Expand Up @@ -207,7 +213,7 @@ int main(int argc, char *argv[])

for (i = 0, j = 0; i < nrecvd; i++)
{
if ( g_rdbuffer[i] == ' ' && j >= 64)
if (g_rdbuffer[i] == ' ' && j >= 64)
{
putchar('\n');
j = 0;
Expand All @@ -234,8 +240,8 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;

errout_with_recvsd:
close(recvsd);
close(recvsd);
errout_with_sendsd:
close(sndsd);
return EXIT_FAILURE;
close(sndsd);
return EXIT_FAILURE;
}
4 changes: 2 additions & 2 deletions examples/camera/camera_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static int camera_prepare(int fd, enum v4l2_buf_type type,
uint16_t hsize, uint16_t vsize,
struct v_buffer **vbuf,
uint8_t buffernum, int buffersize);
static void free_buffer(struct v_buffer *buffers, uint8_t bufnum);
static void free_buffer(struct v_buffer *buffers, uint8_t bufnum);
static int parse_arguments(int argc, char *argv[],
int *capture_num, enum v4l2_buf_type *type);
static int get_camimage(int fd, struct v4l2_buffer *v4l2_buf,
Expand Down Expand Up @@ -246,7 +246,7 @@ static int camera_prepare(int fd, enum v4l2_buf_type type,
* All free allocated memory of v_buffer.
****************************************************************************/

static void free_buffer(struct v_buffer *buffers, uint8_t bufnum)
static void free_buffer(struct v_buffer *buffers, uint8_t bufnum)
{
uint8_t cnt;
if (buffers)
Expand Down
4 changes: 2 additions & 2 deletions examples/configdata/configdata_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ static inline int
config.instance = entry->instance;
config.len = entry->len;
config.configdata = g_entryimage;
ret = ioctl(g_fd, CFGDIOC_SETCONFIG, (unsigned long) &config);
ret = ioctl(g_fd, CFGDIOC_SETCONFIG, (unsigned long)&config);
if (ret < 0)
{
entry->id = 0;
Expand Down Expand Up @@ -368,7 +368,7 @@ static inline int
config.instance = entry->instance;
config.len = entry->len;
config.configdata = g_entryimage;
ret = ioctl(g_fd, CFGDIOC_GETCONFIG, (unsigned long) &config);
ret = ioctl(g_fd, CFGDIOC_GETCONFIG, (unsigned long)&config);
if (ret < 0)
{
return ERROR;
Expand Down
4 changes: 2 additions & 2 deletions examples/elf/tests/helloxx/hello++5.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ static CThingSayer MyThingSayer;

MyException::MyException(std::string r = NULL) : reason(r)
{
if( r.length() > 0 )
if(r.length() > 0)
{
cout << "MyException(" << r << "): constructing with reason." << endl;
}
Expand Down Expand Up @@ -154,7 +154,7 @@ void CThingSayer::ThrowThing(void)
void CThingSayer::ThrowMyThing(const char *czSayThis = NULL)
{
cout << "CThingSayer::ThrowMyThing: I am now throwing an MyException (with reason)." << endl;
throw MyException( string(czSayThis) );
throw MyException(tring(czSayThis));
}

/////////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions examples/elf/tests/mutex/mutex.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static volatile bool bendoftest;
* Private Functions
****************************************************************************/

/* NOTE: it is necessary for functions that are referred to by function pointers
/* NOTE: it is necessary for functions that are referred to by function
* pointer to be declared with global scope (at least for ARM). Otherwise,
* a relocation type that is not supported by ELF is generated by GCC.
*/
Expand Down Expand Up @@ -103,7 +103,7 @@ int main(int argc, char **argv)

printf("Starting thread 1\n");
bendoftest = false;
if ((pthread_create(&thread1, NULL, (void*)thread_func, (void*)1)) != 0)
if ((pthread_create(&thread1, NULL, (void *)thread_func, (void *)1)) != 0)
{
fprintf(stderr, "Error in thread#1 creation\n");
}
Expand Down
2 changes: 1 addition & 1 deletion examples/foc/foc_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ static int foc_mq_send(mqd_t mqd, uint8_t msg, FAR void *data)

/* Data max 4B */

tmp = *((FAR uint32_t *) data);
tmp = *((FAR uint32_t *)data);

buffer[0] = msg;
buffer[1] = ((tmp & 0x000000ff) >> 0);
Expand Down
2 changes: 1 addition & 1 deletion examples/foc/foc_motor_b16.c
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ int foc_motor_init(FAR struct foc_motor_b16_s *motor,
/* Initialize motor alignment data */

align_cfg.volt = ftob16(CONFIG_EXAMPLES_FOC_ALIGN_VOLT / 1000.0f);
align_cfg.offset_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
align_cfg.offset_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
CONFIG_EXAMPLES_FOC_ALIGN_SEC / 1000);

/* Connect align callbacks */
Expand Down
6 changes: 3 additions & 3 deletions examples/foc/foc_motor_f32.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,7 +932,7 @@ int foc_motor_init(FAR struct foc_motor_f32_s *motor,
/* Initialize motor alignment data */

align_cfg.volt = (CONFIG_EXAMPLES_FOC_ALIGN_VOLT / 1000.0f);
align_cfg.offset_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
align_cfg.offset_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
CONFIG_EXAMPLES_FOC_ALIGN_SEC / 1000);

/* Connect align callbacks */
Expand Down Expand Up @@ -973,9 +973,9 @@ int foc_motor_init(FAR struct foc_motor_f32_s *motor,
ident_cfg.per = motor->per;
ident_cfg.res_current = (CONFIG_EXAMPLES_FOC_IDENT_RES_CURRENT / 1000.0f);
ident_cfg.ind_volt = (CONFIG_EXAMPLES_FOC_IDENT_IND_VOLTAGE / 1000.0f);
ident_cfg.res_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
ident_cfg.res_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
CONFIG_EXAMPLES_FOC_IDENT_RES_SEC / 1000);
ident_cfg.ind_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
ident_cfg.ind_steps = (CONFIG_EXAMPLES_FOC_NOTIFIER_FREQ * \
CONFIG_EXAMPLES_FOC_IDENT_IND_SEC / 1000);
ident_cfg.idle_steps = CONFIG_EXAMPLES_FOC_IDENT_IDLE;

Expand Down
12 changes: 6 additions & 6 deletions examples/foc/foc_thr.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static int g_fixed16_thr_cntr = 0;

static FAR void *foc_control_thr(FAR void *arg)
{
FAR struct foc_ctrl_env_s *envp = (FAR struct foc_ctrl_env_s *) arg;
FAR struct foc_ctrl_env_s *envp = (FAR struct foc_ctrl_env_s *)arg;
char buffer[CONTROL_MQ_MSGSIZE];
char mqname[10];
int ret = OK;
Expand Down Expand Up @@ -276,11 +276,11 @@ bool foc_threads_terminated(void)
int foc_ctrlthr_init(FAR struct foc_ctrl_env_s *foc, int i, FAR mqd_t *mqd,
FAR pthread_t *thread)
{
char mqname[10];
int ret = OK;
pthread_attr_t attr;
struct mq_attr mqattr;
struct sched_param param;
char mqname[10];
int ret = OK;
pthread_attr_t attr;
struct mq_attr mqattr;
struct sched_param param;

DEBUGASSERT(foc);
DEBUGASSERT(mqd);
Expand Down
2 changes: 1 addition & 1 deletion examples/ft80x/ft80x_coprocessor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2066,7 +2066,7 @@ int ft80x_coproc_interactive(int fd, FAR struct ft80x_dlbuffer_s *buffer)
cmds.e.button.cmd = FT80X_CMD_BUTTON;
cmds.e.button.x = ydist;
cmds.e.button.y = yoffset;
cmds.e.button.w = 10 *width;
cmds.e.button.w = 10 * width;
cmds.e.button.h = height;
cmds.e.button.font = fontid;

Expand Down
2 changes: 1 addition & 1 deletion examples/mount/mount_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ static void succeed_stat(const char *path)

int main(int argc, FAR char *argv[])
{
int ret;
int ret;

#ifndef CONFIG_EXAMPLES_MOUNT_DEVNAME
/* Create a RAM disk for the test */
Expand Down
6 changes: 4 additions & 2 deletions examples/netloop/lo_listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ static bool net_closeclient(struct net_listener_s *nls, int sd)
close(sd);
FD_CLR(sd, &nls->master);

/* If we just closed the max SD, then search downward for the next biggest SD. */
/* If we just closed the max SD, then search downward for the next
* biggest SD.
*/

while (FD_ISSET(nls->mxsd, &nls->master) == false)
{
Expand Down Expand Up @@ -297,7 +299,7 @@ void *lo_listener(pthread_addr_t pvarg)
memset(&nls, 0, sizeof(struct net_listener_s));
if (!net_mksocket(&nls))
{
return (void*)1;
return (void *)(uintptr_t)1;
}

/* Initialize the 'master' file descriptor set */
Expand Down
Loading

0 comments on commit 893387b

Please sign in to comment.