Skip to content

Commit

Permalink
Merge pull request #88 from mysterywolf/master
Browse files Browse the repository at this point in the history
使用rt_xxx替换
  • Loading branch information
xiangxistu authored Jan 12, 2022
2 parents 38d3aab + 0e58af0 commit c95b77a
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions iperf/iperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void iperf_udp_client(void *thread_param)
{
return;
}
memset(buffer, 0x00, IPERF_BUFSZ);
rt_memset(buffer, 0x00, IPERF_BUFSZ);
sock = socket(PF_INET, SOCK_DGRAM, 0);
if(sock < 0)
{
Expand Down Expand Up @@ -286,7 +286,7 @@ void iperf_server(void *thread_param)
server_addr.sin_family = AF_INET;
server_addr.sin_port = htons(param.port);
server_addr.sin_addr.s_addr = INADDR_ANY;
memset(&(server_addr.sin_zero), 0x0, sizeof(server_addr.sin_zero));
rt_memset(&(server_addr.sin_zero), 0x0, sizeof(server_addr.sin_zero));

if (bind(sock, (struct sockaddr *)&server_addr, sizeof(struct sockaddr)) == -1)
{
Expand Down
2 changes: 1 addition & 1 deletion ntp/ntp.c
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ static rt_bool_t ntp_check_network(void)
{
#ifdef RT_USING_NETDEV
struct netdev * netdev = netdev_get_by_family(AF_INET);
return (netdev && netdev_is_link_up(netdev));
return (netdev && netdev_is_link_up(netdev));
#else
return RT_TRUE;
#endif
Expand Down
8 changes: 4 additions & 4 deletions ping/ping.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -161,15 +161,15 @@ rt_err_t ping(char* target_name, rt_uint32_t times, rt_size_t size)
size = PING_DATA_SIZE;
}

memset(&hint, 0, sizeof(hint));
rt_memset(&hint, 0, sizeof(hint));
/* convert URL to IP */
if (lwip_getaddrinfo(target_name, NULL, &hint, &res) != 0)
{
rt_kprintf("ping: unknown host %s\n", target_name);
return -RT_ERROR;
}
memcpy(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
memcpy(&ina, &h->sin_addr, sizeof(ina));
rt_memcpy(&h, &res->ai_addr, sizeof(struct sockaddr_in *));
rt_memcpy(&ina, &h->sin_addr, sizeof(ina));
lwip_freeaddrinfo(res);
if (inet_aton(inet_ntoa(ina), &target_addr) == 0)
{
Expand Down
2 changes: 1 addition & 1 deletion tcpdump/tcpdump.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
6 changes: 3 additions & 3 deletions telnet/telnet.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -325,10 +325,10 @@ static void telnet_thread(void* parameter)
}

if(setsockopt(telnet->server_fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&keepalive, sizeof(keepalive)) < 0)
{
{
rt_kprintf("telnet:set socket keepalive failed\n");
return;
}
}

addr.sin_family = AF_INET;
addr.sin_port = htons(TELNET_PORT);
Expand Down
2 changes: 1 addition & 1 deletion tftp/tftp.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
2 changes: 1 addition & 1 deletion tftp/tftp_client.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
2 changes: 1 addition & 1 deletion tftp/tftp_port.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down
10 changes: 5 additions & 5 deletions tftp/tftp_server.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -114,7 +114,7 @@ static struct tftp_client_xfer *tftp_client_xfer_add(struct tftp_server *server,
{
if (_private->client_table[i].xfer == NULL)
{
memset(&_private->client_table[i], 0, sizeof(struct tftp_client_xfer));
rt_memset(&_private->client_table[i], 0, sizeof(struct tftp_client_xfer));
_private->client_table[i].xfer = xfer;
return &_private->client_table[i];
}
Expand Down Expand Up @@ -342,7 +342,7 @@ static struct tftp_client_xfer *tftp_server_request_handle(struct tftp_server *s

_private = server->_private;
/* Receiving client requests */
memset(packet, 0, sizeof(struct tftp_packet));
rt_memset(packet, 0, sizeof(struct tftp_packet));
xfer = tftp_recv_request(_private->server_xfer, packet);
if (xfer == NULL)
{
Expand Down Expand Up @@ -550,7 +550,7 @@ struct tftp_server *tftp_server_create(const char *root_name, int port)
return NULL;
}
/* init server object */
memset(server, 0, mem_len);
rt_memset(server, 0, mem_len);
server->root_name = strdup(root_name);
if (server->root_name == NULL)
{
Expand All @@ -567,7 +567,7 @@ struct tftp_server *tftp_server_create(const char *root_name, int port)
free(server);
return NULL;
}
memset(_private->client_table, 0, mem_len);
rt_memset(_private->client_table, 0, mem_len);
_private->table_num = TFTP_SERVER_CONNECT_MAX;
return server;
}
Expand Down
10 changes: 5 additions & 5 deletions tftp/tftp_xfer.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down Expand Up @@ -202,7 +202,7 @@ int tftp_send_request(struct tftp_xfer *xfer, uint16_t cmd, const char *remote_f
}
/* Packing request packet header */
send_packet->cmd = htons(cmd);
size = sprintf(send_packet->info.filename, "%s%c%s%c%s%c%d%c%s%c%d%c",
size = rt_sprintf(send_packet->info.filename, "%s%c%s%c%s%c%d%c%s%c%d%c",
remote_file, 0, xfer->mode, 0, "blksize", 0, xfer->blksize, 0,"tsize", 0, 0, 0) + 2;
/* send data */
r_size = sendto(xfer->sock, send_packet, size, 0,
Expand Down Expand Up @@ -233,7 +233,7 @@ struct tftp_xfer *tftp_recv_request(struct tftp_xfer *xfer, struct tftp_packet *

/* get packet size */
mem_size = sizeof(struct tftp_packet);
memset(packet, 0, mem_size);
rt_memset(packet, 0, mem_size);
/* Receiving raw data */
size = tftp_recv_raw_data(xfer, packet, mem_size);
if (size > 0)
Expand All @@ -248,7 +248,7 @@ struct tftp_xfer *tftp_recv_request(struct tftp_xfer *xfer, struct tftp_packet *
if (client_xfer != NULL)
{
struct tftp_xfer_private *_client_private = client_xfer->_private;
memcpy(&_client_private->sender, &_private->sender, sizeof(struct sockaddr_in));
rt_memcpy(&_client_private->sender, &_private->sender, sizeof(struct sockaddr_in));
}
if (ntohs(packet->cmd) == TFTP_CMD_RRQ)
{
Expand Down Expand Up @@ -343,7 +343,7 @@ struct tftp_xfer *tftp_xfer_create(const char *ip_addr, int port)
tftp_printf("can't create tftp transfer!! exit\n");
return NULL;
}
memset(xfer, 0, mem_len);
rt_memset(xfer, 0, mem_len);
_private = (struct tftp_xfer_private *)&xfer[1];

/* create socket */
Expand Down
2 changes: 1 addition & 1 deletion tftp/tftp_xfer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2006-2021, RT-Thread Development Team
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
Expand Down

0 comments on commit c95b77a

Please sign in to comment.