Fix the coding style issue
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
parent
a86790c367
commit
9291d07a87
@ -719,15 +719,12 @@ exit_this_app:
|
||||
free_buffer(buffers_still, STILL_BUFNUM);
|
||||
|
||||
exit_without_cleaning_buffer:
|
||||
|
||||
video_uninitialize();
|
||||
|
||||
exit_without_cleaning_videodriver:
|
||||
|
||||
#ifdef CONFIG_EXAMPLES_CAMERA_OUTPUT_LCD
|
||||
nximage_finalize();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -207,7 +207,6 @@ errout_with_fd:
|
||||
close(fd);
|
||||
|
||||
errout:
|
||||
|
||||
printf("chrono_daemon: Terminating\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ static bool check_mem(void *mem, int len, int phys_addr)
|
||||
if (val != *p)
|
||||
{
|
||||
printf("check_mem: %x has 0x%08x expected 0x%08x\n",
|
||||
phys_addr + ((char *) p - (char *) mem), *p, val);
|
||||
phys_addr + ((char *)p - (char *)mem), *p, val);
|
||||
return false;
|
||||
}
|
||||
p++;
|
||||
|
@ -113,8 +113,8 @@ static uint16_t rgb565(uint32_t argb)
|
||||
****************************************************************************/
|
||||
|
||||
#ifdef CONFIG_FB_CMAP
|
||||
static void draw_rect8(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
|
||||
FAR const struct fb_area_s * area, uint8_t color)
|
||||
static void draw_rect8(FAR void *fbmem, FAR struct fb_overlayinfo_s *oinfo,
|
||||
FAR const struct fb_area_s *area, uint8_t color)
|
||||
{
|
||||
FAR uint8_t *dest;
|
||||
FAR uint8_t *row;
|
||||
@ -152,8 +152,8 @@ static void draw_rect8(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void draw_rect16(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
|
||||
FAR const struct fb_area_s * area, uint16_t rgb)
|
||||
static void draw_rect16(FAR void *fbmem, FAR struct fb_overlayinfo_s *oinfo,
|
||||
FAR const struct fb_area_s *area, uint16_t rgb)
|
||||
{
|
||||
FAR uint16_t *dest;
|
||||
FAR uint8_t *row;
|
||||
@ -190,8 +190,8 @@ static void draw_rect16(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void draw_rect24(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
|
||||
FAR const struct fb_area_s * area, uint32_t rgb)
|
||||
static void draw_rect24(FAR void *fbmem, FAR struct fb_overlayinfo_s *oinfo,
|
||||
FAR const struct fb_area_s *area, uint32_t rgb)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
@ -238,8 +238,8 @@ static void draw_rect24(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static void draw_rect32(FAR void *fbmem, FAR struct fb_overlayinfo_s * oinfo,
|
||||
FAR const struct fb_area_s * area, uint32_t argb)
|
||||
static void draw_rect32(FAR void *fbmem, FAR struct fb_overlayinfo_s *oinfo,
|
||||
FAR const struct fb_area_s *area, uint32_t argb)
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
@ -501,7 +501,7 @@ static void print_overlay_info(int fb, uint8_t overlayno)
|
||||
****************************************************************************/
|
||||
|
||||
static int overlay_fill(int fb, uint8_t overlayno, uint32_t color,
|
||||
FAR const struct fb_area_s * area)
|
||||
FAR const struct fb_area_s *area)
|
||||
{
|
||||
int ret;
|
||||
FAR void *fbmem;
|
||||
|
@ -48,7 +48,7 @@
|
||||
|
||||
int main(int argc, FAR char *argv[])
|
||||
{
|
||||
struct inode * inode;
|
||||
struct inode *inode;
|
||||
int ret;
|
||||
int x;
|
||||
int logsector;
|
||||
@ -73,7 +73,7 @@ int main(int argc, FAR char *argv[])
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "Failed to open %s\n", argv[1]);
|
||||
goto errout;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* Get the low-level format from the device. */
|
||||
@ -113,14 +113,14 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
/* Allocate buffers to use */
|
||||
|
||||
buffer = (char *) malloc(fmt.availbytes);
|
||||
buffer = (char *)malloc(fmt.availbytes);
|
||||
if (buffer == NULL)
|
||||
{
|
||||
fprintf(stderr, "Error allocating buffer\n");
|
||||
goto errout_with_driver;
|
||||
}
|
||||
|
||||
seqs = (uint16_t *) malloc(fmt.nsectors << 1);
|
||||
seqs = (uint16_t *)malloc(fmt.nsectors << 1);
|
||||
if (seqs == NULL)
|
||||
{
|
||||
free(buffer);
|
||||
@ -128,7 +128,7 @@ int main(int argc, FAR char *argv[])
|
||||
goto errout_with_driver;
|
||||
}
|
||||
|
||||
sectors = (uint16_t *) malloc(fmt.nsectors << 1);
|
||||
sectors = (uint16_t *)malloc(fmt.nsectors << 1);
|
||||
if (sectors == NULL)
|
||||
{
|
||||
free(seqs);
|
||||
@ -167,7 +167,7 @@ int main(int argc, FAR char *argv[])
|
||||
readwrite.logsector = sectors[x];
|
||||
readwrite.offset = 0;
|
||||
readwrite.count = strlen(buffer) + 1;
|
||||
readwrite.buffer = (uint8_t *) buffer;
|
||||
readwrite.buffer = (uint8_t *)buffer;
|
||||
inode->u.i_bops->ioctl(inode, BIOC_WRITESECT, (unsigned long)
|
||||
&readwrite);
|
||||
|
||||
@ -188,7 +188,7 @@ int main(int argc, FAR char *argv[])
|
||||
readwrite.logsector = sectors[x];
|
||||
readwrite.offset = 0;
|
||||
readwrite.count = fmt.availbytes;
|
||||
readwrite.buffer = (uint8_t *) buffer;
|
||||
readwrite.buffer = (uint8_t *)buffer;
|
||||
ret = inode->u.i_bops->ioctl(inode, BIOC_READSECT, (unsigned long)
|
||||
&readwrite);
|
||||
|
||||
@ -229,7 +229,7 @@ int main(int argc, FAR char *argv[])
|
||||
readwrite.logsector = sectors[x];
|
||||
readwrite.offset = 0;
|
||||
readwrite.count = strlen(buffer) + 1;
|
||||
readwrite.buffer = (uint8_t *) buffer;
|
||||
readwrite.buffer = (uint8_t *)buffer;
|
||||
inode->u.i_bops->ioctl(inode, BIOC_WRITESECT, (unsigned long)
|
||||
&readwrite);
|
||||
|
||||
@ -256,7 +256,7 @@ int main(int argc, FAR char *argv[])
|
||||
readwrite.logsector = sectors[x];
|
||||
readwrite.offset = 64;
|
||||
readwrite.count = strlen(buffer) + 1;
|
||||
readwrite.buffer = (uint8_t *) buffer;
|
||||
readwrite.buffer = (uint8_t *)buffer;
|
||||
inode->u.i_bops->ioctl(inode, BIOC_WRITESECT, (unsigned long)
|
||||
&readwrite);
|
||||
|
||||
@ -293,8 +293,5 @@ errout_with_driver:
|
||||
/* Now close the block device and exit */
|
||||
|
||||
close_blockdriver(inode);
|
||||
|
||||
errout:
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -588,7 +588,7 @@ int foc_intf_init(void)
|
||||
#endif
|
||||
|
||||
#ifdef FOC_HAVE_INTF
|
||||
errout:
|
||||
errout:
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
@ -636,7 +636,7 @@ int foc_intf_deinit(void)
|
||||
#endif
|
||||
|
||||
#ifdef FOC_HAVE_INTF
|
||||
errout:
|
||||
errout:
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
@ -686,7 +686,7 @@ int foc_intf_update(FAR struct foc_intf_data_s *data)
|
||||
#endif
|
||||
|
||||
#ifdef FOC_HAVE_INTF
|
||||
errout:
|
||||
errout:
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
@ -621,10 +621,8 @@ errout:
|
||||
}
|
||||
|
||||
errout_no_mutex:
|
||||
|
||||
foc_threads_deinit();
|
||||
|
||||
PRINTF("foc_main exit\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -203,7 +203,6 @@ errout:
|
||||
}
|
||||
|
||||
PRINTFV("foc_control_thr %d exit\n", envp->id);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -766,7 +766,7 @@ int main(int argc, FAR char *argv[])
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to create tun0: %d\n", ret);
|
||||
goto errout;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = ipfwd_netconfig(&fwd.if_tun0, g_tun0_laddr, g_netmask);
|
||||
@ -848,6 +848,5 @@ errout_with_tun1:
|
||||
close(fwd.if_tun1.it_fd);
|
||||
errout_with_tun0:
|
||||
close(fwd.if_tun0.it_fd);
|
||||
errout:
|
||||
return errcode;
|
||||
}
|
||||
|
@ -109,7 +109,8 @@ int main(int argc, FAR char *argv[])
|
||||
|
||||
if (buffer[0] != '0' && buffer[1] != 'x')
|
||||
{
|
||||
fprintf(stderr, "You need to pass the I2C address in hexa: 0xNN\n");
|
||||
fprintf(stderr,
|
||||
"You need to pass the I2C address in hexa: 0xNN\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -121,10 +122,13 @@ int main(int argc, FAR char *argv[])
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = ioctl(fd, SNIOC_CHANGE_SMBUSADDR, (unsigned long)((uintptr_t)&newaddr));
|
||||
ret = ioctl(fd, SNIOC_CHANGE_SMBUSADDR,
|
||||
(unsigned long)((uintptr_t)&newaddr));
|
||||
if (ret < 0)
|
||||
{
|
||||
fprintf(stderr, "ERROR: ioctl(SNIOC_CHANGE_SMBUSADDR) failed: %d\n", errno);
|
||||
fprintf(stderr,
|
||||
"ERROR: ioctl(SNIOC_CHANGE_SMBUSADDR) failed: %d\n",
|
||||
errno);
|
||||
goto out;
|
||||
}
|
||||
|
||||
@ -161,7 +165,6 @@ int main(int argc, FAR char *argv[])
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -753,7 +753,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
errout:
|
||||
|
||||
fflush(stdout);
|
||||
fflush(stderr);
|
||||
|
||||
|
@ -615,7 +615,6 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
errout:
|
||||
|
||||
if (fd > 0)
|
||||
{
|
||||
printf("Stop smps driver\n");
|
||||
|
@ -79,7 +79,7 @@ static int tcpecho_server(void);
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static int tcpecho_netsetup()
|
||||
static int tcpecho_netsetup(void)
|
||||
{
|
||||
/* If this task is excecutated as an NSH built-in function, then the
|
||||
* network has already been configured by NSH's start-up logic.
|
||||
|
@ -61,6 +61,10 @@ HTTPD_CGI_CALL(file, "file-stats", file_stats);
|
||||
HTTPD_CGI_CALL(net, "net-stats", net_stats);
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: net_stats
|
||||
****************************************************************************/
|
||||
@ -106,11 +110,15 @@ static void file_stats(struct httpd_state *pstate, char *ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: cgi_register
|
||||
****************************************************************************/
|
||||
|
||||
void cgi_register()
|
||||
void cgi_register(void)
|
||||
{
|
||||
#ifdef CONFIG_NETUTILS_HTTPDFILESTATS
|
||||
httpd_cgi_register(&file);
|
||||
|
@ -705,7 +705,7 @@ void telnet_newenviron_value(struct telnet_s *telnet, unsigned char type,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void telnet_ttype_send(struct telnet_s * telnet);
|
||||
void telnet_ttype_send(struct telnet_s *telnet);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: telnet_ttype_is
|
||||
@ -743,7 +743,7 @@ void telnet_ttype_send(struct telnet_s * telnet);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void telnet_ttype_is(struct telnet_s * telnet, const char *ttype);
|
||||
void telnet_ttype_is(struct telnet_s *telnet, const char *ttype);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: telnet_send_zmp
|
||||
@ -758,8 +758,8 @@ void telnet_ttype_is(struct telnet_s * telnet, const char *ttype);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void telnet_send_zmp(struct telnet_s * telnet, size_t argc,
|
||||
const char **argv);
|
||||
void telnet_send_zmp(struct telnet_s *telnet, size_t argc,
|
||||
const char **argv);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: telnet_send_zmpv
|
||||
@ -775,7 +775,7 @@ void telnet_send_zmp(struct telnet_s * telnet, size_t argc,
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void telnet_send_zmpv(struct telnet_s * telnet, ...);
|
||||
void telnet_send_zmpv(struct telnet_s *telnet, ...);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: telnet_send_vzmpv
|
||||
@ -787,7 +787,7 @@ void telnet_send_zmpv(struct telnet_s * telnet, ...);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void telnet_send_vzmpv(struct telnet_s * telnet, va_list va);
|
||||
void telnet_send_vzmpv(struct telnet_s *telnet, va_list va);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: telnet_begin_zmp
|
||||
@ -801,7 +801,7 @@ void telnet_send_vzmpv(struct telnet_s * telnet, va_list va);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void telnet_begin_zmp(struct telnet_s * telnet, const char *cmd);
|
||||
void telnet_begin_zmp(struct telnet_s *telnet, const char *cmd);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: telnet_zmp_arg
|
||||
@ -815,7 +815,7 @@ void telnet_begin_zmp(struct telnet_s * telnet, const char *cmd);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
void telnet_zmp_arg(struct telnet_s * telnet, const char *arg);
|
||||
void telnet_zmp_arg(struct telnet_s *telnet, const char *arg);
|
||||
|
||||
/****************************************************************************
|
||||
* Name: telnet_finish_zmp
|
||||
|
@ -298,7 +298,6 @@ errout:
|
||||
/* Set duty to zeros */
|
||||
|
||||
memset(out->duty, 0, sizeof(b16_t) * CONFIG_MOTOR_FOC_PHASES);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ static int foc_modulation_init_b16(FAR foc_handler_b16_t *h)
|
||||
goto errout;
|
||||
}
|
||||
|
||||
errout:
|
||||
errout:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,6 @@ errout:
|
||||
/* Set duty to zeros */
|
||||
|
||||
memset(out->duty, 0, sizeof(float) * CONFIG_MOTOR_FOC_PHASES);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -372,7 +372,7 @@ uint8_t *js_load_file(JSContext *ctx, size_t *pbuf_len, const char *filename)
|
||||
js_free(ctx, buf);
|
||||
else
|
||||
free(buf);
|
||||
fail:
|
||||
fail:
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ void md5_update(struct md5_context_s *ctx, unsigned char const *buf,
|
||||
|
||||
memcpy(p, buf, t);
|
||||
byte_reverse(ctx->in, 16);
|
||||
md5_transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
md5_transform(ctx->buf, (uint32_t *)ctx->in);
|
||||
buf += t;
|
||||
len -= t;
|
||||
}
|
||||
@ -194,7 +194,7 @@ void md5_update(struct md5_context_s *ctx, unsigned char const *buf,
|
||||
{
|
||||
memcpy(ctx->in, buf, 64);
|
||||
byte_reverse(ctx->in, 16);
|
||||
md5_transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
md5_transform(ctx->buf, (uint32_t *)ctx->in);
|
||||
buf += 64;
|
||||
len -= 64;
|
||||
}
|
||||
@ -241,7 +241,7 @@ void md5_final(unsigned char digest[16], struct md5_context_s *ctx)
|
||||
|
||||
memset(p, 0, count);
|
||||
byte_reverse(ctx->in, 16);
|
||||
md5_transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
md5_transform(ctx->buf, (uint32_t *)ctx->in);
|
||||
|
||||
/* Now fill the next block with 56 bytes */
|
||||
|
||||
@ -261,7 +261,7 @@ void md5_final(unsigned char digest[16], struct md5_context_s *ctx)
|
||||
((uint32_t *)ctx->in)[14] = ctx->bits[0];
|
||||
((uint32_t *)ctx->in)[15] = ctx->bits[1];
|
||||
|
||||
md5_transform(ctx->buf, (uint32_t *) ctx->in);
|
||||
md5_transform(ctx->buf, (uint32_t *)ctx->in);
|
||||
byte_reverse((unsigned char *)ctx->buf, 4);
|
||||
memcpy(digest, ctx->buf, 16);
|
||||
memset(ctx, 0, sizeof(struct md5_context_s)); /* In case it's sensitive */
|
||||
|
@ -136,7 +136,7 @@ static inline void discover_initresponse(void);
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static inline void discover_initresponse()
|
||||
static inline void discover_initresponse(void)
|
||||
{
|
||||
int chk = 0;
|
||||
int i;
|
||||
@ -283,7 +283,7 @@ static inline int discover_respond(in_addr_t *ipaddr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline int discover_socket()
|
||||
static inline int discover_socket(void)
|
||||
{
|
||||
int sockfd;
|
||||
#if defined(HAVE_SO_REUSEADDR) || defined(HAVE_SO_BROADCAST)
|
||||
@ -329,7 +329,7 @@ static inline int discover_socket()
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
static inline int discover_openlistener()
|
||||
static inline int discover_openlistener(void)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
struct ifreq req;
|
||||
|
@ -43,7 +43,7 @@
|
||||
* Name: curl4nx_easy_init()
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct curl4nx_s * curl4nx_easy_init(void)
|
||||
FAR struct curl4nx_s *curl4nx_easy_init(void)
|
||||
{
|
||||
FAR struct curl4nx_s *handle = malloc(sizeof(struct curl4nx_s));
|
||||
|
||||
|
@ -69,7 +69,7 @@ int netlib_getifstatus(FAR const char *ifname, FAR uint8_t *flags)
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
memset (&req, 0, sizeof(struct ifreq));
|
||||
memset(&req, 0, sizeof(struct ifreq));
|
||||
|
||||
/* Put the driver name into the request */
|
||||
|
||||
|
@ -68,7 +68,7 @@ int netlib_getmacaddr(const char *ifname, uint8_t *macaddr)
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
memset (&req, 0, sizeof(struct ifreq));
|
||||
memset(&req, 0, sizeof(struct ifreq));
|
||||
|
||||
/* Put the driver name into the request */
|
||||
|
||||
|
@ -67,7 +67,7 @@ int netlib_ifup(const char *ifname)
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
memset (&req, 0, sizeof(struct ifreq));
|
||||
memset(&req, 0, sizeof(struct ifreq));
|
||||
|
||||
/* Put the driver name into the request */
|
||||
|
||||
@ -110,7 +110,7 @@ int netlib_ifdown(const char *ifname)
|
||||
if (sockfd >= 0)
|
||||
{
|
||||
struct ifreq req;
|
||||
memset (&req, 0, sizeof(struct ifreq));
|
||||
memset(&req, 0, sizeof(struct ifreq));
|
||||
|
||||
/* Put the driver name into the request */
|
||||
|
||||
|
@ -62,8 +62,8 @@
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/* In the future add compression protocol and name servers (possibly for servers
|
||||
* only)
|
||||
/* In the future add compression protocol and name servers (possibly for
|
||||
* servers only)
|
||||
*/
|
||||
|
||||
static const uint8_t g_ipcplist[] =
|
||||
@ -137,6 +137,7 @@ void ipcp_rx(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer,
|
||||
switch (*bptr++)
|
||||
{
|
||||
case CONF_REQ:
|
||||
|
||||
/* Parse request and see if we can ACK it */
|
||||
|
||||
++bptr;
|
||||
@ -146,7 +147,7 @@ void ipcp_rx(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer,
|
||||
/* len-=2; */
|
||||
|
||||
DEBUG1(("check lcplist\n"));
|
||||
if (scan_packet(ctx, IPCP, g_ipcplist, buffer, bptr, (uint16_t)(len - 4)))
|
||||
if (scan_packet(ctx, IPCP, g_ipcplist, buffer, bptr, len - 4))
|
||||
{
|
||||
DEBUG1(("option was bad\n"));
|
||||
}
|
||||
@ -160,8 +161,8 @@ void ipcp_rx(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer,
|
||||
|
||||
/* Reject any protocol not */
|
||||
|
||||
/* Error? if we we need to send a config Reject ++++ this is good for
|
||||
* a subroutine.
|
||||
/* Error? if we we need to send a config Reject ++++ this is good
|
||||
* for a subroutine.
|
||||
*/
|
||||
|
||||
/* All we should get is the peer IP address */
|
||||
@ -202,7 +203,7 @@ void ipcp_rx(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer,
|
||||
*bptr++ = CONF_NAK; /* Write Conf_rej */
|
||||
*bptr++;
|
||||
|
||||
/* tptr++; *//* skip over ID */
|
||||
/* tptr++; */ /* skip over ID */
|
||||
|
||||
/* Write new length */
|
||||
|
||||
@ -219,8 +220,9 @@ void ipcp_rx(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer,
|
||||
{
|
||||
}
|
||||
#endif
|
||||
/* If we get here then we are OK, lets send an ACK and tell the rest
|
||||
* of our modules our negotiated config.
|
||||
|
||||
/* If we get here then we are OK, lets send an ACK and tell the
|
||||
* rest of our modules our negotiated config.
|
||||
*/
|
||||
|
||||
ctx->ipcp_state |= IPCP_RX_UP;
|
||||
@ -269,6 +271,7 @@ void ipcp_rx(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer,
|
||||
switch (*bptr++)
|
||||
{
|
||||
case IPCP_IPADDRESS:
|
||||
|
||||
/* Dump length */
|
||||
|
||||
bptr++;
|
||||
@ -338,6 +341,7 @@ void ipcp_rx(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer,
|
||||
switch (*bptr++)
|
||||
{
|
||||
case IPCP_IPADDRESS:
|
||||
|
||||
/* Dump length */
|
||||
|
||||
bptr++;
|
||||
@ -456,7 +460,8 @@ void ipcp_task(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer)
|
||||
* request
|
||||
*/
|
||||
|
||||
if (!(ctx->ipcp_state & IPCP_TX_UP) && !(ctx->ipcp_state & IPCP_TX_TIMEOUT))
|
||||
if (!(ctx->ipcp_state & IPCP_TX_UP) &&
|
||||
!(ctx->ipcp_state & IPCP_TX_TIMEOUT))
|
||||
{
|
||||
/* Check if we have a request pending */
|
||||
|
||||
@ -466,7 +471,7 @@ void ipcp_task(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer)
|
||||
|
||||
/* No pending request, lets build one */
|
||||
|
||||
pkt = (IPCPPKT *) buffer;
|
||||
pkt = (IPCPPKT *)buffer;
|
||||
|
||||
/* Configure-Request only here, write id */
|
||||
|
||||
|
@ -122,6 +122,7 @@ void lcp_rx(struct ppp_context_s *ctx, uint8_t * buffer, uint16_t count)
|
||||
switch (*bptr++)
|
||||
{
|
||||
case CONF_REQ: /* config request */
|
||||
|
||||
/* Parse request and see if we can ACK it */
|
||||
|
||||
id = *bptr++;
|
||||
@ -191,14 +192,14 @@ void lcp_rx(struct ppp_context_s *ctx, uint8_t * buffer, uint16_t count)
|
||||
{
|
||||
/* OK */
|
||||
|
||||
DEBUG1(("<asyncmap sum=0x%04x>, assume 0xffffffff", j));
|
||||
DEBUG1(("<asyncmap sum=0x%04x>, assume all ones", j));
|
||||
ctx->ahdlc_flags &= ~PPP_TX_ASYNC_MAP;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fail. We only support default or all zeros */
|
||||
|
||||
DEBUG1(("We only support default or all zeros for ACCM "));
|
||||
DEBUG1(("We only support default or all zeros ACCM "));
|
||||
error = 1;
|
||||
*tptr++ = LPC_ACCM;
|
||||
*tptr++ = 0x6;
|
||||
@ -236,9 +237,9 @@ void lcp_rx(struct ppp_context_s *ctx, uint8_t * buffer, uint16_t count)
|
||||
case LPC_MAGICNUMBER:
|
||||
DEBUG1(("<magic > "));
|
||||
|
||||
/* Compare incoming number to our number (not implemented) */
|
||||
/* Compare incoming number to our number */
|
||||
|
||||
bptr++; /* For now just dump */
|
||||
bptr++; /* For now just dump */
|
||||
bptr++;
|
||||
bptr++;
|
||||
bptr++;
|
||||
@ -259,8 +260,8 @@ void lcp_rx(struct ppp_context_s *ctx, uint8_t * buffer, uint16_t count)
|
||||
}
|
||||
}
|
||||
|
||||
/* Error? if we we need to send a config Reject ++++ this is good for
|
||||
* a subroutine.
|
||||
/* Error? if we we need to send a config Reject ++++ this is good
|
||||
* for a subroutine.
|
||||
*/
|
||||
|
||||
if (error)
|
||||
@ -282,7 +283,9 @@ void lcp_rx(struct ppp_context_s *ctx, uint8_t * buffer, uint16_t count)
|
||||
|
||||
DEBUG1(("\nWriting NAK frame\n"));
|
||||
|
||||
/* Send packet ahdlc_txz(procol,header,data,headerlen,datalen); */
|
||||
/* Send packet:
|
||||
* ahdlc_txz(procol,header,data,headerlen,datalen);
|
||||
*/
|
||||
|
||||
ahdlc_tx(ctx, LCP, 0, buffer, 0, (uint16_t)(tptr - buffer));
|
||||
DEBUG1(("- end NAK Write frame\n"));
|
||||
@ -309,7 +312,9 @@ void lcp_rx(struct ppp_context_s *ctx, uint8_t * buffer, uint16_t count)
|
||||
|
||||
DEBUG2(("Writing ACK frame\n"));
|
||||
|
||||
/* Send packet ahdlc_txz(procol,header,data,headerlen,datalen); */
|
||||
/* Send packet:
|
||||
* ahdlc_txz(procol,header,data,headerlen,datalen);
|
||||
*/
|
||||
|
||||
ahdlc_tx(ctx, LCP, 0, buffer, 0, count /* bptr-buffer */);
|
||||
DEBUG2(("- end ACK Write frame\n"));
|
||||
@ -444,7 +449,7 @@ void lcp_echo_request(struct ppp_context_s *ctx)
|
||||
{
|
||||
ctx->lcp_prev_seconds = ppp_arch_clock_seconds();
|
||||
|
||||
pkt = (LCPPKT *) buffer;
|
||||
pkt = (LCPPKT *)buffer;
|
||||
|
||||
/* Configure-Request only here, write id */
|
||||
|
||||
@ -507,7 +512,7 @@ void lcp_task(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer)
|
||||
|
||||
/* No pending request, lets build one */
|
||||
|
||||
pkt = (LCPPKT *) buffer;
|
||||
pkt = (LCPPKT *)buffer;
|
||||
|
||||
/* Configure-Request only here, write id */
|
||||
|
||||
|
@ -150,7 +150,7 @@ void pap_task(FAR struct ppp_context_s *ctx, FAR uint8_t * buffer)
|
||||
|
||||
/* Build a PAP request packet */
|
||||
|
||||
pkt = (PAPPKT *) buffer;
|
||||
pkt = (PAPPKT *)buffer;
|
||||
|
||||
/* Configure-Request only here, write id */
|
||||
|
||||
|
@ -107,7 +107,7 @@ static void ppp_reject_protocol(FAR struct ppp_context_s *ctx,
|
||||
*--dptr = *--sptr;
|
||||
}
|
||||
|
||||
pkt = (LCPPKT *) buffer;
|
||||
pkt = (LCPPKT *)buffer;
|
||||
pkt->code = PROT_REJ; /* Write Conf_rej */
|
||||
|
||||
/* pkt->id = tid++; write tid */
|
||||
|
@ -446,7 +446,6 @@ static int usrsock_rpmsg_sendto_handler(struct rpmsg_endpoint *ept,
|
||||
}
|
||||
|
||||
out:
|
||||
|
||||
if (ret > 0 &&
|
||||
usrsock_rpmsg_available(&priv->socks[req->usockid], FIONSPACE))
|
||||
{
|
||||
|
@ -241,7 +241,6 @@ ssize_t httpd_dirlist(int outfd, FAR struct httpd_fs_file *file)
|
||||
closedir(dir);
|
||||
|
||||
errout_with_hdr:
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
uname(&info);
|
||||
|
||||
@ -262,7 +261,6 @@ errout_with_hdr:
|
||||
ret = total;
|
||||
|
||||
errout:
|
||||
|
||||
free(tmp);
|
||||
return ret;
|
||||
}
|
||||
|
@ -40,8 +40,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* Lightweight Embedded XML-RPC Server Response Generator
|
||||
/* Lightweight Embedded XML-RPC Server Response Generator
|
||||
*
|
||||
* mtj@cogitollc.com
|
||||
*
|
||||
@ -61,9 +60,12 @@
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static int xmlrpc_insertlength(struct xmlrpc_s * xmlcall)
|
||||
static int xmlrpc_insertlength(struct xmlrpc_s *xmlcall)
|
||||
{
|
||||
int len, digit, xdigit = 1000, i = 0;
|
||||
int xdigit = 1000;
|
||||
int i = 0;
|
||||
int len;
|
||||
int digit;
|
||||
char *temp;
|
||||
|
||||
temp = strstr(xmlcall->response, "<?xml");
|
||||
@ -91,7 +93,7 @@ static int xmlrpc_insertlength(struct xmlrpc_s * xmlcall)
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
int xmlrpc_getinteger(struct xmlrpc_s * xmlcall, int *arg)
|
||||
int xmlrpc_getinteger(struct xmlrpc_s *xmlcall, int *arg)
|
||||
{
|
||||
if ((xmlcall == NULL) || (arg == NULL))
|
||||
{
|
||||
@ -108,7 +110,7 @@ int xmlrpc_getinteger(struct xmlrpc_s * xmlcall, int *arg)
|
||||
return XMLRPC_UNEXPECTED_INTEGER_ARG;
|
||||
}
|
||||
|
||||
int xmlrpc_getbool(struct xmlrpc_s * xmlcall, int *arg)
|
||||
int xmlrpc_getbool(struct xmlrpc_s *xmlcall, int *arg)
|
||||
{
|
||||
if ((xmlcall == NULL) || (arg == NULL))
|
||||
{
|
||||
@ -125,7 +127,7 @@ int xmlrpc_getbool(struct xmlrpc_s * xmlcall, int *arg)
|
||||
return XMLRPC_UNEXPECTED_BOOLEAN_ARG;
|
||||
}
|
||||
|
||||
int xmlrpc_getdouble(struct xmlrpc_s * xmlcall, double *arg)
|
||||
int xmlrpc_getdouble(struct xmlrpc_s *xmlcall, double *arg)
|
||||
{
|
||||
if ((xmlcall == NULL) || (arg == NULL))
|
||||
{
|
||||
@ -142,7 +144,7 @@ int xmlrpc_getdouble(struct xmlrpc_s * xmlcall, double *arg)
|
||||
return XMLRPC_UNEXPECTED_DOUBLE_ARG;
|
||||
}
|
||||
|
||||
int xmlrpc_getstring(struct xmlrpc_s* xmlcall, char *arg)
|
||||
int xmlrpc_getstring(struct xmlrpc_s *xmlcall, char *arg)
|
||||
{
|
||||
if ((xmlcall == NULL) || (arg == NULL))
|
||||
{
|
||||
@ -159,13 +161,16 @@ int xmlrpc_getstring(struct xmlrpc_s* xmlcall, char *arg)
|
||||
return XMLRPC_UNEXPECTED_STRING_ARG;
|
||||
}
|
||||
|
||||
int xmlrpc_buildresponse(struct xmlrpc_s* xmlcall, char *args, ...)
|
||||
int xmlrpc_buildresponse(struct xmlrpc_s *xmlcall, char *args, ...)
|
||||
{
|
||||
va_list argp;
|
||||
int i, ret = 0, index = 0, close = 0;
|
||||
int ret = 0;
|
||||
int index = 0;
|
||||
int close = 0;
|
||||
int isstruct = 0;
|
||||
int i;
|
||||
double d;
|
||||
char *s;
|
||||
int isStruct = 0;
|
||||
|
||||
if ((xmlcall == NULL) || (args == NULL))
|
||||
{
|
||||
@ -193,7 +198,7 @@ int xmlrpc_buildresponse(struct xmlrpc_s* xmlcall, char *args, ...)
|
||||
|
||||
while (args[index])
|
||||
{
|
||||
if (isStruct)
|
||||
if (isstruct)
|
||||
{
|
||||
if ((args[index] != '{') && (args[index] != '}'))
|
||||
{
|
||||
@ -210,13 +215,13 @@ int xmlrpc_buildresponse(struct xmlrpc_s* xmlcall, char *args, ...)
|
||||
case '{':
|
||||
sprintf(&xmlcall->response[strlen(xmlcall->response)],
|
||||
" <value><struct>\n");
|
||||
isStruct = 1;
|
||||
isstruct = 1;
|
||||
break;
|
||||
|
||||
case '}':
|
||||
sprintf(&xmlcall->response[strlen(xmlcall->response)],
|
||||
" </struct></value>\n");
|
||||
isStruct = 0;
|
||||
isstruct = 0;
|
||||
break;
|
||||
|
||||
case 'i':
|
||||
@ -246,7 +251,6 @@ int xmlrpc_buildresponse(struct xmlrpc_s* xmlcall, char *args, ...)
|
||||
default:
|
||||
return (XMLRPC_BAD_RESPONSE_ARG);
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if (close)
|
||||
@ -263,7 +267,8 @@ int xmlrpc_buildresponse(struct xmlrpc_s* xmlcall, char *args, ...)
|
||||
|
||||
if (xmlcall->error)
|
||||
{
|
||||
strcat(&xmlcall->response[strlen(xmlcall->response)], " </fault>\r\n");
|
||||
strcat(&xmlcall->response[strlen(xmlcall->response)],
|
||||
" </fault>\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -40,8 +40,7 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
* Lightweight Embedded XML-RPC Server XML Parser
|
||||
/* Lightweight Embedded XML-RPC Server XML Parser
|
||||
*
|
||||
* mtj@cogitollc.com
|
||||
*
|
||||
@ -71,22 +70,22 @@
|
||||
****************************************************************************/
|
||||
|
||||
static struct xmlrpc_s g_xmlcall;
|
||||
static char g_data[CONFIG_XMLRPC_STRINGSIZE+1];
|
||||
static char g_data[CONFIG_XMLRPC_STRINGSIZE + 1];
|
||||
static struct xmlrpc_entry_s *g_entries = NULL;
|
||||
|
||||
static const char *errorStrings[] =
|
||||
static const char *g_error_strings[] =
|
||||
{
|
||||
/* 0 */ "Internal error (unknown)",
|
||||
/* 1 */ "Parse Error...",
|
||||
/* 2 */ "Function not found...",
|
||||
/* 3 */ "Unexpected Integer Argument...",
|
||||
/* 4 */ "Unexpected Boolean Argument...",
|
||||
/* 5 */ "Unexpected Double Argument...",
|
||||
/* 6 */ "Unexpected String Argument...",
|
||||
/* 7 */ "Bad Response Argument..."
|
||||
"Internal error (unknown)",
|
||||
"Parse Error...",
|
||||
"Function not found...",
|
||||
"Unexpected Integer Argument...",
|
||||
"Unexpected Boolean Argument...",
|
||||
"Unexpected Double Argument...",
|
||||
"Unexpected String Argument...",
|
||||
"Bad Response Argument..."
|
||||
};
|
||||
|
||||
#define MAX_ERROR_CODE (sizeof(errorStrings)/sizeof(char *))
|
||||
#define MAX_ERROR_CODE (sizeof(g_error_strings)/sizeof(char *))
|
||||
|
||||
struct parsebuf_s
|
||||
{
|
||||
@ -99,7 +98,7 @@ struct parsebuf_s
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
|
||||
static int xmlrpc_call(struct xmlrpc_s * call)
|
||||
static int xmlrpc_call(struct xmlrpc_s *call)
|
||||
{
|
||||
int ret = XMLRPC_NO_SUCH_FUNCTION;
|
||||
struct xmlrpc_entry_s *entry = g_entries;
|
||||
@ -120,7 +119,7 @@ static int xmlrpc_call(struct xmlrpc_s * call)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int xmlrpc_getelement(struct parsebuf_s * pbuf, char *data, int dataSize)
|
||||
static int xmlrpc_getelement(struct parsebuf_s *pbuf, char *data, int size)
|
||||
{
|
||||
int j = 0;
|
||||
int ret = XMLRPC_NO_ERROR;
|
||||
@ -146,7 +145,7 @@ static int xmlrpc_getelement(struct parsebuf_s * pbuf, char *data, int dataSize)
|
||||
|
||||
data[j++] = pbuf->buf[pbuf->index++];
|
||||
|
||||
while (j < dataSize)
|
||||
while (j < size)
|
||||
{
|
||||
if (pbuf->buf[pbuf->index] == '>')
|
||||
{
|
||||
@ -161,7 +160,7 @@ static int xmlrpc_getelement(struct parsebuf_s * pbuf, char *data, int dataSize)
|
||||
else
|
||||
{
|
||||
data[j++] = pbuf->buf[pbuf->index++];
|
||||
if (j >= dataSize)
|
||||
if (j >= size)
|
||||
{
|
||||
ret = XMLRPC_PARSE_ERROR;
|
||||
}
|
||||
@ -172,7 +171,7 @@ static int xmlrpc_getelement(struct parsebuf_s * pbuf, char *data, int dataSize)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int xmlrpc_parseparam(struct parsebuf_s * pbuf)
|
||||
static int xmlrpc_parseparam(struct parsebuf_s *pbuf)
|
||||
{
|
||||
int type;
|
||||
|
||||
@ -273,9 +272,10 @@ static int xmlrpc_parseparam(struct parsebuf_s * pbuf)
|
||||
return XMLRPC_NO_ERROR;
|
||||
}
|
||||
|
||||
static int xmlrpc_parseparams(struct parsebuf_s * pbuf)
|
||||
static int xmlrpc_parseparams(struct parsebuf_s *pbuf)
|
||||
{
|
||||
int type, ret = XMLRPC_PARSE_ERROR;
|
||||
int ret = XMLRPC_PARSE_ERROR;
|
||||
int type;
|
||||
|
||||
/* First, look for the params tag */
|
||||
|
||||
@ -305,9 +305,10 @@ static int xmlrpc_parseparams(struct parsebuf_s * pbuf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int xmlrpc_parsemethod(struct parsebuf_s * pbuf)
|
||||
static int xmlrpc_parsemethod(struct parsebuf_s *pbuf)
|
||||
{
|
||||
int type, ret = XMLRPC_PARSE_ERROR;
|
||||
int ret = XMLRPC_PARSE_ERROR;
|
||||
int type;
|
||||
|
||||
memset((void *)&g_xmlcall, 0, sizeof(struct xmlrpc_s));
|
||||
|
||||
@ -348,8 +349,8 @@ static void xmlrpc_sendfault(int fault)
|
||||
fault = 0;
|
||||
}
|
||||
|
||||
xmlrpc_buildresponse(&g_xmlcall, "{is}",
|
||||
"faultCode", fault, "faultString", errorStrings[fault]);
|
||||
xmlrpc_buildresponse(&g_xmlcall, "{is}", "faultCode",
|
||||
fault, "faultString", g_error_strings[fault]);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -5,7 +5,8 @@
|
||||
* Copyright (c) 2011, B.ZaaR, All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
@ -18,7 +19,7 @@
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS & CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
@ -51,7 +52,8 @@
|
||||
|
||||
static int runinsert(FAR struct command_s *cmd)
|
||||
{
|
||||
long dest, rpt;
|
||||
long dest;
|
||||
long rpt;
|
||||
|
||||
/* Default to a 0 (zero) value for 1 count */
|
||||
|
||||
@ -108,6 +110,7 @@ static int setinsert(FAR struct command_s *cmd, int optc, char *opt)
|
||||
switch (optc)
|
||||
{
|
||||
case 0:
|
||||
|
||||
/* Set destination */
|
||||
|
||||
cmd->opts.dest = v;
|
||||
@ -115,6 +118,7 @@ static int setinsert(FAR struct command_s *cmd, int optc, char *opt)
|
||||
break;
|
||||
|
||||
case 1:
|
||||
|
||||
/* Set count (len) */
|
||||
|
||||
cmd->opts.len = v;
|
||||
@ -122,6 +126,7 @@ static int setinsert(FAR struct command_s *cmd, int optc, char *opt)
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
/* Set values */
|
||||
|
||||
if (optc > 1 && cmd->opts.cnt < OPT_BUF_SZ)
|
||||
@ -134,20 +139,21 @@ static int setinsert(FAR struct command_s *cmd, int optc, char *opt)
|
||||
break;
|
||||
|
||||
case WORD_32:
|
||||
*((int32_t *) hx + cmd->opts.cnt) = v;
|
||||
*((int32_t *)hx + cmd->opts.cnt) = v;
|
||||
break;
|
||||
|
||||
case WORD_16:
|
||||
*((int16_t *) hx + cmd->opts.cnt) = v;
|
||||
*((int16_t *)hx + cmd->opts.cnt) = v;
|
||||
break;
|
||||
|
||||
case WORD_8:
|
||||
*((int8_t *) hx + cmd->opts.cnt) = v;
|
||||
*((int8_t *)hx + cmd->opts.cnt) = v;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
cmd->opts.cnt++;
|
||||
optc++;
|
||||
|
||||
|
@ -174,7 +174,6 @@ int i2ccmd_dev(FAR struct i2ctool_s *i2ctool, int argc, char **argv)
|
||||
close(fd);
|
||||
|
||||
errout:
|
||||
|
||||
/* Restore the previous "sticky" register address unless a new register
|
||||
* address was provided on the command line. In that case the new
|
||||
* register address is retained.
|
||||
|
@ -111,7 +111,7 @@ void i2ctool_hexdump(FILE *outstream, void *addr, int len)
|
||||
{
|
||||
/* print address */
|
||||
|
||||
fprintf(outstream, "%08tx ", p - (uint8_t *) addr);
|
||||
fprintf(outstream, "%08tx ", p - (uint8_t *)addr);
|
||||
|
||||
/* print one line of data */
|
||||
|
||||
|
@ -1135,7 +1135,6 @@ int nxlooper_loopraw(FAR struct nxlooper_s *plooper,
|
||||
return OK;
|
||||
|
||||
err_out:
|
||||
|
||||
#ifdef CONFIG_AUDIO_MULTI_SESSION
|
||||
ioctl(plooper->playdev_fd, AUDIOIOC_RELEASE,
|
||||
(unsigned long)plooper->pplayses);
|
||||
@ -1144,7 +1143,6 @@ err_out:
|
||||
#endif
|
||||
|
||||
err_out_record:
|
||||
|
||||
#ifdef CONFIG_AUDIO_MULTI_SESSION
|
||||
ioctl(plooper->recorddev_fd, AUDIOIOC_RELEASE,
|
||||
(unsigned long)plooper->precordses);
|
||||
@ -1153,7 +1151,6 @@ err_out_record:
|
||||
#endif
|
||||
|
||||
err_out_dev:
|
||||
|
||||
close(plooper->playdev_fd);
|
||||
plooper->playdev_fd = -1;
|
||||
close(plooper->recorddev_fd);
|
||||
|
@ -752,7 +752,7 @@ static int nxplayer_enqueuebuffer(FAR struct nxplayer_s *pplayer,
|
||||
|
||||
static void *nxplayer_playthread(pthread_addr_t pvarg)
|
||||
{
|
||||
struct nxplayer_s *pplayer = (struct nxplayer_s *) pvarg;
|
||||
struct nxplayer_s *pplayer = (struct nxplayer_s *)pvarg;
|
||||
struct audio_msg_s msg;
|
||||
struct audio_buf_desc_s buf_desc;
|
||||
ssize_t size;
|
||||
|
@ -225,7 +225,7 @@ static int nxrecorder_enqueuebuffer(FAR struct nxrecorder_s *precorder,
|
||||
|
||||
static void *nxrecorder_recordthread(pthread_addr_t pvarg)
|
||||
{
|
||||
struct nxrecorder_s *precorder = (struct nxrecorder_s *) pvarg;
|
||||
struct nxrecorder_s *precorder = (struct nxrecorder_s *)pvarg;
|
||||
struct audio_msg_s msg;
|
||||
struct audio_buf_desc_s buf_desc;
|
||||
ssize_t size;
|
||||
|
@ -307,7 +307,7 @@ struct vi_s
|
||||
struct vi_pos_s cursor; /* Current cursor position */
|
||||
struct vi_pos_s cursave; /* Saved cursor position */
|
||||
struct vi_pos_s display; /* Display size */
|
||||
FAR struct termcurses_s * tcurs;
|
||||
FAR struct termcurses_s *tcurs;
|
||||
off_t curpos; /* The current cursor offset into the text buffer */
|
||||
off_t textsize; /* The size of the text buffer */
|
||||
off_t winpos; /* Offset corresponding to the start of the display */
|
||||
|
@ -352,10 +352,7 @@ static void test_nvs_mount(struct mtdnvs_ctx_s *ctx)
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -472,10 +469,7 @@ static void test_nvs_write(struct mtdnvs_ctx_s *ctx)
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -648,16 +642,17 @@ static void test_nvs_corrupt_expire(struct mtdnvs_ctx_s *ctx)
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
if (mtd_fd >= 0)
|
||||
close(mtd_fd);
|
||||
{
|
||||
close(mtd_fd);
|
||||
}
|
||||
|
||||
if (nvs_fd >= 0)
|
||||
close(nvs_fd);
|
||||
{
|
||||
close(nvs_fd);
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -808,7 +803,6 @@ static void test_nvs_corrupted_write(struct mtdnvs_ctx_s *ctx)
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
if (nvs_fd > 0)
|
||||
{
|
||||
@ -819,8 +813,6 @@ test_fail:
|
||||
{
|
||||
close(mtd_fd);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -975,16 +967,15 @@ static void test_nvs_gc(struct mtdnvs_ctx_s *ctx)
|
||||
}
|
||||
|
||||
printf("%s: success\n", __func__);
|
||||
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1033,7 +1024,9 @@ static int write_content(uint16_t max_id, uint16_t begin, uint16_t end)
|
||||
|
||||
test_fail:
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1090,9 +1083,10 @@ static int check_content(uint16_t max_id)
|
||||
return ret;
|
||||
|
||||
test_fail:
|
||||
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1284,14 +1278,10 @@ static void test_nvs_gc_3sectors(struct mtdnvs_ctx_s *ctx)
|
||||
}
|
||||
|
||||
printf("%s: success\n", __func__);
|
||||
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1473,20 +1463,20 @@ static void test_nvs_corrupted_sector_close(struct mtdnvs_ctx_s *ctx)
|
||||
}
|
||||
|
||||
printf("%s: success\n", __func__);
|
||||
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
if (nvs_fd >= 0)
|
||||
close(nvs_fd);
|
||||
{
|
||||
close(nvs_fd);
|
||||
}
|
||||
|
||||
if (mtd_fd >= 0)
|
||||
close(mtd_fd);
|
||||
{
|
||||
close(mtd_fd);
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1638,17 +1628,15 @@ static void test_nvs_full_sector(struct mtdnvs_ctx_s *ctx)
|
||||
}
|
||||
|
||||
printf("%s: success\n", __func__);
|
||||
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
{
|
||||
close(fd);
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1828,20 +1816,20 @@ static void test_nvs_gc_corrupt_close_ate(struct mtdnvs_ctx_s *ctx)
|
||||
}
|
||||
|
||||
printf("%s: success\n", __func__);
|
||||
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
if (nvs_fd >= 0)
|
||||
close(nvs_fd);
|
||||
{
|
||||
close(nvs_fd);
|
||||
}
|
||||
|
||||
if (mtd_fd >= 0)
|
||||
close(mtd_fd);
|
||||
{
|
||||
close(mtd_fd);
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -1966,17 +1954,15 @@ static void test_nvs_gc_corrupt_ate(struct mtdnvs_ctx_s *ctx)
|
||||
}
|
||||
|
||||
printf("%s: success\n", __func__);
|
||||
|
||||
return;
|
||||
|
||||
test_fail:
|
||||
|
||||
if (mtd_fd >= 0)
|
||||
close(mtd_fd);
|
||||
{
|
||||
close(mtd_fd);
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -2125,7 +2111,6 @@ test_fail:
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -2303,7 +2288,6 @@ test_fail:
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
@ -2461,7 +2445,6 @@ test_fail:
|
||||
}
|
||||
|
||||
printf("%s: failed\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -273,7 +273,7 @@ static void test_two_threads(void)
|
||||
|
||||
static void * timeout_thread1(FAR void * data)
|
||||
{
|
||||
FAR struct race_cond_s * rc = (FAR struct race_cond_s *) data;
|
||||
FAR struct race_cond_s *rc = (FAR struct race_cond_s *)data;
|
||||
int status;
|
||||
|
||||
status = pthread_rwlock_wrlock(rc->rw_lock);
|
||||
@ -297,7 +297,7 @@ static void * timeout_thread1(FAR void * data)
|
||||
|
||||
static void * timeout_thread2(FAR void * data)
|
||||
{
|
||||
FAR struct race_cond_s * rc = (FAR struct race_cond_s *) data;
|
||||
FAR struct race_cond_s *rc = (FAR struct race_cond_s *)data;
|
||||
struct timespec time;
|
||||
int status;
|
||||
|
||||
|
@ -42,7 +42,7 @@ struct sync_s
|
||||
|
||||
static void * timeout_thread1(FAR void * data)
|
||||
{
|
||||
FAR struct sync_s * sync = (FAR struct sync_s *) data;
|
||||
FAR struct sync_s *sync = (FAR struct sync_s *)data;
|
||||
struct timespec time;
|
||||
int status;
|
||||
|
||||
@ -64,7 +64,7 @@ static void * timeout_thread1(FAR void * data)
|
||||
|
||||
static void * timeout_thread2(FAR void * data)
|
||||
{
|
||||
FAR struct sync_s * sync = (FAR struct sync_s *) data;
|
||||
FAR struct sync_s *sync = (FAR struct sync_s *)data;
|
||||
struct timespec time;
|
||||
int status;
|
||||
|
||||
|
@ -861,7 +861,6 @@ static int sendto_request(int fd, FAR struct gs2200m_s *priv,
|
||||
}
|
||||
|
||||
prepare:
|
||||
|
||||
if (sendbuf)
|
||||
{
|
||||
free(sendbuf);
|
||||
@ -1031,7 +1030,6 @@ prepare:
|
||||
}
|
||||
|
||||
err_out:
|
||||
|
||||
gs2200m_printf("%s: *** end ret=%d\n", __func__, ret);
|
||||
|
||||
if (rmsg.buf)
|
||||
@ -1803,7 +1801,6 @@ int main(int argc, FAR char *argv[])
|
||||
ret = gs2200m_loop(_daemon);
|
||||
|
||||
errout:
|
||||
|
||||
if (_daemon)
|
||||
{
|
||||
free(_daemon);
|
||||
|
Loading…
Reference in New Issue
Block a user