diff --git a/mbtk/libmbtk_lib/ril/mbtk_info.c b/mbtk/libmbtk_lib/ril/mbtk_info.c
index 58358ca..78e289e 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info.c
+++ b/mbtk/libmbtk_lib/ril/mbtk_info.c
@@ -9,7 +9,7 @@
 #include "mbtk_list.h"
 #include "mbtk_utils.h"
 
-static int sock_read(int fd, uint8 *msg, int data_len)
+static int sock_read(int fd, void *msg, int data_len)
 {
     memset(msg, 0, data_len);
     int len = 0;
@@ -51,7 +51,7 @@
     }
 }
 
-static int sock_write(int fd, uint8 *msg, int data_len)
+static int sock_write(int fd, void *msg, int data_len)
 {
     int len = 0;
     int write_len = 0;
@@ -155,12 +155,12 @@
 */
 int str_2_ipv6(const void *ip_str, void *ipv6)
 {
-    const uint8 *ptr = (const uint8*)ip_str;
+    const char *ptr = (const char*)ip_str;
     uint8 *ipv6_ptr = (uint8*)ipv6;
     ipv6_ptr[0] = (uint8)atoi(ptr);
     int i = 1;
     while(i < 16) {
-        ptr = (const uint8*)strstr(ptr, ".");
+        ptr = strstr(ptr, ".");
         if(ptr == NULL)
             return -1;
         ptr++;
@@ -181,8 +181,8 @@
     int i = 0;
     int index = 0;
     while(i < 16) {
-        index += sprintf(ipv6_ptr + index, "%02x%02x", ptr[i], ptr[i + 1]);
-        index += sprintf(ipv6_ptr + index, ":");
+        index += sprintf((char*)ipv6_ptr + index, "%02x%02x", ptr[i], ptr[i + 1]);
+        index += sprintf((char*)ipv6_ptr + index, ":");
         i += 2;
     }
 
diff --git a/mbtk/libmbtk_lib/ril/mbtk_info.h b/mbtk/libmbtk_lib/ril/mbtk_info.h
index 462e2b9..c52e916 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info.h
+++ b/mbtk/libmbtk_lib/ril/mbtk_info.h
@@ -465,7 +465,7 @@
 {
     uint16 info_id;
     uint16 info_err;
-    const uint8 *data;
+    uint8 *data;
     uint16 data_len;
 } mbtk_info_pack_t;
 
diff --git a/mbtk/libmbtk_lib/ril/mbtk_info_api.c b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
index b5fc96d..9fca322 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_info_api.c
+++ b/mbtk/libmbtk_lib/ril/mbtk_info_api.c
@@ -14,7 +14,7 @@
 #include "mbtk_info.h"
 #include "mbtk_list.h"
 #include "mbtk_utils.h"
-
+#include "mbtk_str.h"
 #include "time.h"
 
 
@@ -411,7 +411,7 @@
         // log_hex("data", send_buff, send_buff_len);
         // mbtk_info_pack_data_set(pack, data, data_len);
         pack->data_len = (uint16)send_buff_len;
-        pack->data = (const uint8*)send_buff;
+        pack->data = (uint8*)send_buff;
     }
 
     pthread_mutex_lock(&handle->send_mutex);
@@ -546,7 +546,7 @@
     {
         if(handle->exit_fd[1] > 0)
         {
-            write(handle->exit_fd[1], "EXIT", 4);
+            mbtk_write(handle->exit_fd[1], "EXIT", 4);
         }
         pthread_join(handle->read_thread_id,NULL);
         LOG("mbtk_info_handle_get() server not ready.");
@@ -587,7 +587,7 @@
     }
 
     if((*handle)->exit_fd[1] > 0) {
-        write((*handle)->exit_fd[1], "EXIT", 4);
+        mbtk_write((*handle)->exit_fd[1], "EXIT", 4);
     }
 
     // Wait read_thread exit.
@@ -1766,7 +1766,7 @@
 */
 int mbtk_net_time_get(mbtk_info_handle_t* handle, char* time_str)
 {
-    uint8 buff[SOCK_MSG_LEN_MAX] = {0};
+    char buff[SOCK_MSG_LEN_MAX] = {0};
     if(handle == NULL || time_str == NULL)
     {
         LOGE("ARG error.");
@@ -1776,7 +1776,7 @@
     if(info_item_process(handle, MBTK_INFO_ID_DEV_CELL_TIME_REQ, NULL, 0, buff) > 0) {
         memcpy(time_str,buff,strlen(buff));
 
-        uint8 *temp = strstr(time_str, ",");
+        char *temp = strstr(time_str, ",");
         if(temp) {
             *temp = ' '; // ',' -> ' '
 
@@ -1787,7 +1787,7 @@
 
             if(temp) {
                 // Copy +XX or -XX
-                uint8 *last_ptr = temp + strlen(temp) + 1;
+                char *last_ptr = temp + strlen(temp) + 1;
                 while(last_ptr > temp) {
                     *last_ptr = *(last_ptr - 1);
                     last_ptr--;
@@ -2222,7 +2222,7 @@
     //  /sys/devices/virtual/usim_event/usim0/send_event
     char cmd[100] = {0};
     sprintf(cmd, "echo %d > /sys/devices/virtual/usim_event/usim0/send_event", power ? 0 : 1);
-    system(cmd);
+    mbtk_system(cmd);
 
     return 0;
 }
@@ -2243,15 +2243,15 @@
 
     switch(type) {
         case 0: {
-            system("reboot");
+            mbtk_system("reboot");
             break;
         }
         case 1: {
-            system("poweroff");
+            mbtk_system("poweroff");
             break;
         }
         case 2: {
-            system("halt");
+            mbtk_system("halt");
             break;
         }
         default: {
diff --git a/mbtk/libmbtk_lib/ril/mbtk_pdu_sms.c b/mbtk/libmbtk_lib/ril/mbtk_pdu_sms.c
index 05da8a8..c00a924 100755
--- a/mbtk/libmbtk_lib/ril/mbtk_pdu_sms.c
+++ b/mbtk/libmbtk_lib/ril/mbtk_pdu_sms.c
@@ -166,7 +166,7 @@
     result = (char *) malloc(sizeof(char) * (len + 2));
     //wmemset(result, 0, sizeof(char) * (len + 1));
     buf = result;
-    
+
     if (strncmp(data + index + 2, "91", 2) == 0) {
         sprintf(buf++, "+");
     }
@@ -461,7 +461,7 @@
 
     if (is_acsii((unsigned char*)Data) == 0) {
         int len;
-        len = utf8len((unsigned char *) Data); 
+        len = utf8len((unsigned char *) Data);
 
         u_int16_t *code = (u_int16_t *) malloc(sizeof(u_int16_t) * len);
         utf8toutf16((unsigned char *) Data, code, len, &len);
@@ -559,7 +559,7 @@
             else
                 return NULL;
         }
-        if (UDC == NULL || utf8len(UDC) <= room) {
+        if (UDC == NULL || utf8len((unsigned char *)UDC) <= room) {
             result = (struct UDS *) malloc(sizeof(struct UDS));
             result->Data = (char **)malloc(sizeof(char *));
             result->total = 1;
@@ -580,7 +580,7 @@
             if (room < 1)
                 return NULL;
 
-            int len = utf8len(UDC);
+            int len = utf8len((unsigned char *)UDC);
 
             result = (struct UDS *) malloc(sizeof(struct UDS));
             result->total = 0;
@@ -590,12 +590,12 @@
             for (i = 0; i < len; i += room) {
 		    int real_size;
                 if (i + room < len) {
-		    real_size = utf8_get_size(UDC + index, room);
+		    real_size = utf8_get_size((unsigned char *)UDC + index, room);
                     result->Data[result->total] = (char*)malloc(sizeof(char) * (real_size + 1));
                     strcpy(result->Data[result->total++],sub_str(UDC, index, real_size));
                 }
                 else {
-		    real_size = utf8_get_size(UDC + index, len - i);
+		    real_size = utf8_get_size((unsigned char *)UDC + index, len - i);
                     result->Data[result->total] = (char*)malloc(sizeof(char) * (real_size + 1));
                     strcpy(result->Data[result->total++], sub_str(UDC, index, -1));
                 }
@@ -696,7 +696,6 @@
 char *SoloPDUEncoding(char *SCA, char *DA, char *UC, struct UDHS *udhs, enum EnumDCS DCS) {
     char *result;
     char *buf, *ret;
-    int index;
 
     result = (char *) malloc(sizeof(char) * 400);
     buf = result;
@@ -932,11 +931,12 @@
 
 char *UDHEncoding(struct UDHS *udhs, int *UDHL) {
 
-    *UDHL = 0;
+    int i = 0;
 
     if (udhs == NULL || udhs->count == 0)
         return "";
-	int i = 0;
+
+    *UDHL = 0;
     for (i = 0; i < udhs->count; i++) {
         *UDHL += udhs->UDH[i].count + 2;
     }
@@ -948,7 +948,7 @@
 
     sprintf(buf, "%02X", *UDHL);
     buf += 2;
-	
+
     for (i = 0; i < udhs->count; i++) {
         // 信息元素标识1字节
         sprintf(buf, "%02X", udhs->UDH[i].IEI);
@@ -967,7 +967,6 @@
     // 加上1字节的用户数据头长度
     (*UDHL)++;
     return result;
-
 }
 
 char *UDCEncoding(char *UDC, int *UDCL, int UDHL, enum EnumDCS DCS) {
