Fix code warning.

Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
diff --git a/mbtk/mbtk_rild/src/atchannel.c b/mbtk/mbtk_rild/src/atchannel.c
index 56b1d08..fe96df1 100755
--- a/mbtk/mbtk_rild/src/atchannel.c
+++ b/mbtk/mbtk_rild/src/atchannel.c
@@ -847,7 +847,7 @@
 
     pthread_attr_init (&attr);
     pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-    ret = pthread_create(&s_tid_reader, &attr, readerLoop, &attr);
+    ret = pthread_create(&s_tid_reader, &attr, readerLoop, NULL);
     if (ret < 0)
     {
         LOGE("AT thread create fail.");
@@ -855,7 +855,7 @@
     }
 
     pthread_t uart_tid_reader;
-    ret = pthread_create(&uart_tid_reader, &attr, readerUrcLoop, &attr);
+    ret = pthread_create(&uart_tid_reader, &attr, readerUrcLoop, NULL);
     if (ret < 0)
     {
         LOGE("Uart thread create fail.");
@@ -1244,7 +1244,7 @@
  */
 int at_handshake()
 {
-    int i;
+//    int i;
     int err = 0;
 
     if (0 != pthread_equal(s_tid_reader, pthread_self()))
diff --git a/mbtk/mbtk_rild/src/main.c b/mbtk/mbtk_rild/src/main.c
old mode 100644
new mode 100755
index 8df913b..afff8d5
--- a/mbtk/mbtk_rild/src/main.c
+++ b/mbtk/mbtk_rild/src/main.c
@@ -27,12 +27,14 @@
 #include "info_data.h"

 #include "mbtk_led.h"

 

+#ifndef TEMP_FAILURE_RETRY

 #define TEMP_FAILURE_RETRY(exp) ({         \

     typeof (exp) _rc;                      \

     do {                                   \

         _rc = (exp);                       \

     } while (_rc == -1 && errno == EINTR); \

     _rc; })

+#endif

 

 #define BUFFER_SIZE 2048

 #define UEVENT_USIM_DEV "/devices/virtual/usim_event/usim0"

@@ -58,7 +60,7 @@
 static bool is_first_boot = FALSE;

 

 void setRadioPower(int isOn);

-int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, void *data, int data_len);

+int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, const void *data, int data_len);

 int mbtk_signal_log(char *data);

 

 /* Called on command thread */

@@ -79,7 +81,7 @@
 static int metis_strptime(char *str_time)

 {

     struct tm stm;

-    char dateTime[30];

+//    char dateTime[30];

     struct timeval tv;

     if(strptime(str_time, "%Y-%m-%d %H:%M:%S",&stm) != NULL)

     {

@@ -155,7 +157,7 @@
     if(is_first_boot) {

         if(access(MBTK_BOOT_NET_READY , X_OK) == 0) {

             LOGD("Exec : %s", MBTK_BOOT_NET_READY);

-            system(MBTK_BOOT_NET_READY);

+            mbtk_system(MBTK_BOOT_NET_READY);

         } else {

             LOGE("%s can not exec.", MBTK_BOOT_NET_READY);

         }

@@ -432,7 +434,7 @@
     else if(strStartsWith(s, "+CGREG:")     // GMS/WCDMA data registed.

          || strStartsWith(s, "+CEREG:"))    // LTE data registed.

     {

-        char* tmp_s = s + 7;

+        const char* tmp_s = s + 7;

         static bool net_led_gms_wcdma = FALSE;

         static bool net_led_lte = FALSE;

         while(*tmp_s && *tmp_s == ' ')

@@ -1524,6 +1526,7 @@
     return sock;

 }

 

+#if 0

 static void ril_get_cgpaddr_ip_process()

 {

     int err, skip;

@@ -1592,6 +1595,7 @@
 error:

     at_response_free(p_response);

 }

+#endif

 

 static void sim_state_change(bool plug_in) {

     if(plug_in) {

@@ -1761,6 +1765,7 @@
 int InProduction_Mode(void);

 void server_ready_set(void);

 

+#if 0

 
 /*
  *Get mtdblock which name is ASR_FLAG
@@ -1795,7 +1800,7 @@
 	fclose(fd);
 	return ((find == 1) ? 0 : -1);

 }
-
+

 static int readFromMTD(const char *path, unsigned int offset, void *buf, int size)

 {
 	int ret, fd;
@@ -1850,7 +1855,7 @@
 	close(fd);
 	return 0;
 }

-

+#endif

 static void fota_result_check()

 {

 #if 0

@@ -1886,7 +1891,7 @@
     if(is_first_boot) {

         if(access(MBTK_BOOT_SERVER_READY , X_OK) == 0) {

             LOGD("Exec : %s", MBTK_BOOT_SERVER_READY);

-            system(MBTK_BOOT_SERVER_READY);

+            mbtk_system(MBTK_BOOT_SERVER_READY);

         } else {

             LOGE("%s can not exec.", MBTK_BOOT_SERVER_READY);

         }

@@ -1918,7 +1923,7 @@
 

     int fd = open(MBTK_RILD_TEMP_FILE, O_CREAT | O_RDWR, 0644);

     if(fd > 0) {

-        char buff[10] = {0};

+        char buff[100] = {0};

         int count = 0;

         if(read(fd, buff, sizeof(buff)) > 0) {

             count = atoi(buff);

@@ -1936,7 +1941,7 @@
         count++;

         memset(buff, 0, sizeof(buff));

         snprintf(buff, sizeof(buff), "%d", count);

-        write(fd, buff, strlen(buff));

+        mbtk_write(fd, buff, strlen(buff));

         close(fd);

     } else {

         is_first_boot = FALSE;

diff --git a/mbtk/mbtk_rild/src/mbtk_call.c b/mbtk/mbtk_rild/src/mbtk_call.c
index 94c835f..272e8be 100755
--- a/mbtk/mbtk_rild/src/mbtk_call.c
+++ b/mbtk/mbtk_rild/src/mbtk_call.c
@@ -28,8 +28,8 @@
 static int req_call_start(char *phont_number, int *cme_err)
 {
     ATResponse *response = NULL;
-    int tmp_int;
-    char *tmp_str = NULL;
+//    int tmp_int;
+//    char *tmp_str = NULL;
     char cmd[100] = {0};
     sprintf(cmd, "ATD%s;", phont_number);
     int err = at_send_command(cmd, &response);
@@ -151,7 +151,7 @@
     ATResponse *response = NULL;
     int tmp_int;
     char *tmp_str = NULL;
-    
+
     int err = at_send_command_multiline("AT+CLCC", "+CLCC:", &response);
     if (err < 0 || response->success == 0){
         *cme_err = at_get_cme_error(response);
diff --git a/mbtk/mbtk_rild/src/mbtk_data_call.c b/mbtk/mbtk_rild/src/mbtk_data_call.c
index 5215f77..321fb7c 100755
--- a/mbtk/mbtk_rild/src/mbtk_data_call.c
+++ b/mbtk/mbtk_rild/src/mbtk_data_call.c
@@ -1,5 +1,9 @@
 #if 1
+#include <ctype.h>
+
 #include "mbtk_data_call.h"
+#include "mbtk_info.h"
+#include "mbtk_utils.h"
 
 #define MBTK_RESULT_FAIL     -1
 #define MBTK_RESULT_SUCCESS  0
@@ -134,7 +138,7 @@
     int offset = 0;
     int fd = -1;
     sprintf(buf, "route add default dev ccinet%d", cid -1);
-    system(buf);
+    mbtk_system(buf);
 
     memset(buf, 0x0, 1024);
     memset(dns, 0x0, 128);
@@ -223,8 +227,8 @@
             LOGE("MNC not find !");
             return MBTK_RESULT_SUCCESS;
         }
-    }  
-    
+    }
+
     {
         int default_apn_name_length = p - ((char *)apninfo_s[1].apn_name) -1;
         LOGD("[qser_data] qser_check_apn_type default_apn_name_length = [%d]!", default_apn_name_length);
@@ -248,7 +252,7 @@
                         break;
                     }
                 }
-                
+
                 i++;
             }
 
@@ -270,7 +274,7 @@
         LOGE("paran is NULL.");
         return MBTK_RESULT_FAIL;
     }
-     
+
     //check 2 - 7
     int pdp_type_tmp = 1;
     for (;pdp_type_tmp <= MBTK_APN_CID_MAX; pdp_type_tmp++)
@@ -289,7 +293,7 @@
                     return MBTK_RESULT_FAIL;
                 }
             }
-            
+
             if(0x0 != apn_name[0])
             {
                 if (strcmp((char *)apninfo_s[pdp_type_tmp].apn_name, (char *)apn_name) == 0)
@@ -341,7 +345,7 @@
             LOGE("get user pass fail!ret [%d].", ret);
             return MBTK_RESULT_FAIL;
         }
-        
+
         mbtk_ip_type_enum local_ip_type = (mbtk_ip_type_enum)atoi(&local_ip[0]);
 
         if(apn->ip_type != local_ip_type || strcmp((char *)apn->apn, local_apn_name))
@@ -396,7 +400,7 @@
 
     sprintf(buff, "%s%d", MBTK_APN_TYPE, cid);
     property_set(buff, "NULL");
-    
+
     memset(&apninfo_s[cid], 0x0, sizeof(mbtk_qser_apn_info_s));
     return MBTK_RESULT_SUCCESS;
 }
@@ -599,10 +603,10 @@
         return MBTK_RESULT_FAIL;
     }
 
-    int ret = -1;
+//    int ret = -1;
     char buff[32] = {0};
     int cid = apn.cid;
-    
+
     memset(&apninfo_s[cid], 0x0, sizeof(mbtk_qser_apn_info_s));
     apninfo_s[cid].cid = apn.cid;
     apninfo_s[cid].ip_type = apn.ip_type;
@@ -619,14 +623,14 @@
     {
         memcpy(apninfo_s[cid].user_pass, apn.pass, strlen((char *)apn.pass));
     }
-   
+
     memcpy(apninfo_s[cid].apn_type, apn_type, strlen((char *)apn_type));
     if(state_save)
     {
         sprintf(buff, "%s%d", MBTK_APN_TYPE, apn.cid);
         property_set(buff, (char *)apn_type);
     }
-    
+
 
     if(state_save)
     {
@@ -659,7 +663,7 @@
     int len = 0;
     int ret = -1;
     memset(apn, 0x0, sizeof(mbtk_apn_info_t));
-    
+
     // cid
     apn->cid = (int)*str++;
 
@@ -686,7 +690,7 @@
             LOGE("cid is error.");
             return MBTK_RESULT_FAIL;
         }
-        
+
         if(apn->cid == 1)
         {
             LOGE("cid 1 no support set.");
@@ -720,7 +724,7 @@
         LOGE("auth input error!");
         return MBTK_RESULT_FAIL;
     }
-    
+
     // apn
     len = byte_2_uint16(str, false);
     str += sizeof(uint16);
@@ -759,12 +763,12 @@
 
     LOGD("APN : %d, %d, %s, %s, %s, %s, %s.", apn->cid,
                                         apn->ip_type,
-                                        (str_empty(apn->apn) ? "NULL" : apn->apn),
-                                        (str_empty(apn->user) ? "NULL" : apn->user),
-                                        (str_empty(apn->pass) ? "NULL" : apn->pass),
-                                        (str_empty(apn->auth) ? "NULL" : apn->auth),
-                                        (str_empty(apn_type) ? "NULL" : apn_type));
-    
+                                        (str_empty(apn->apn) ? "NULL" : (char*)apn->apn),
+                                        (str_empty(apn->user) ? "NULL" : (char*)apn->user),
+                                        (str_empty(apn->pass) ? "NULL" : (char*)apn->pass),
+                                        (str_empty(apn->auth) ? "NULL" : (char*)apn->auth),
+                                        (str_empty(apn_type) ? "NULL" : (char*)apn_type));
+
     ret = mbtk_apn_check_num1(apn_type, apn->apn, apn->cid);
     if(ret < 0)
     {
diff --git a/mbtk/mbtk_rild/src/mbtk_info_server.c b/mbtk/mbtk_rild/src/mbtk_info_server.c
index 27d08d4..f935a65 100755
--- a/mbtk/mbtk_rild/src/mbtk_info_server.c
+++ b/mbtk/mbtk_rild/src/mbtk_info_server.c
@@ -10,6 +10,7 @@
 #include <fcntl.h>
 #include <signal.h>
 #include <cutils/properties.h>
+#include <sys/time.h>
 
 #include "mbtk_type.h"
 #include "mbtk_info.h"
@@ -38,9 +39,9 @@
 static mbtk_queue_node_t info_queue;
 static pthread_cond_t info_cond;
 static pthread_mutex_t info_mutex;
-static mbtk_queue_node_t urc_queue;
-static pthread_cond_t urc_cond;
-static pthread_mutex_t urc_mutex;
+//static mbtk_queue_node_t urc_queue;
+//static pthread_cond_t urc_cond;
+//static pthread_mutex_t urc_mutex;
 static band_set_info_t band_set_info;
 static bool band_set_success = FALSE;
 static mbtk_modem_band_area_enum band_area;
@@ -66,6 +67,9 @@
 static mbtk_signal_info_t signal_globe;
 
 mbtk_info_err_enum ecall_pack_req_process(sock_client_info_t* cli_info, mbtk_info_pack_t* pack);
+void apn_prop_get();
+int mbtk_signal_log(char *data);
+
 
 /*
 AT*POWERIND=0"
@@ -130,6 +134,7 @@
 {
     ATResponse *response = NULL;
     char cmd[100] = {0};
+    int err = 0;
 
     if ((state->mode == 1 && state->oosPhase[0] == 0 && state->oosPhase[1] == 0 && state->oosPhase[2] == 0) \
         || state->mode == 0)
@@ -158,7 +163,7 @@
     }
 
     LOG("Set the oos command is = [%s]\n", cmd);
-    int err = at_send_command(cmd, &response);
+    err = at_send_command(cmd, &response);
     if (err < 0 || response->success == 0){
         *cme_err = at_get_cme_error(response);
         goto exit;
@@ -289,7 +294,7 @@
         {
             //mbtk_info_pack_data_set(pack, data, data_len);
             pack->data_len = (uint16)data_len;
-            pack->data = (const uint8*)data;
+            pack->data = (uint8*)data;
         }
         mbtk_info_pack_send(fd, pack);
         mbtk_info_pack_free(&pack);
@@ -303,12 +308,12 @@
 static int apn_prop_set(mbtk_apn_info_t *apn)
 {
     char prop_name[20] = {0};
-    char prop_data[300] = {0};
+    char prop_data[1024] = {0};
     sprintf(prop_name, "%s_%d",MBTK_APN_PROP,apn->cid);
-    snprintf(prop_data, 300, "%d,%s,%s,%s,%s", apn->ip_type, apn->apn,
-        str_empty(apn->user) ? "NULL" : apn->user,
-        str_empty(apn->pass) ? "NULL" : apn->pass,
-        str_empty(apn->auth) ? "NULL" : apn->auth);
+    snprintf(prop_data, sizeof(prop_data), "%d,%s,%s,%s,%s", apn->ip_type, apn->apn,
+        str_empty(apn->user) ? "NULL" : (char*)apn->user,
+        str_empty(apn->pass) ? "NULL" : (char*)apn->pass,
+        str_empty(apn->auth) ? "NULL" : (char*)apn->auth);
 
     return property_set(prop_name, prop_data);
 }
@@ -394,6 +399,7 @@
 #endif
 }
 
+#if 0
 static int parseRegistrationState(char *str, int *items, int **response)
 {
     int err;
@@ -518,7 +524,7 @@
     free(resp);
     return -1;
 }
-
+#endif
 /*
 0: minimum functionality
 1: full functionality
@@ -586,7 +592,7 @@
                 break;
 
             case CME_SIM_NOT_INSERTED:
-            case 13: //sim fail,as "sim absent"
+            case CME_SIM_ABSENT: //sim fail,as "sim absent"
                 ret = MBTK_SIM_ABSENT;
                 goto done;
 
@@ -709,7 +715,7 @@
         memcpy(apn_name, ptr_1, ptr_2 - ptr_1); // apn
 
         // Check ip_type and apn_name
-        if(ip_type != apn->ip_type || strcmp(apn_name, apn->apn)) {
+        if(ip_type != apn->ip_type || strcmp(apn_name, (char*)apn->apn)) {
             LOGD("APN Changed, not get user/pass/auth.");
             return -1;
         }
@@ -752,7 +758,7 @@
 static int req_plmn_get(mbtk_plmn_info *type, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int err = at_send_command_multiline("AT+CPOL?", "+CPOL:", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -815,7 +821,7 @@
 static int req_sim_card_type_get(uint8 *type, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int err = at_send_command_singleline("AT*EUICC?", "*EUICC:", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -852,7 +858,8 @@
 static int req_pin_puk_last_times_get(mbtk_pin_puk_last_times *times, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
+    int tmp_int;
     int err = at_send_command_singleline("AT+EPIN?", "+EPIN:", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -867,29 +874,33 @@
         goto exit;
     }
     mbtk_pin_puk_last_times last_times={0};
-    err = at_tok_nextint(&line, &(last_times.p1_retry));
+    err = at_tok_nextint(&line, &tmp_int);
     if (err < 0)
     {
         goto exit;
     }
+    last_times.p1_retry = (uint8_t)tmp_int;
     times->p1_retry = last_times.p1_retry;
-    err = at_tok_nextint(&line, &(last_times.p2_retry));
+    err = at_tok_nextint(&line, &tmp_int);
     if (err < 0)
     {
         goto exit;
     }
+    last_times.p2_retry = (uint8_t)tmp_int;
     times->p2_retry = last_times.p2_retry;
-    err = at_tok_nextint(&line, &(last_times.puk1_retry));
+    err = at_tok_nextint(&line, &tmp_int);
     if (err < 0)
     {
         goto exit;
     }
+    last_times.puk1_retry = (uint8_t)tmp_int;
     times->puk1_retry = last_times.puk1_retry;
-    err = at_tok_nextint(&line, &(last_times.puk2_retry));
+    err = at_tok_nextint(&line, &tmp_int);
     if (err < 0)
     {
         goto exit;
     }
+    last_times.puk2_retry = (uint8_t)tmp_int;
     times->puk2_retry = last_times.puk2_retry;
 
 exit:
@@ -1139,7 +1150,7 @@
 static int req_time_set(int type, char *time, int *cme_err)
 {
     ATResponse *response = NULL;
-    int tmp_int;
+//    int tmp_int;
     char cmd[200] = {0};
     if(str_empty(time)){
         sprintf(cmd, "AT+SYSTIME=%d", type);
@@ -1343,7 +1354,7 @@
 static int req_volte_get(int *state, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int err = at_send_command_singleline("AT+ACONFIG?", "", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -1859,10 +1870,10 @@
 
 OK
 */
-static int req_get_pin_state(mbtk_enable_pin_info *state, int *cme_err)
+static int req_get_pin_state(mbtk_pin_state_enum *state, int *cme_err)
 {
     ATResponse *response = NULL;
-    char cmd[64]={0};
+//    char cmd[64]={0};
 
     int err = at_send_command_singleline("AT+CLCK=SC,2", "+CLCK:", &response);
     if (err < 0 || response == NULL || response->success == 0 || !response->p_intermediates)
@@ -1898,11 +1909,11 @@
 
     if(clck == 1)
     {
-        state = MBTK_PIN_ENABLE;
+        *state = MBTK_PIN_ENABLE;
     }
     else
     {
-        state = MBTK_PIN_DISABLE;
+        *state = MBTK_PIN_DISABLE;
     }
 exit:
     at_response_free(response);
@@ -2213,8 +2224,8 @@
 static int req_available_net_get(void* buff, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
-    int tmp_int;
+//    char *tmp_ptr = NULL;
+//    int tmp_int;
     int buff_size = 0;
     int err = at_send_command_singleline("AT+COPS=?", "+COPS:", &response);
 
@@ -2728,7 +2739,7 @@
     printf("req_cmgl_set(2)-----------------start\n");
     printf("cmgl:%s\n", cmgl);
     ATResponse *response = NULL;
-    char cmd[30] = {0};
+    char cmd[500] = {0};
 	char data[218] = {0};
     int err = 0;
 
@@ -2748,8 +2759,8 @@
 
         ATLine* lines_ptr = response->p_intermediates;
         char *line = NULL;
-        int reg_len = 0;
-		bool flag = false;
+//        int reg_len = 0;
+//		bool flag = false;
         while(lines_ptr)
         {
             line = lines_ptr->line;
@@ -3116,9 +3127,9 @@
 static int net_ims_get(int *reg, int *cme_err)
 {
     ATResponse *response = NULL;
-    int tmp_int, tmp_reg = 0;
+    int tmp_reg = 0;
     int err;
-    char *tmp_str = NULL;
+//    char *tmp_str = NULL;
 
     err = at_send_command_singleline("AT+ACONFIG?", "", &response);
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -3146,7 +3157,7 @@
     ATResponse *response = NULL;
     int tmp_int, tmp_reg = -1;
     int err;
-    char *tmp_str = NULL;
+//    char *tmp_str = NULL;
 
     err = at_send_command_multiline("AT+CIREG?", "+CIREG:", &response);
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -3301,10 +3312,10 @@
                     uint16_2_byte((uint16)0, data_ptr, false);
                     data_ptr += sizeof(uint16);
                 } else {
-                    uint16_2_byte((uint16)strlen(apn.user), data_ptr, false);
+                    uint16_2_byte((uint16)strlen((char*)apn.user), data_ptr, false);
                     data_ptr += sizeof(uint16);
-                    memcpy(data_ptr, apn.user, strlen(apn.user));
-                    data_ptr += strlen(apn.user);
+                    memcpy(data_ptr, apn.user, strlen((char*)apn.user));
+                    data_ptr += strlen((char*)apn.user);
                 }
 
                 // pass
@@ -3312,10 +3323,10 @@
                     uint16_2_byte((uint16)0, data_ptr, false);
                     data_ptr += sizeof(uint16);
                 } else {
-                    uint16_2_byte((uint16)strlen(apn.pass), data_ptr, false);
+                    uint16_2_byte((uint16)strlen((char*)apn.pass), data_ptr, false);
                     data_ptr += sizeof(uint16);
-                    memcpy(data_ptr, apn.pass, strlen(apn.pass));
-                    data_ptr += strlen(apn.pass);
+                    memcpy(data_ptr, apn.pass, strlen((char*)apn.pass));
+                    data_ptr += strlen((char*)apn.pass);
                 }
 
                 // auth
@@ -3323,10 +3334,10 @@
                     uint16_2_byte((uint16)0, data_ptr, false);
                     data_ptr += sizeof(uint16);
                 } else {
-                    uint16_2_byte((uint16)strlen(apn.auth), data_ptr, false);
+                    uint16_2_byte((uint16)strlen((char*)apn.auth), data_ptr, false);
                     data_ptr += sizeof(uint16);
-                    memcpy(data_ptr, apn.auth, strlen(apn.auth));
-                    data_ptr += strlen(apn.auth);
+                    memcpy(data_ptr, apn.auth, strlen((char*)apn.auth));
+                    data_ptr += strlen((char*)apn.auth);
                 }
             }
 
@@ -3565,7 +3576,7 @@
             break;
         }
     }
-    if(strlen(apn->apn) > 0) {
+    if(strlen((char*)apn->apn) > 0) {
         index += sprintf(cmd + index,"\"%s\"", apn->apn);
     }
 
@@ -3582,11 +3593,11 @@
 
         memset(cmd,0,400);
         int cmd_auth=0;
-        if(strstr(apn->auth,"NONE"))
+        if(strstr((char*)apn->auth,"NONE"))
             cmd_auth = 0;
-        else if(strstr(apn->auth,"PAP"))
+        else if(strstr((char*)apn->auth,"PAP"))
             cmd_auth = 1;
-        else if(strstr(apn->auth,"CHAP"))
+        else if(strstr((char*)apn->auth,"CHAP"))
             cmd_auth = 2;
 #if 0
         else if(strstr(apn->auth,"PAP AND CHAP"))
@@ -3644,6 +3655,7 @@
     }
 }
 
+#if 0
 /*
 AT+CGDATA="",6
 CONNECT
@@ -3659,7 +3671,7 @@
 {
     ATResponse *response = NULL;
     char cmd[400] = {0};
-    int index = 0;
+//    int index = 0;
     int err = 0;
 
     err = at_send_command_singleline("AT+COPS?", "+COPS:", &response);
@@ -3671,7 +3683,7 @@
     }
 
     int tmp_int;
-    char cmd_buf[64];
+    char *cmd_buf = NULL;
     char *line = response->p_intermediates->line;
     err = at_tok_start(&line);
     if (err < 0)
@@ -3703,7 +3715,7 @@
     if(tmp_int == 7 && cid == 1)    //LTE && cid = 1
     {
         ATResponse *response = NULL;
-        char cmd[400] = {0};
+//        char cmd[400] = {0};
         int err = 0;
 
         err = at_send_command("AT+CFUN=1", &response);
@@ -3717,7 +3729,8 @@
     else
     {
         ATResponse *response = NULL;
-        char cmd[400] = {0};
+//        char cmd[400] = {0};
+        memset(cmd, 0, sizeof(cmd));
         int err = 0;
         sprintf(cmd, "AT+CGDATA=\"\",%d", cid);
         err = at_send_command(cmd, &response);
@@ -3733,6 +3746,7 @@
     at_response_free(response);
     return err;
 }
+#endif
 
 /*
 AT+CGACT?
@@ -4064,6 +4078,7 @@
     return err;
 }
 
+#if 0
 /*
 AT+CGCONTRDP
 +CGCONTRDP: 1,5,"cmnet.MNC000.MCC460.GPRS","10.156.238.86","","223.87.253.100","223.87.253.253","","",0,0
@@ -4148,7 +4163,7 @@
                     goto exit;
                 }
 
-                if(inet_ntop(AF_INET6, tmp_ipv6, apn->ipv6, 50) == NULL) {
+                if(inet_ntop(AF_INET6, tmp_ipv6, (char*)apn->ipv6, 50) == NULL) {
                     err = -1;
                     LOGE("inet_ntop ipv6 ip fail.");
                     goto exit;
@@ -4163,6 +4178,7 @@
     at_response_free(response);
     return err;
 }
+#endif
 
 mbtk_info_err_enum call_pack_req_process(sock_client_info_t* cli_info, mbtk_info_pack_t* pack);
 mbtk_info_err_enum sms_pack_req_process(sock_client_info_t* cli_info, mbtk_info_pack_t* pack);
@@ -5187,8 +5203,8 @@
                         ptr += len;
                     }
 
-                    LOGD("APN : %d, %d, %s, %s, %s, %s", apn.cid, apn.ip_type, str_empty(apn.apn) ? "NULL" : apn.apn,
-                        str_empty(apn.user) ? "NULL" : apn.user, str_empty(apn.pass) ? "NULL" : apn.pass, str_empty(apn.auth) ? "NULL" : apn.auth);
+                    LOGD("APN : %d, %d, %s, %s, %s, %s", apn.cid, apn.ip_type, str_empty(apn.apn) ? "NULL" : (char*)apn.apn,
+                        str_empty(apn.user) ? "NULL" : (char*)apn.user, str_empty(apn.pass) ? "NULL" : (char*)apn.pass, str_empty(apn.auth) ? "NULL" : (char*)apn.auth);
                     if(req_apn_set(&apn, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
                     {
                         if(cme_err != MBTK_INFO_ERR_CME_NON) {
@@ -5237,7 +5253,7 @@
                 }
                 else
                 {
-                    const uint8* ptr = pack->data;
+//                    const uint8* ptr = pack->data;
                     mbtk_apn_info_t apn;
                     mbtk_apn_req_type_enum req_type = MBTK_APN_REQ_TYPE_SET;
                     uint8 apn_type[MBTK_QSER_APN_NAME_SIZE] = {0};
@@ -5801,7 +5817,6 @@
                 }
                 else     // Set OOS
                 {
-                    mbtk_oos_info *state = (mbtk_oos_info *)pack->data;
                     if(pack->data_len != sizeof(mbtk_oos_info))
                     {
                         err = MBTK_INFO_ERR_REQ_PARAMETER;
@@ -5809,6 +5824,7 @@
                         break;
                     }
 
+                    mbtk_oos_info *state = (mbtk_oos_info *)pack->data;
                     if(req_oos_set(state, &cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
                     {
                         if(cme_err != MBTK_INFO_ERR_CME_NON) {
@@ -5910,7 +5926,7 @@
     return 0;
 }
 
-static void radio_state_change(void *data, int data_len)
+static void radio_state_change(const void *data, int data_len)
 {
     uint8 *data_ptr = (uint8*)data;
     if(data_ptr[0]) {
@@ -5936,7 +5952,7 @@
     }
 }
 
-static void pdp_state_change(void *data, int data_len)
+static void pdp_state_change(const void *data, int data_len)
 {
     sock_client_info_t *cli = NULL;
     list_first(sock_client_list);
@@ -5954,7 +5970,7 @@
     }
 }
 
-static void net_state_change(void *data, int data_len)
+static void net_state_change(const void *data, int data_len)
 {
     sock_client_info_t *cli = NULL;
     list_first(sock_client_list);
@@ -5973,7 +5989,7 @@
     }
 }
 
-static void call_state_change(void *data, int data_len)
+static void call_state_change(const void *data, int data_len)
 {
     sock_client_info_t *cli = NULL;
     list_first(sock_client_list);
@@ -5992,7 +6008,7 @@
     }
 }
 
-static void sim_state_change(void *data, int data_len)
+static void sim_state_change(const void *data, int data_len)
 {
     sock_client_info_t *cli = NULL;
     list_first(sock_client_list);
@@ -6011,7 +6027,7 @@
     }
 }
 
-static void sms_state_change(void *data, int data_len)
+static void sms_state_change(const void *data, int data_len)
 {
     sock_client_info_t *cli = NULL;
     list_first(sock_client_list);
@@ -6030,7 +6046,7 @@
     }
 }
 
-static void signal_state_change(void *data, int data_len)
+static void signal_state_change(const void *data, int data_len)
 {
     sock_client_info_t *cli = NULL;
     list_first(sock_client_list);
@@ -6050,7 +6066,7 @@
 }
 
 
-int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, void *data, int data_len)
+int urc_msg_distribute(bool async_process, info_urc_msg_id_enum msg, const void *data, int data_len)
 {
 #if 0
     if(urc_queue.count >= PACK_PROCESS_QUEUE_MAX)
@@ -6309,7 +6325,7 @@
                         // "data_len"
                         pack->data_len = 5;
 
-                        char *p = (char *)malloc(5);
+                        uint8 *p = (uint8 *)malloc(5);
                         p[0] = MBTK_DATA_CALL_START;
                         p[1] = i;
                         p[2] = 0;
@@ -6926,6 +6942,7 @@
     }
 }
 
+#if 0
 /*
 root@OpenWrt:/usrdata# cat /proc/mtd
 dev:    size   erasesize  name
@@ -6954,7 +6971,7 @@
 		return -1;
     }
 
-    int fp = fopen("/proc/mtd", "r");
+    FILE* fp = fopen("/proc/mtd", "r");
 	if (fp == NULL) {
 		LOGE("Open MTD failed!");
 		return -1;
@@ -6972,11 +6989,12 @@
 
     return -1;
 }
-
+#endif
+#if 0
 static int custom_partition_read(const char *name, mbtk_cust_info_t *cust_info)
 {
-    int fd = 0, ret = 0;
-    unsigned int step = 0, offset = 0, flaglen = 0;
+    int fd = 0;
+    unsigned int flaglen = 0;
     flaglen = sizeof(mbtk_cust_info_t);
 
     char mtd_path[50] = {0};
@@ -7012,6 +7030,7 @@
     close(fd);
     return -1;
 }
+#endif
 
 /*
 AT*BAND=15,78,147,482,134742231
@@ -7067,11 +7086,12 @@
     return NULL;
 }
 
+#if 0
 static void* net_monitor_thread(void* arg)
 {
     UNUSED(arg);
     // Start network monitor
-    int cid;
+//    int cid;
     while(1) {
 #if 0
         // Config IP
@@ -7157,7 +7177,9 @@
     LOGD("monitor_thread exit.");
     return NULL;
 }
+#endif
 
+#if 0
 static void* urc_process_thread(void* arg)
 {
     UNUSED(arg);
@@ -7215,6 +7237,7 @@
 
     return NULL;
 }
+#endif
 
 static void ril_at_ready_process()
 {
@@ -7232,7 +7255,7 @@
         at_send_command("AT+CEREG=2", NULL);
     }
 
-    int count = 0;
+//    int count = 0;
 #endif
     net_info.sim_state = getSIMStatus();
 #if 0
@@ -7342,7 +7365,7 @@
         goto error;
     }
 
-    pthread_t info_pid, pack_pid, monitor_pid, urc_pid, bootconn_pid;
+    pthread_t info_pid, pack_pid/*, monitor_pid, urc_pid*/, bootconn_pid;
     pthread_attr_t thread_attr;
     pthread_attr_init(&thread_attr);
     if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))
diff --git a/mbtk/mbtk_rild/src/mbtk_led.c b/mbtk/mbtk_rild/src/mbtk_led.c
index 27fd24f..a850f10 100755
--- a/mbtk/mbtk_rild/src/mbtk_led.c
+++ b/mbtk/mbtk_rild/src/mbtk_led.c
@@ -24,26 +24,28 @@
 static mbtk_net_led_type mbtk_net_led_prev_state = MBTK_NET_LED_SEARCH_NETWORK;
 static mbtk_status_led_type mbtk_status_led_state = MBTK_STATUS_LED_CLOSE;
 
-static int MBTK_NET_LED_LOCK_SET = 0; 
+static int MBTK_NET_LED_LOCK_SET = 0;
 /****************************VARIABLE***************************************/
 
 /******************************FUNC*****************************************/
-int mbtk_read_ccinet(void) 
+int mbtk_read_ccinet(void)
 {
     FILE *fp;
-    int ret = 0;
-    char buffer[1024]; 
-    char type[10]={0};
-    
-    fp = popen("ifconfig", "r"); 
+//    int ret = 0;
+    char buffer[1024];
+//    char type[10]={0};
+
+    fp = popen("ifconfig", "r");
     if (fp == NULL) {
         printf("popen fail\n");
         return -1;
     }
-  
-    fread(buffer,1, sizeof(buffer) -1, fp);
+
+    if(fread(buffer,1, sizeof(buffer) -1, fp) <= 0) {
+
+    }
     //LOGE("[led]buffer:%s\n", buffer);
-    pclose(fp); // 
+    pclose(fp); //
 
     char *p1 = strstr(buffer, "ccinet");
     if(p1 == NULL)
@@ -187,7 +189,7 @@
         result = write(fd,"1",1);
     }
     close(fd);
-    
+
     if(result != 1)
     {
         LOGE("[led]Set gpio[%d] value fail.", gpio);
@@ -292,7 +294,7 @@
 
 int mbtk_led_init(void)
 {
-    int ret = MBTK_RESULT_FAIL;
+//    int ret = MBTK_RESULT_FAIL;
 
     mbtk_led_gpio_init(MBTK_STATUS_LED);
     mbtk_led_gpio_init(MBTK_NET_LED);
@@ -301,7 +303,7 @@
 
     pthread_attr_t thread_attr;
     pthread_t net_led_thread_id;
-    pthread_t status_led_thread_id;
+//    pthread_t status_led_thread_id;
     pthread_attr_init(&thread_attr);
     if(pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED))
     {
diff --git a/mbtk/mbtk_rild/src/mbtk_phonebook.c b/mbtk/mbtk_rild/src/mbtk_phonebook.c
index 215727c..34611cb 100755
--- a/mbtk/mbtk_rild/src/mbtk_phonebook.c
+++ b/mbtk/mbtk_rild/src/mbtk_phonebook.c
@@ -25,7 +25,7 @@
 mbtk_info_err_enum pb_pack_req_process(sock_client_info_t* cli_info, mbtk_info_pack_t* pack)
 {
     mbtk_info_err_enum err = MBTK_INFO_ERR_SUCCESS;
-    int cme_err = MBTK_INFO_ERR_CME_NON;
+//    int cme_err = MBTK_INFO_ERR_CME_NON;
     switch(pack->info_id)
     {
         case MBTK_INFO_ID_PB_STATE_REQ:
diff --git a/mbtk/mbtk_rild/src/mbtk_sms.c b/mbtk/mbtk_rild/src/mbtk_sms.c
index 79752e7..c2e0f36 100755
--- a/mbtk/mbtk_rild/src/mbtk_sms.c
+++ b/mbtk/mbtk_rild/src/mbtk_sms.c
@@ -30,7 +30,7 @@
 static int req_cmgf_get(int *state, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int err = at_send_command_singleline("AT+CMGF?", "", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -128,7 +128,7 @@
 {
 	printf("req_cpms_get------------start(3)\n");
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int err = at_send_command_singleline("AT+CPMS?", "", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -235,7 +235,7 @@
 	char pnum[20] = {0};
     char *ptr = cmgs;
     int err = 0;
-	int data_len = 0;
+//	int data_len = 0;
 
 	char *src = strstr(cmgs, ",");
 	if(src != NULL)
@@ -254,10 +254,10 @@
     }
     LOGD("num:%s", pnum);
     LOGD("data:%s", data);
-    
+
 	sprintf(cmd, "AT+CMGS=%s", pnum);
     LOGD("cmd:%s", cmd);
-    
+
 	if(strlen(cmd) > 0)
 	{
 		int err = at_send_command_sms(cmd, data, "+CMGS: ", &response);
@@ -302,7 +302,7 @@
 
 	sprintf(cmd, "AT+CMGW=%s", pnum);
 	printf("cmd:%s,data:%s---------\n", cmd,data);
-	
+
 	if(strlen(cmd) > 0)
 	{
 		int err = at_send_command_sms(cmd, data, "+CMGW: ", &response);
@@ -333,16 +333,16 @@
     printf("0req_cmgd_set()--------------start\n");
     printf("cmgd:%s\n", cmgd);
     ATResponse *response = NULL;
-    char cmd[30] = {0};
+    char cmd[500] = {0};
 	char data[218] = {0};
-	char pnum[13] = {0};
-    char *ptr = cmgd;
+//	char pnum[13] = {0};
+//    char *ptr = cmgd;
     int err = 0;
 
 	memcpy(data, cmgd, len );
 	sprintf(cmd, "AT+CMGD=%s", data);
 	printf("cmd:%s,data:%s---------\n", cmd,data);
-	
+
 	if(strlen(cmd) > 0)
 	{
 		int err = at_send_command(cmd, &response);
@@ -373,7 +373,7 @@
 static int req_cmgd_get(char *reg, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int err = at_send_command_singleline("AT+CMGD=?", "+CMGD:", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -407,7 +407,7 @@
 
 
 /*
-AT+CMGL="ALL"	
+AT+CMGL="ALL"
 
 +CMGL: 1,"REC READ","10658678",,"22.11.14 10:41:44 GMT+8"
 
@@ -429,7 +429,7 @@
 	int s_index = 0, g_index = 0;
 	bool index_flag = false;
 	char *ptr_index = index_data;
-	char phone[50];
+//	char phone[50];
 	char number[5] = {0};
     int err = 0;
 
@@ -458,7 +458,7 @@
 
 	ptr1 = NULL;
 	ptr2 = NULL;
-	
+
 	if(strlen(cmd) > 0)
 	{
         err = at_send_command_multiline(cmd, "", &response);
@@ -517,8 +517,8 @@
 
 	if(index_flag)
 	{
-		memset(reg, 0, sizeof(reg));
-		memcpy(reg, ptr_index, strlen(ptr_index) );
+		// memset(reg, 0, sizeof(reg));
+		memcpy(reg, ptr_index, strlen(ptr_index) + 1);
 	}
     err = 0;
 exit:
@@ -535,7 +535,7 @@
 static int req_csca_get(char *req, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int err = at_send_command_singleline("AT+CSCA?", "", &response);
 
     if (err < 0 || response->success == 0 || !response->p_intermediates){
@@ -557,7 +557,7 @@
     {
         err = -1;
     }
-    
+
 exit:
     at_response_free(response);
     return err;
@@ -568,16 +568,16 @@
     printf("req_csca_set()--------------start\n");
     printf("csca:%s\n", csca);
     ATResponse *response = NULL;
-    char cmd[30] = {0};
+    char cmd[500] = {0};
 	char data[218] = {0};
-	char pnum[13] = {0};
-    char *ptr = csca;
+//	char pnum[13] = {0};
+//    char *ptr = csca;
     int err = 0;
 
 	memcpy(data, csca, len);
 	sprintf(cmd, "AT+CSCA=%s", data);
 	printf("cmd:%s,data:%s---------\n", cmd,data);
-	
+
 	if(strlen(cmd) > 0)
 	{
 		int err = at_send_command(cmd, &response);
@@ -601,16 +601,16 @@
     printf("req_csmp_set()-------------------start\n");
     printf("csmp:%s\n", csmp);
     ATResponse *response = NULL;
-    char cmd[30] = {0};
+    char cmd[500] = {0};
 	char data[218] = {0};
-	char pnum[13] = {0};
-    char *ptr = csmp;
+//	char pnum[13] = {0};
+//    char *ptr = csmp;
     int err = 0;
 
 	memcpy(data, csmp, len);
 	sprintf(cmd, "AT+CSMP=%s", data);
 	printf("cmd:%s,data:%s---------\n", cmd,data);
-	
+
 	if(strlen(cmd) > 0)
 	{
 		int err = at_send_command(cmd, &response);
@@ -636,14 +636,14 @@
     ATResponse *response = NULL;
     char cmd[30] = {0};
 	char data[218] = {0};
-	char pnum[13] = {0};
-    char *ptr = cscb;
+//	char pnum[13] = {0};
+//    char *ptr = cscb;
     int err = 0;
 
 	memcpy(data, cscb, len);
 	sprintf(cmd, "AT+CSCB=%s", cscb);
 	printf("cmd:%s,data:%s---------\n", cmd,data);
-	
+
 	if(strlen(cmd) > 0)
 	{
 		int err = at_send_command(cmd, &response);
@@ -695,10 +695,10 @@
 			*cme_err = at_get_cme_error(response);
 			goto exit;
 		}
-		
+
 		char *line = response->p_intermediates->line;
 		printf("line:%s\n", line);
-		
+
 		char *tmp_str = NULL;
 		err = at_tok_nextstr(&line, &tmp_str); // phone_number
 		if (err < 0)
@@ -859,7 +859,7 @@
         {
             if(pack->data_len == 0 || pack->data == NULL)   // SET at+cnmi=1,2.
             {
-                int state;
+//                int state;
                 if(req_cnmi_set(&cme_err) || cme_err != MBTK_INFO_ERR_CME_NON)
                 {
                     printf("set req_cnmi_set() fail.\n");
diff --git a/mbtk/mbtk_rild/src/ril_ecall.c b/mbtk/mbtk_rild/src/ril_ecall.c
index e0a6265..7e3a03e 100755
--- a/mbtk/mbtk_rild/src/ril_ecall.c
+++ b/mbtk/mbtk_rild/src/ril_ecall.c
@@ -24,7 +24,7 @@
 static int cfg_ecalldata_get(mbtk_ecall_cfg_item_enum type, uint32 *value, int *cme_err)
 {
     ATResponse *response = NULL;
-    char *tmp_ptr = NULL;
+//    char *tmp_ptr = NULL;
     int tmp_int;
     char cmd[100] = {0};
     int err = 0;
@@ -462,7 +462,7 @@
 {
     ATResponse *response = NULL;
     char *tmp_ptr = NULL;
-    int tmp_int;
+//    int tmp_int;
     int err = 0;
 
     cfg->type = type;
@@ -934,7 +934,7 @@
                 }
                 else
                 {
-                    pack_rsp_send(cli_info->fd, RIL_MSG_ID_ECALL_MSD_RSP, msd, strlen(msd));
+                    pack_rsp_send(cli_info->fd, RIL_MSG_ID_ECALL_MSD_RSP, msd, strlen((char*)msd));
                 }
             }
             else     // Set
@@ -1170,7 +1170,7 @@
             memset(number, 0, sizeof(number));
             if(pack->data_len == 0 || pack->data == NULL)
             {
-                if(req_ecall_sms_num_get(number, &cme_err) || strlen(number) == 0 || cme_err != MBTK_INFO_ERR_CME_NON)
+                if(req_ecall_sms_num_get(number, &cme_err) || strlen((char*)number) == 0 || cme_err != MBTK_INFO_ERR_CME_NON)
                 {
                     if(cme_err != MBTK_INFO_ERR_CME_NON) {
                         err = MBTK_INFO_ERR_CME + cme_err;
@@ -1181,7 +1181,7 @@
                 }
                 else
                 {
-                    pack_rsp_send(cli_info->fd, RIL_MSG_ID_ECALL_SMS_NUM_RSP, number, strlen(number));
+                    pack_rsp_send(cli_info->fd, RIL_MSG_ID_ECALL_SMS_NUM_RSP, number, strlen((char*)number));
                 }
             }
             else     // Set