From 45dfc729fcd02214cefa82c8b2c7ae89976ff6e4 Mon Sep 17 00:00:00 2001 From: LinPeng Date: Mon, 20 Jan 2020 11:37:45 +0800 Subject: [PATCH] Update HAL_TCP_module.c 1.in function HAL_TCP_Connect, ' char port_str[PORT_BUFF_LEN]; memset(port_str, 0, PORT_BUFF_LEN);', we can direct to replace with 'char port_str[PORT_BUFF_LEN] = {0};' --- .../port/TencentOS_tiny/HAL_TCP_module.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/components/connectivity/qcloud-iot-hub-sdk-3.1.2/port/TencentOS_tiny/HAL_TCP_module.c b/components/connectivity/qcloud-iot-hub-sdk-3.1.2/port/TencentOS_tiny/HAL_TCP_module.c index 0ffb930d..d65208e1 100644 --- a/components/connectivity/qcloud-iot-hub-sdk-3.1.2/port/TencentOS_tiny/HAL_TCP_module.c +++ b/components/connectivity/qcloud-iot-hub-sdk-3.1.2/port/TencentOS_tiny/HAL_TCP_module.c @@ -43,9 +43,8 @@ static uint32_t _time_left(uint32_t t_end, uint32_t t_now) uintptr_t HAL_TCP_Connect(const char *host, uint16_t port) { int fd; - char port_str[PORT_BUFF_LEN]; - - memset(port_str, 0, PORT_BUFF_LEN); + char port_str[PORT_BUFF_LEN] = {0}; + snprintf(port_str, PORT_BUFF_LEN, "%u", port); Log_i("osal_tcp_connect entry, host=%s port=%d(%s)", host , port, port_str);