Fix code warning.

Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/test/libmbtk_audio/mbtk_pcm_play_test.c b/mbtk/test/libmbtk_audio/mbtk_pcm_play_test.c
index c11e06a..329d8e2 100755
--- a/mbtk/test/libmbtk_audio/mbtk_pcm_play_test.c
+++ b/mbtk/test/libmbtk_audio/mbtk_pcm_play_test.c
@@ -2,9 +2,13 @@
 #include <unistd.h>
 #include <stdio.h>
 #include <fcntl.h>
+#include <string.h>
+#include <stdlib.h>
 
 #include "audio_if_api.h"
 #include "mbtk_audio2.h"
+#include "mbtk_log.h"
+#include "mbtk_utils.h"
 
 #define BUFF_SIZE 4096
 
@@ -54,7 +58,7 @@
         return -1;
     }
 
-    read(fd, &riff_wave_header, sizeof(riff_wave_header));
+    mbtk_read(fd, &riff_wave_header, sizeof(riff_wave_header));
     if ((riff_wave_header.riff_id != ID_RIFF) || (riff_wave_header.wave_id != ID_WAVE)) {
         printf("Error: '%s' is not a riff/wave file\n", path);
         close(fd);
@@ -62,11 +66,11 @@
     }
 
     do {
-        read(fd, &chunk_header, sizeof(chunk_header));
+        mbtk_read(fd, &chunk_header, sizeof(chunk_header));
 
         switch (chunk_header.id) {
             case ID_FMT:
-                read(fd, &chunk_fmt, sizeof(chunk_fmt));
+                mbtk_read(fd, &chunk_fmt, sizeof(chunk_fmt));
                 /* If the format header is larger, skip the rest */
                 if (chunk_header.sz > sizeof(chunk_fmt))
                     lseek(fd, chunk_header.sz - sizeof(chunk_fmt), SEEK_CUR);
diff --git a/mbtk/test/libmbtk_audio/mbtk_pcm_recorder_test.c b/mbtk/test/libmbtk_audio/mbtk_pcm_recorder_test.c
index 748e599..5f7e03d 100755
--- a/mbtk/test/libmbtk_audio/mbtk_pcm_recorder_test.c
+++ b/mbtk/test/libmbtk_audio/mbtk_pcm_recorder_test.c
@@ -3,6 +3,8 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "mbtk_audio2.h"
 #include "mbtk_log.h"
@@ -53,7 +55,7 @@
     while(running)
     {
         memset(cmd, 0, 100);
-        int err;
+//        int err;
         printf("1 : Recorder    2 : Pause    3 : Resume    4 : Stop    Other : Exit\n");
         if(fgets(cmd, 100, stdin))
         {
@@ -102,7 +104,7 @@
         }
     }
 
-exit:
+//exit:
     if(mbtk_audio_pcm_deinit()) {
         printf("mbtk_audio_pcm_deinit() fail.\n");
         return -1;
diff --git a/mbtk/test/libmbtk_audio/mbtk_wav_play_test.c b/mbtk/test/libmbtk_audio/mbtk_wav_play_test.c
index b5108f4..c3167b8 100755
--- a/mbtk/test/libmbtk_audio/mbtk_wav_play_test.c
+++ b/mbtk/test/libmbtk_audio/mbtk_wav_play_test.c
@@ -3,9 +3,12 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "mbtk_audio2.h"
 #include "mbtk_audio_ubus.h"
+#include "mbtk_log.h"
 
 static void sig_handler(int sig)
 {
@@ -41,12 +44,12 @@
     signal(SIGTERM, sig_handler);
 
     char cmd[100];
-    int dsp=0;
+//    int dsp=0;
     bool running = TRUE;
     while(running)
     {
         memset(cmd, 0, 100);
-        int err;
+//        int err;
         printf("1 : Play    2 : Pause    3 : Resume   4 : dsp set  5 : Stop    Other : Exit\n");
         if(fgets(cmd, 100, stdin))
         {
@@ -104,7 +107,7 @@
         }
     }
 
-exit:
+//exit:
     if(mbtk_audio_wav_deinit()) {
         printf("mbtk_audio_wav_deinit() fail.\n");
         return -1;
diff --git a/mbtk/test/libmbtk_audio/mbtk_wav_recorder_test.c b/mbtk/test/libmbtk_audio/mbtk_wav_recorder_test.c
index 2f9a1a2..0ad1ddf 100755
--- a/mbtk/test/libmbtk_audio/mbtk_wav_recorder_test.c
+++ b/mbtk/test/libmbtk_audio/mbtk_wav_recorder_test.c
@@ -3,8 +3,11 @@
 #include <stdio.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <stdlib.h>
+#include <string.h>
 
 #include "mbtk_audio2.h"
+#include "mbtk_log.h"
 
 static void sig_handler(int sig)
 {
@@ -44,7 +47,6 @@
     while(running)
     {
         memset(cmd, 0, 100);
-        int err;
         printf("1 : Recorder    2 : Pause    3 : Resume    4 : Stop    Other : Exit\n");
         if(fgets(cmd, 100, stdin))
         {
@@ -93,7 +95,7 @@
         }
     }
 
-exit:
+//exit:
     if(mbtk_audio_wav_deinit()) {
         printf("mbtk_audio_wav_deinit() fail.\n");
         return -1;
diff --git a/mbtk/test/libmbtk_coap/mbtk_coap_test.c b/mbtk/test/libmbtk_coap/mbtk_coap_test.c
index b211913..1d8e9ad 100755
--- a/mbtk/test/libmbtk_coap/mbtk_coap_test.c
+++ b/mbtk/test/libmbtk_coap/mbtk_coap_test.c
@@ -1,4 +1,6 @@
 #include <string.h>
+#include <unistd.h>
+
 #include "mbtk_type.h"
 #include "mbtk_coap.h"
 #include "mbtk_coap_api.h"
@@ -10,9 +12,9 @@
 
 int main(int argc, char *argv[])
 {
-    char operator[10];
-    int opt;
-    int    ret     = -1;
+    //char operator[10];
+  //  int opt;
+//    int    ret     = -1;
 
 	printf("coap_demo star\r\n");
 	coap_get_method();
@@ -26,8 +28,8 @@
 
 int coap_get_method(void)
 {
-	int ret = -1;
-	ret = mbtk_coap_ecoapnew_exec_cmd("134.102.218.18",5683,0,0);    //server ip, port
+//	int ret = -1;
+	mbtk_coap_ecoapnew_exec_cmd("134.102.218.18",5683,0,0);    //server ip, port
 	mbtk_coap_ecoapmsgid_exec_cmd(1);								//set message id
 	mbtk_coap_ecoaptype_exec_cmd(0);								//set message type
 	mbtk_coap_ecoapcode_exec_cmd(1);								//set Get request method
@@ -40,8 +42,8 @@
 
 int coap_post_method(void)
 {
-	int ret = -1;
-	ret = mbtk_coap_ecoapnew_exec_cmd("134.102.218.18",5683,0,0);     //server ip, port
+//	int ret = -1;
+	mbtk_coap_ecoapnew_exec_cmd("134.102.218.18",5683,0,0);     //server ip, port
 	mbtk_coap_ecoapmsgid_exec_cmd(3);            					//set message id
 	mbtk_coap_ecoaptype_exec_cmd(0);             					//set message type
 	mbtk_coap_ecoapcode_exec_cmd(2);			 					//set Post request method
diff --git a/mbtk/test/libmbtk_ecall/mbtk_ecall_test_v1.c b/mbtk/test/libmbtk_ecall/mbtk_ecall_test_v1.c
index a1b8f01..bec5b32 100755
--- a/mbtk/test/libmbtk_ecall/mbtk_ecall_test_v1.c
+++ b/mbtk/test/libmbtk_ecall/mbtk_ecall_test_v1.c
@@ -131,7 +131,7 @@
                 memset(&cfg, 0, sizeof(mbtk_ecall_msd_cfg_info_t));
                 int item;
                 int count = sscanf(cmd, "msdcfg %d %s", &item, cfg.data);
-                if(count == 2 && strlen(cfg.data) > 0) {
+                if(count == 2 && strlen((char*)cfg.data) > 0) {
                     cfg.item_type = (mbtk_ecall_msd_item_enum)item;
                     err = mbtk_ecall_msd_item_set(info_handle, &cfg);
                     if(err) {
@@ -166,7 +166,7 @@
                     }
                 } else { // Set
                     int count = sscanf(cmd, "msd %s", msd);
-                    if(count == 1 && strlen(msd) > 0) { // set
+                    if(count == 1 && strlen((char*)msd) > 0) { // set
                         err = mbtk_ecall_msd_set(info_handle, msd);
                         if(err) {
                             printf("Error : %d\n", err);
@@ -394,7 +394,7 @@
                     }
                 } else { // Set
                     int count = sscanf(cmd, "sms_num %s", number);
-                    if(count == 1 && strlen(number) > 0) {
+                    if(count == 1 && strlen((char*)number) > 0) {
                         err = mbtk_ecall_sms_number_set(info_handle, number);
                         if(err) {
                             printf("Error : %d\n", err);
@@ -445,7 +445,7 @@
         }
     }
 
-exit:
+//exit:
     mbtk_info_handle_free(&info_handle);
 
     LOG("Client exec complete.");
diff --git a/mbtk/test/libmbtk_ftp/mbtk_ftp_test.c b/mbtk/test/libmbtk_ftp/mbtk_ftp_test.c
index 481108d..ce69cde 100755
--- a/mbtk/test/libmbtk_ftp/mbtk_ftp_test.c
+++ b/mbtk/test/libmbtk_ftp/mbtk_ftp_test.c
@@ -122,18 +122,19 @@
     char cmd[50];
     while(1) {
         memset(cmd, 0, 50);
-        gets(cmd);
-        if(!strcasecmp(cmd, "q")) {
-            break;
-        } else {
-            ftp_cmd_process(handle, cmd);
+        if(fgets(cmd, sizeof(cmd), stdin) != NULL) {
+            if(!strcasecmp(cmd, "q")) {
+                break;
+            } else {
+                ftp_cmd_process(handle, cmd);
+            }
         }
 
         printf("CMD:");
     }
 
     printf("FTP test success.\n");
-ftp_quit:
+//ftp_quit:
     mbtk_ftp_quit(handle);
 ftp_exit:
     mbtk_ftp_deinit(handle);
diff --git a/mbtk/test/libmbtk_gnss/mbtk_gnss_test.c b/mbtk/test/libmbtk_gnss/mbtk_gnss_test.c
index e710fa2..e74ad1f 100755
--- a/mbtk/test/libmbtk_gnss/mbtk_gnss_test.c
+++ b/mbtk/test/libmbtk_gnss/mbtk_gnss_test.c
Binary files differ
diff --git a/mbtk/test/libmbtk_lib/mbtk_timer_test.c b/mbtk/test/libmbtk_lib/mbtk_timer_test.c
index 7b24ef2..f903b26 100755
--- a/mbtk/test/libmbtk_lib/mbtk_timer_test.c
+++ b/mbtk/test/libmbtk_lib/mbtk_timer_test.c
@@ -2,6 +2,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
 
 #include "mbtk_utils.h"
 #include "mbtk_log.h"
@@ -14,7 +16,7 @@
 {
     char *str = "----------------------Timeout---------------------------\n";
     if(fd > 0) {
-        write(fd, str, strlen(str));
+        mbtk_write(fd, str, strlen(str));
     }
 
     printf("%s", str);
diff --git a/mbtk/test/libmbtk_mqtt/mbtk_mqtt_aliyun_test.c b/mbtk/test/libmbtk_mqtt/mbtk_mqtt_aliyun_test.c
index 923b123..fc6820e 100755
--- a/mbtk/test/libmbtk_mqtt/mbtk_mqtt_aliyun_test.c
+++ b/mbtk/test/libmbtk_mqtt/mbtk_mqtt_aliyun_test.c
@@ -18,6 +18,8 @@
 */
 
 int aliyun_xiyinyimi_connect(mbtk_mqtt_device_session_t *device, regnwl_info_t *regn);
+void iot_yield(Cloud_MQTT_t *piot_mqtt,iot_device_info_t *gateway);
+
 
 struct opts_struct opts = {
     (char *)"iot-dev", 0, (char *)"\n", QOS0, "admin", "password", (char *)"localhost", 1883, 0
@@ -40,7 +42,7 @@
     return miot_mqtt;
 }
 
-void mqtt_data_rx_cb(void *pbuf, int len) 
+void mqtt_data_rx_cb(void *pbuf, int len)
 {
 
     printf("data = %s\n", (unsigned char *)pbuf);	//打印接收到的数据
@@ -49,7 +51,7 @@
 
 void MQTTMessageArrived_Cb(MessageData* md)
 {
-    MQTTMessage *message = md->message; 
+    MQTTMessage *message = md->message;
 
     Cloud_MQTT_t *piot_mqtt = get_mqtt_t();
 
@@ -63,7 +65,7 @@
 {
     while (gateway.iotstatus != IOT_STATUS_DROP){
         printf("gateway.iotstatus is %d\n",gateway.iotstatus);
-        iot_yield(arg,&gateway);									//维持服务器稳定,断开重连
+        iot_yield((Cloud_MQTT_t*)arg,&gateway);									//维持服务器稳定,断开重连
     }
     printf("gateway.iotstatus is IOT_STATUS_DROP");
 //    mqtt_device_disconnect(arg);
@@ -78,9 +80,9 @@
 {
 
     printf("aliyun mqtt start2\n");
-    int ret, len; 
+//  int ret, len;
     char will_msg[256] = {"hello world"};						//初始化遗嘱数据
-    static int i = 0;
+//  static int i = 0;
 
     mbtk_mqtt_device_session_t mbtk_mqtt_device = {0};
     memcpy(mbtk_mqtt_device.device_name, argv[1] , strlen(argv[1]));
@@ -98,8 +100,8 @@
     mbtk_aliyun_mqtt_one_type_one_secret_unregin_set_info_init(Iot_mqtt, &mbtk_mqtt_device,60*1000,4,mqtt_data_rx_cb);
 
     mqtt_will_msg_set(Iot_mqtt, will_msg, strlen(will_msg));	//设置遗嘱
-    set_mqtt_t(Iot_mqtt);   
-    ret = mbtk_aliyun_mqtt_one_type_one_secret_unregin_device_connect(Iot_mqtt);						//初始化并连接mqtt服务器
+    set_mqtt_t(Iot_mqtt);
+    mbtk_aliyun_mqtt_one_type_one_secret_unregin_device_connect(Iot_mqtt);						//初始化并连接mqtt服务器
 
     printf("connect success\n");
     int rc = mbtk_MQTTSubscribe(&Iot_mqtt->Client, Iot_mqtt->sub_topic, opts.qos, MQTTMessageArrived_Cb);
@@ -124,7 +126,7 @@
 int aliyun_xiyinyimi_connect(mbtk_mqtt_device_session_t *device, regnwl_info_t *regn)
 {
 
-    int ret, len; 
+    int ret;
     char will_msg[256] = {"hello world"};						//初始化遗嘱数据
     static int retry_count = 0;
     pthread_t thread_ID;      //定义线程id
@@ -133,17 +135,17 @@
     Cloud_MQTT_t *Iot_mqtt;
     Iot_mqtt = (Cloud_MQTT_t *)malloc(sizeof(Cloud_MQTT_t));
     memset(Iot_mqtt,0x0,sizeof(Cloud_MQTT_t));
-    
 
-    iot_aliyun_mqtt_one_type_one_secret_unregin_connect_init(Iot_mqtt,device, regn->clientId, regn->deviceToken, 30,3,"aaa","aaa",mqtt_data_rx_cb);	
 
-//    iot_mqtt_init(Iot_mqtt,host,port, client, user, pass,30,3,"aaa","aaa",mqtt_data_rx_cb);	
+    iot_aliyun_mqtt_one_type_one_secret_unregin_connect_init(Iot_mqtt,device, regn->clientId, regn->deviceToken, 30,3,"aaa","aaa",mqtt_data_rx_cb);
+
+//    iot_mqtt_init(Iot_mqtt,host,port, client, user, pass,30,3,"aaa","aaa",mqtt_data_rx_cb);
 
     mqtt_will_msg_set(Iot_mqtt, will_msg, strlen(will_msg));	//设置遗嘱
 
-    set_mqtt_t(Iot_mqtt);    
+    set_mqtt_t(Iot_mqtt);
     ret = mqtt_device_connect(Iot_mqtt);						//初始化并连接mqtt服务器
-    
+
 
     while (ret < 0 && retry_count <= 5) {
         printf("ret = %d\r\n", ret);
@@ -155,7 +157,7 @@
     if(ret < 0 && retry_count > 5)
     {
         printf("reconnect times more than 5 exit\n");
-        return NULL;
+        return -1;
     }
     retry_count = 0;
 
@@ -167,7 +169,7 @@
         return 0;
     }
     gateway.iotstatus = IOT_STATUS_CONNECT;
-    
+
     pthread_create(&thread_ID, NULL, &mqtt_thread, (void *)Iot_mqtt);	//创建一个线程执行mqtt客户端
     pthread_detach(thread_ID);	//设置线程结束收尸
 
diff --git a/mbtk/test/libmbtk_mqtt/mbtk_mqtt_test.c b/mbtk/test/libmbtk_mqtt/mbtk_mqtt_test.c
index 5d99258..684878f 100755
--- a/mbtk/test/libmbtk_mqtt/mbtk_mqtt_test.c
+++ b/mbtk/test/libmbtk_mqtt/mbtk_mqtt_test.c
@@ -11,6 +11,7 @@
 #include "fcntl.h"
 #include "mbtk_sock2.h"
 
+void iot_yield(Cloud_MQTT_t *piot_mqtt,iot_device_info_t *gateway);
 
 struct opts_struct opts = {
     (char *)"iot-dev", 0, (char *)"\n", QOS0, "admin", "password", (char *)"localhost", 1883, 0
@@ -70,7 +71,7 @@
         printf("input error.\n example:./mqtt_test 192.168.1.1 8080 clientid username password\n");
         return 0;
     }
-    int ret, len;
+    int ret ;
     char will_msg[256] = {"hello world"};						//初始化遗嘱数据
     static int retry_count = 0;
     pthread_t thread_ID;      //定义线程id
@@ -96,7 +97,7 @@
     if(ret < 0 && retry_count > 5)
     {
         printf("reconnect times more than 5 exit\n");
-        return NULL;
+        return -1;
     }
     retry_count = 0;
 
diff --git a/mbtk/test/libmbtk_ril/mbtk_info_test.c b/mbtk/test/libmbtk_ril/mbtk_info_test.c
index 116fd4f..5f6135c 100755
--- a/mbtk/test/libmbtk_ril/mbtk_info_test.c
+++ b/mbtk/test/libmbtk_ril/mbtk_info_test.c
@@ -108,7 +108,7 @@
 	uint8 *ptr = (uint8*)data;
 		printf("3sms_state_change_cb() : %s\n", ptr);
 
-	struct SMS_Struct s = PDUDecoding(ptr);
+	struct SMS_Struct s = PDUDecoding((char*)ptr);
 	printf("服务中心地址: %s\n", s.SCA);
     printf("发送方地址: %s\n", s.OA);
     printf("服务中心时间戳: %s\n", s.SCTS);
@@ -134,9 +134,10 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 
+#if 0
 static void test2(int is_ipv6, char *ip)
 {
-    char ipaddr[20] = {0};
+//    char ipaddr[20] = {0};
 	if(is_ipv6) {
         struct in6_addr sin_addr;
         if(inet_pton(AF_INET6, ip, &sin_addr) < 0) {
@@ -153,6 +154,7 @@
         }
 	}
 }
+#endif
 
 
 static void help()
@@ -414,7 +416,7 @@
 				{
                     printf("ptr == NULL\n");
                     list_node_t* cell_list = NULL;
-                    int type;
+                    mbtk_cell_type_enum type;
                     err = mbtk_cell_get(info_handle, &type, &cell_list);
                     if(err || cell_list == NULL) {
                         printf("Error : %d\n", err);
@@ -619,7 +621,7 @@
                     printf("Call success.\n");
                 }
             } else if(!strncasecmp(cmd, "hangup", 6)){
-                int phone_id;
+                int phone_id = 1;
                 if(!strcasecmp(cmd, "hangup")) { // hang up all
                     err = mbtk_call_hang(info_handle);
                     if(err) {
@@ -821,7 +823,7 @@
                         printf("APN Num:%d\n", apn_num);
                         int i = 0;
                         while(i < apn_num) {
-                            printf("APN : %d, %s, %s\n", apns[i].cid, apn2str(apns[i].ip_type), apns[i].apn);
+                            printf("APN : %d, %d, %s\n", apns[i].cid, apns[i].ip_type, apns[i].apn);
                             i++;
                         }
                     }
@@ -1000,7 +1002,7 @@
 				char mem[100] = {0};
                 char resp[100] = {0};
                 if(!strcasecmp(cmd, "cpms")) { // Get
-                    err = mbtk_sms_cpms_get(info_handle, &mem);
+                    err = mbtk_sms_cpms_get(info_handle, mem);
                     if(err) {
                         printf("Error : %d\n", err);
                     } else {
@@ -1317,7 +1319,7 @@
 #if 1
     while(1)
     {
-        sleep(1000 * 365 * 24 * 60 * 60);
+        sleep(365 * 24 * 60 * 60);
     }
 #else
     sleep(1);
diff --git a/mbtk/test/libmbtk_tcpip/mbtk_tcpip_test.c b/mbtk/test/libmbtk_tcpip/mbtk_tcpip_test.c
index d30d706..8a7d279 100755
--- a/mbtk/test/libmbtk_tcpip/mbtk_tcpip_test.c
+++ b/mbtk/test/libmbtk_tcpip/mbtk_tcpip_test.c
@@ -177,11 +177,15 @@
                 char type[10] = {0};
                 int read_cb_set;
                 memset(&info, 0x0, sizeof(mbtk_tcpip_info_t));
+                int ack_support,ssl_support,ignore_cert;
                 int count = sscanf(cmd, "link_open %d %s %d %d %s %s %d %d %d %d %d %d", &(info.link_id),
                                 info.ser_addr, &(info.ser_port), &(info.local_port), prot_type, type,
-                                &(info.ack_support), &(info.ssl_support), &(info.ignore_cert), &(info.heartbeat_time),
+                                &ack_support, &ssl_support, &ignore_cert, &(info.heartbeat_time),
                                 &(info.delay_time), &read_cb_set);
                 if(count == 12) {
+                    info.ack_support = (bool)ack_support;
+                    info.ssl_support = (bool)ssl_support;
+                    info.ignore_cert = (bool)ignore_cert;
                     if(!strncasecmp(prot_type, "UDP", 3)) {
                         info.prot_type = MBTK_SOCK_UDP;
                     } else {
@@ -327,7 +331,7 @@
 #if 1
     while(1)
     {
-        sleep(1000 * 365 * 24 * 60 * 60);
+        sleep(365 * 24 * 60 * 60);
     }
 #else
     sleep(1);
diff --git a/mbtk/test/libmbtk_tcpip/tcp_test.c b/mbtk/test/libmbtk_tcpip/tcp_test.c
index 51daace..550514b 100755
--- a/mbtk/test/libmbtk_tcpip/tcp_test.c
+++ b/mbtk/test/libmbtk_tcpip/tcp_test.c
@@ -14,6 +14,7 @@
 #include "mbtk_tcpip.h"
 #include "mbtk_log.h"
 
+#if 0
 
 static void help()
 {
@@ -86,7 +87,7 @@
         }
     }
 }
-
+#endif
 void tcpip_print_tcp_info(mbtk_tcpip_tcp_state_info_s *info)
 {
     printf("Link - %d\n", info->link_id);
@@ -116,17 +117,17 @@
 
     printf(">>>>>>>>>>>START TCP TEST>>>>>>>>>>>>>\r\n");
     mbtk_tcpip_err_enum err;
-        
+
     mbtk_tcpip_info_t info;
     memset(&info, 0x0, sizeof(mbtk_tcpip_info_t));
     char *ip = "www.chaixiongfeng.group";
-    strcpy(&info.ser_addr,ip);
+    strcpy(info.ser_addr,ip);
     info.link_id=1;
     info.ser_port =45002;
     info.prot_type = MBTK_SOCK_TCP;
     info.tcpip_type = MBTK_TCPIP_TYPE_CLIENT;
     info.read_cb = NULL;
-        
+
 
     err = mbtk_tcpip_sock_open((const mbtk_tcpip_info_t*)(&info));
     if(err == MBTK_TCPIP_ERR_SUCCESS) {
@@ -135,42 +136,42 @@
         printf("Link open fail:%d\n", err);
         return 0;
     }
-    
+
     while(1)
     {
         char *data="stargcharge connect\r\n";
         int len = mbtk_tcpip_send(1, data, strlen(data), NULL, 0);
-        if(len == strlen(data)) 
+        if(len == strlen(data))
         {
             printf("Send success:%d.\n", len);
-        } 
-        else 
+        }
+        else
         {
             printf("Send fail:%d/%d\n", len, strlen(data));
         }
 
         char buff[128];
         len = mbtk_tcpip_read(1, buff, 128);
-        if(len > 0) 
+        if(len > 0)
         {
             printf("RECV[%d]:%s\n", len, buff);
         }
-        else 
+        else
         {
             printf("RECV fail:%d\n", len);
         }
 
         err = mbtk_tcpip_sock_close(1);
-        if(err == MBTK_TCPIP_ERR_SUCCESS) 
+        if(err == MBTK_TCPIP_ERR_SUCCESS)
         {
             printf("Link close success.\n");
-        } 
-        else 
+        }
+        else
         {
             printf("Link close fail:%d\n", err);
         }
         sleep(5);
-    }      
+    }
 }
 
 
diff --git a/mbtk/test/libmbtk_wifi/mbtk_wifi_test.c b/mbtk/test/libmbtk_wifi/mbtk_wifi_test.c
old mode 100644
new mode 100755
index 1842b2a..bc5a5a7
--- a/mbtk/test/libmbtk_wifi/mbtk_wifi_test.c
+++ b/mbtk/test/libmbtk_wifi/mbtk_wifi_test.c
@@ -2,8 +2,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
-
+#include "mbtk_utils.h"
 #define STA_BUF_SIZE 2048
 
 
@@ -71,10 +72,10 @@
         printf("Parse cmd fail.\n");
     }
 
-    system("udhcpc -i wlan0");
+    mbtk_system("udhcpc -i wlan0");
 
-    
-    
+
+
     return 0;
 }
 
diff --git a/mbtk/test/others/framebuffer_demo.c b/mbtk/test/others/framebuffer_demo.c
index 281e9ab..bc35a07 100755
--- a/mbtk/test/others/framebuffer_demo.c
+++ b/mbtk/test/others/framebuffer_demo.c
@@ -10,6 +10,8 @@
 #include <sys/mman.h>
 #include <math.h>
 
+#include "mbtk_utils.h"
+
 /**< \brief 根据实际情况修改,此处为unsigned short是565的屏,根据程序打印出的
     bits_per_pixel的值可以判断出输出格式是565还是888 */
 // typedef unsigned int color_t;
@@ -122,8 +124,8 @@
         return;
     }
 
-    read(fd , &filehead , sizeof(filehead));
-    read(fd , &infohead , sizeof(infohead));
+    mbtk_read(fd , &filehead , sizeof(filehead));
+    mbtk_read(fd , &infohead , sizeof(infohead));
     printf("bfType: 0x%x, bfSize: %d, bfOffBits: 0x%x\n", filehead.bfType, filehead.bfSize, filehead.bfOffBits);
 
     printf("biSize: %d, biWidth: %d, biHeight: %d\n", infohead.biSize, infohead.biWidth, infohead.biHeight);
@@ -155,11 +157,11 @@
     }
 
     printf("biSizeImage:%d, width_error: %d\n", infohead.biSizeImage, width_error);
-    read(fd , p_data , infohead.biSizeImage);
+    mbtk_read(fd , p_data , infohead.biSizeImage);
     p = p_data;
 
     int ret;
-    char data[24] = {0};
+    char data[100] = {0};
     int debug_fd = open("/data/debug_fb", O_RDWR|O_CREAT|O_TRUNC, 0644);
     if (debug_fd < 0) {
         printf("debug_fb open error\n");
@@ -168,7 +170,7 @@
     printf("height:%d, width:%d\n", infohead.biHeight, infohead.biWidth);
     for(j = infohead.biHeight - 1; j >= 0; j--) {
         for(i = 0; i < infohead.biWidth; i++) {
-            c = transform_func(p);
+            c = transform_func((char*)p);
             // c = *p;
             p += pixel_byte;
             // c = ((c >> 8) & 0x00ff) | ((c & 0x00ff) << 8);
diff --git a/mbtk/test/others/key_ev_demo.c b/mbtk/test/others/key_ev_demo.c
index 190e4a6..728b5d0 100755
--- a/mbtk/test/others/key_ev_demo.c
+++ b/mbtk/test/others/key_ev_demo.c
@@ -76,6 +76,7 @@
     return 0;
 }
 
+#if 0
 static void ev_exit(void)
 {
     while (ev_count > 0)
@@ -83,6 +84,7 @@
         close(ev_fds[--ev_count].fd);
     }
 }
+#endif
 
 /* wait: 0 dont wait; -1 wait forever; >0 wait ms */
 static int ev_get(struct input_event *ev, int wait_ms)
diff --git a/mbtk/test/others/mbtk_debug_test.c b/mbtk/test/others/mbtk_debug_test.c
index 3057abf..39c8105 100755
--- a/mbtk/test/others/mbtk_debug_test.c
+++ b/mbtk/test/others/mbtk_debug_test.c
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <pthread.h>
 
 #include "mbtk_log.h"
 #include "mbtk_utils.h"
@@ -7,7 +8,7 @@
 void test3()
 {
     printf("%s start\n", __FUNCTION__);
-    char *ptr = 10;
+    char *ptr = (char*)10;
     *ptr = 'a';
     printf("%s end\n", __FUNCTION__);
 }
diff --git a/mbtk/test/others/mbtk_gnss_cli.c b/mbtk/test/others/mbtk_gnss_cli.c
index 8699a39..825d501 100755
--- a/mbtk/test/others/mbtk_gnss_cli.c
+++ b/mbtk/test/others/mbtk_gnss_cli.c
@@ -27,6 +27,7 @@
 #include "mbtk_log.h"
 #include "mbtk_type.h"
 #include "mbtk_gnss.h"
+#include "mbtk_utils.h"
 
 #define GNSS_SOCK_PATH "/tmp/mbtk_gnss_sock"
 
@@ -81,15 +82,15 @@
     } else if(cmd == GNSS_CMD_DEINIT) {
         sprintf(buff, "gnss_deinit");
     } else if(cmd == GNSS_CMD_SETTING) {
-        sprintf(buff, "gnss_setting:%s", arg);
+        sprintf(buff, "gnss_setting:%s", (char*)arg);
     } else if(cmd == GNSS_CMD_DL) {
-        sprintf(buff, "gnss_dl:%s", arg);
+        sprintf(buff, "gnss_dl:%s", (char*)arg);
     } else {
         printf("Unknown cmd.\n");
         return -1;
     }
 
-    write(sock_listen_fd, buff, strlen(buff));
+    mbtk_write(sock_listen_fd, buff, strlen(buff));
 
     int len = 0;
     char *rsp = NULL;
diff --git a/mbtk/test/others/partition_write_demo.c b/mbtk/test/others/partition_write_demo.c
index 1256d75..5edfa2d 100755
--- a/mbtk/test/others/partition_write_demo.c
+++ b/mbtk/test/others/partition_write_demo.c
@@ -3,6 +3,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 int main(int argc, char *argv[])
 {
@@ -20,11 +21,11 @@
 
     while((len = write(fd, buffer, sizeof(buffer))) > 0){
         count += len;
-        printf("write : %d\n", count);
+        printf("write : %ld\n", count);
         //usleep(1000);
     }
 
-    printf("Write complete,len = %d, errno = %d\n", len, errno);
+    printf("Write complete,len = %ld, errno = %d\n", len, errno);
 
     close(fd);
 #else
diff --git a/mbtk/test/others/proc_demo.c b/mbtk/test/others/proc_demo.c
index 7712b4c..929984c 100755
--- a/mbtk/test/others/proc_demo.c
+++ b/mbtk/test/others/proc_demo.c
@@ -11,7 +11,7 @@
 
 void test(int c)
 {
-    int d = 10;
+//    int d = 10;
     //printf("函数参数:test_c = %p, 局部变量:d = %p\n", &c, &d);
 }
 
diff --git a/mbtk/test/others/touch_ev_demo.c b/mbtk/test/others/touch_ev_demo.c
index b7ae90d..133384b 100755
--- a/mbtk/test/others/touch_ev_demo.c
+++ b/mbtk/test/others/touch_ev_demo.c
@@ -20,6 +20,8 @@
 #include <dirent.h>
 #include <stdbool.h>
 
+// #include "mbtk_log.h"
+
 #ifndef TRUE
 #define TRUE   1   /* Boolean true value. */
 #endif
@@ -234,7 +236,7 @@
 void ev_dispatch(void)
 {
     unsigned n;
-    int ret;
+//    int ret;
 
     for (n = 0; n < ev_count; n++) {
         ev_callback cb = ev_fdinfo[n].cb;
@@ -356,7 +358,7 @@
 
 int main(int argc, char *argv[])
 {
-    mbtk_log_init(NULL, "MBTK_EVENT");
+    // mbtk_log_init(NULL, "MBTK_EVENT");
 
     if(ev_init(NULL)) {
         LOGE("ev_init() fail.");
diff --git a/mbtk/test/others/usb_check.c b/mbtk/test/others/usb_check.c
index 9aa5ebf..7a8fc43 100755
--- a/mbtk/test/others/usb_check.c
+++ b/mbtk/test/others/usb_check.c
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <signal.h>
 #include <fcntl.h>
+#include <string.h>
 
 #include "mbtk_utils.h"
 
@@ -26,8 +27,8 @@
         while(running){
             memset(buff, 0, 1024);
             if(mbtk_cmd_line("cat /sys/class/android_usb/android0/state", buff, 1024)) {
-                write(fd, buff, strlen(buff));
-                write(fd, "\n", 1);
+                mbtk_write(fd, buff, strlen(buff));
+                mbtk_write(fd, "\n", 1);
             }
             sleep(1);
         }