!5 修正缩进风格

Merge pull request !5 from Caoruihong/caoruihong_20200914105449
This commit is contained in:
Caoruihong 2020-09-14 11:33:20 +08:00 committed by openharmony_ci
parent aef38baf44
commit 9c10570033
1 changed files with 419 additions and 419 deletions

View File

@ -225,14 +225,14 @@ int netstat_netconn_sendq(struct netconn *conn);
} \ } \
} }
#define ERR_IFCONFIG_STRING_PUT(ret, str) do \ #define ERR_IFCONFIG_STRING_PUT(ret, str) \
{ \ do { \
(ret) = snprintf_s(ifconfig_cmd->cb_print_buf + ifconfig_cmd->print_len, \ (ret) = snprintf_s(ifconfig_cmd->cb_print_buf + ifconfig_cmd->print_len, \
PRINT_BUF_LEN - ifconfig_cmd->print_len, \ PRINT_BUF_LEN - ifconfig_cmd->print_len, \
((PRINT_BUF_LEN - ifconfig_cmd->print_len) - 1), (str)); \ ((PRINT_BUF_LEN - ifconfig_cmd->print_len) - 1), (str)); \
if (((ret) > 0) && ((unsigned int)(ret) < (PRINT_BUF_LEN - ifconfig_cmd->print_len))) \ if (((ret) > 0) && ((unsigned int)(ret) < (PRINT_BUF_LEN - ifconfig_cmd->print_len))) \
ifconfig_cmd->print_len += (unsigned int)(ret); \ ifconfig_cmd->print_len += (unsigned int)(ret); \
} while(0) } while (0) \
#define LWIP_MSECS_TO_SECS(time_in_msecs) (time_in_msecs / 1000) #define LWIP_MSECS_TO_SECS(time_in_msecs) (time_in_msecs / 1000)
struct ifconfig_option { struct ifconfig_option {
@ -2026,7 +2026,7 @@ DO_SELECT:
} }
/* Accessing ip header and icmp header */ /* Accessing ip header and icmp header */
iphdr_resp = (struct ip_hdr*)(pbuf_resp->payload); iphdr_resp = (struct ip_hdr *)(pbuf_resp->payload);
ip_hlen = (s16_t)(IPH_HL(iphdr_resp) * 4); ip_hlen = (s16_t)(IPH_HL(iphdr_resp) * 4);
if (pbuf_header(pbuf_resp, (s16_t)(-ip_hlen))) { if (pbuf_header(pbuf_resp, (s16_t)(-ip_hlen))) {
/* this failure will never happen, but failure handle is written just to be in safe side */ /* this failure will never happen, but failure handle is written just to be in safe side */
@ -2389,11 +2389,11 @@ LWIP_STATIC int create_ping6_socket(u8_t type, const void *param)
} }
/* /*
Function to parse the command line args for ping6 shell utility * Function to parse the command line args for ping6 shell utility
@return: * @return:
Success: ERR_OK * Success: ERR_OK
Failure: -1 * Failure: -1
*/ */
LWIP_STATIC int parse_args_ping6(int argc, const char **argv, ping6_args_t *ping6_params) LWIP_STATIC int parse_args_ping6(int argc, const char **argv, ping6_args_t *ping6_params)
{ {
int pingcount; int pingcount;
@ -3619,7 +3619,7 @@ u32_t osTcpserver(int argc, const char **argv)
return LOS_NOK; return LOS_NOK;
} }
reuse = 1; reuse = 1;
if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *) &reuse, sizeof(reuse)) != 0) { if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, (const char *)&reuse, sizeof(reuse)) != 0) {
(void)closesocket(sockfd); (void)closesocket(sockfd);
PRINTK("set SO_REUSEADDR failed\n"); PRINTK("set SO_REUSEADDR failed\n");
return LOS_NOK; return LOS_NOK;
@ -3630,7 +3630,7 @@ u32_t osTcpserver(int argc, const char **argv)
seraddr.sin_addr.s_addr = htonl(INADDR_ANY); seraddr.sin_addr.s_addr = htonl(INADDR_ANY);
seraddr.sin_port = htons(port); seraddr.sin_port = htons(port);
ret = bind(sockfd, (struct sockaddr*)&seraddr, sizeof(seraddr)); ret = bind(sockfd, (struct sockaddr *)&seraddr, sizeof(seraddr));
if (ret < 0) { if (ret < 0) {
PRINTK("bind ip and port failed"); PRINTK("bind ip and port failed");
(void)closesocket(sockfd); (void)closesocket(sockfd);
@ -3646,11 +3646,11 @@ u32_t osTcpserver(int argc, const char **argv)
while (1) { while (1) {
PRINTK("waiting for accept\n"); PRINTK("waiting for accept\n");
(void)memset_s(&cliaddr, sizeof(struct sockaddr_in), 0, sizeof(struct sockaddr_in)); (void)memset_s(&cliaddr, sizeof(struct sockaddr_in), 0, sizeof(struct sockaddr_in));
ret = (int)accept(sockfd, (struct sockaddr*)&cliaddr, &cliaddr_size); ret = (int)accept(sockfd, (struct sockaddr *)&cliaddr, &cliaddr_size);
if (ret < 0) { if (ret < 0) {
(void)closesocket(sockfd); (void)closesocket(sockfd);
PRINTK("Accept failed, %d\n", ret); PRINTK("Accept failed, %d\n", ret);
break ; break;
} }
tcp_access(ret); tcp_access(ret);
} }
@ -3683,7 +3683,7 @@ void udpserver(int argc, const char **argv)
/* Port 0 not supported , negative values not supported , max port limit is 65535 */ /* Port 0 not supported , negative values not supported , max port limit is 65535 */
if (iPortVal <= 0 || iPortVal > 65535) { if (iPortVal <= 0 || iPortVal > 65535) {
PRINTK("\nUsage: Invalid Port\n"); PRINTK("\nUsage: Invalid Port\n");
return ; return;
} }
port = (uint16_t)iPortVal; port = (uint16_t)iPortVal;
@ -3701,14 +3701,14 @@ void udpserver(int argc, const char **argv)
seraddr.sin_family = AF_INET; seraddr.sin_family = AF_INET;
seraddr.sin_addr.s_addr = htonl(INADDR_ANY); seraddr.sin_addr.s_addr = htonl(INADDR_ANY);
seraddr.sin_port = htons(port); seraddr.sin_port = htons(port);
ret = lwip_bind(sockfd, (struct sockaddr*)&seraddr, sizeof(seraddr)); ret = lwip_bind(sockfd, (struct sockaddr *)&seraddr, sizeof(seraddr));
if (ret < 0) { if (ret < 0) {
PRINTK("bind ip and port failed:%d\n", errno); PRINTK("bind ip and port failed:%d\n", errno);
(void)closesocket(sockfd); (void)closesocket(sockfd);
return; return;
} }
while(1) { while (1) {
ret = recvfrom(sockfd, msg, MAX_SIZE - 1, 0, (struct sockaddr *)&cliaddr, (socklen_t *)&fromlen); ret = recvfrom(sockfd, msg, MAX_SIZE - 1, 0, (struct sockaddr *)&cliaddr, (socklen_t *)&fromlen);
if (ret >= 0) { if (ret >= 0) {
n = strlen(msg); n = strlen(msg);