Fix warning as error for V2

Change-Id: I70cfd971fda629011ba1be84fef15afea196d393
diff --git a/mbtk/mbtk_rild_v2/src/atchannel.c b/mbtk/mbtk_rild_v2/src/atchannel.c
index 56b1d08..fe96df1 100755
--- a/mbtk/mbtk_rild_v2/src/atchannel.c
+++ b/mbtk/mbtk_rild_v2/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_v2/src/main.c b/mbtk/mbtk_rild_v2/src/main.c
index c1a20c8..e2020fc 100755
--- a/mbtk/mbtk_rild_v2/src/main.c
+++ b/mbtk/mbtk_rild_v2/src/main.c
@@ -32,12 +32,14 @@
 #include "mbtk_str.h"

 #include "mbtk_queue.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"

@@ -176,7 +178,7 @@
     if(!ril_net_ready) {

         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);

         }

@@ -192,7 +194,7 @@
     if(!ril_server_ready) {

         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);

         }

@@ -290,7 +292,7 @@
     }
 }

 

-static void ril_state_change(ril_msg_id_enum msg_id, void *data, int data_len)

+static void ril_state_change(ril_msg_id_enum msg_id, const void *data, int data_len)

 {
     sock_cli_info_t *cli = NULL;

     list_first(ril_info.sock_client_list);

@@ -679,6 +681,11 @@
         state.tech = (mbtk_radio_technology_enum)tmp_int; // AcT

     }

 

+    if(state.reg_state == MBTK_NET_REG_STATE_HOME

+        || state.reg_state == MBTK_NET_REG_STATE_ROAMING) {

+        mbtk_net_ready();

+    }

+

     urc_msg_distribute(false, RIL_MSG_ID_IND_NET_REG_STATE_CHANGE, &state, sizeof(mbtk_ril_net_reg_state_info_t));

 CGREG_EXIT:

     free(tmp_s);

@@ -749,21 +756,30 @@
         // "+CGEV: ME PDN ACT ")) { // +CGEV: ME PDN ACT <cid>,1

         mbtk_ril_pdp_state_info_t cgev_info;

         memset(&cgev_info, 0, sizeof(mbtk_ril_pdp_state_info_t));

-        if (sscanf(s, "+CGEV: NW PDN DEACT %d", &(cgev_info.cid)) == 1) {

+        int cid, reason = 0;

+        memset(&cgev_info, 0, sizeof(mbtk_ril_pdp_state_info_t));

+        if (sscanf(s, "+CGEV: NW PDN DEACT %d", &cid) == 1) {

+            cgev_info.cid = (uint16)cid;

             cgev_info.action = FALSE;

-        } else if (sscanf(s, "+CGEV: ME PDN DEACT %d", &(cgev_info.cid)) == 1) {

+        } else if (sscanf(s, "+CGEV: ME PDN DEACT %d", &cid) == 1) {

+            cgev_info.cid = (uint16)cid;

             cgev_info.action = FALSE;

-        } else if(sscanf(s, "+CGEV: ME PDN ACT %d,%d", &(cgev_info.cid), &(cgev_info.reason)) == 2

-                || sscanf(s, "+CGEV: ME PDN ACT %d", &(cgev_info.cid)) == 1) {

+        } else if(sscanf(s, "+CGEV: ME PDN ACT %d,%d", &cid, &reason) == 2

+                || sscanf(s, "+CGEV: ME PDN ACT %d", &cid) == 1) {

+            cgev_info.cid = (uint16)cid;

+            cgev_info.reason = (uint16)reason;

             cgev_info.action = TRUE;

         } else if (!strcmp(s, "+CGEV: ME DETACH")) {

             if(cgact_wait.waitting) {

                 cgev_info.cid = cgact_wait.cid;

             }

             cgev_info.action = FALSE;

-        } else if (sscanf(s, "+CGEV: NW MODIFY %d,%d", &(cgev_info.cid), &(cgev_info.reason)) == 2) {

+        } else if (sscanf(s, "+CGEV: NW MODIFY %d,%d", &cid, &reason) == 2) {

+            cgev_info.cid = (uint16)cid;

+            cgev_info.reason = (uint16)reason;

             cgev_info.action = TRUE;

-        } else if(sscanf(s, "+CGEV: EPS PDN ACT %d", &(cgev_info.cid)) == 1) {

+        } else if(sscanf(s, "+CGEV: EPS PDN ACT %d", &cid) == 1) {

+            cgev_info.cid = (uint16)cid;

             cgev_info.action = TRUE;

         } else {

             LOGD(">>>>>>>>>No process +CGEV <<<<<<<<<");

@@ -2400,7 +2416,7 @@
         band_info.band_support.lte_ext_band = info_modem.band_lte_ext;

     }
 
-    bool is_first = TRUE;
+//    bool is_first = TRUE;

     while(!band_info.band_set_success) {

         // Set band.

 #if 0

@@ -2500,7 +2516,7 @@
     pthread_mutex_init(&ril_info.msg_mutex, NULL);

     pthread_cond_init(&ril_info.msg_cond, NULL);

 
-    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_v2/src/ril_call.c b/mbtk/mbtk_rild_v2/src/ril_call.c
index 6264972..3891143 100755
--- a/mbtk/mbtk_rild_v2/src/ril_call.c
+++ b/mbtk/mbtk_rild_v2/src/ril_call.c
@@ -27,8 +27,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);
diff --git a/mbtk/mbtk_rild_v2/src/ril_data_call.c b/mbtk/mbtk_rild_v2/src/ril_data_call.c
index 14d1128..d5bcb2c 100755
--- a/mbtk/mbtk_rild_v2/src/ril_data_call.c
+++ b/mbtk/mbtk_rild_v2/src/ril_data_call.c
@@ -5,10 +5,12 @@
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <pthread.h>
 #include <sys/epoll.h>
 #include <fcntl.h>
 #include <signal.h>
+#include <cutils/properties.h>
 
 #include "mbtk_type.h"
 #include "mbtk_ril.h"
@@ -16,6 +18,8 @@
 #include "at_tok.h"
 #include "mbtk_utils.h"
 #include "ril_info.h"
+#include "mbtk_ifc.h"
+#include "mbtk_str.h"
 
 ril_cgact_wait_t cgact_wait;
 static ril_data_call_info_t info_list[MBTK_APN_CID_MAX];
@@ -23,6 +27,7 @@
 static int req_apn_get(bool get_def_cid, mbtk_apn_info_array_t *apns, int *cme_err);
 static int req_apn_set(mbtk_apn_info_t *apn, int *cme_err);
 static void apn_prop_get(mbtk_apn_info_array_t *apns);
+void ril_rsp_pack_send(int fd, int ril_id, int msg_index, const void* data, int data_len);
 
 /*
 IPv4 : 10.255.74.26
@@ -56,7 +61,7 @@
         // Add default route.
         memset(buf, 0, sizeof(buf));
         sprintf(buf, "route add default dev ccinet%d", cid - 1);
-        system(buf);
+        mbtk_system(buf);
     }
 }
 
@@ -390,7 +395,7 @@
             if(!is_change) {
                 index = 0;
                 while(index < apns.num) {
-                    if(strcmp(apns.apns[index].apn,apn->apn) == 0) {
+                    if(strcmp((char*)apns.apns[index].apn,(char*)apn->apn) == 0) {
                         LOGW("APN : %s exist.", apn->apn);
                         return -1;
                     }
@@ -657,9 +662,9 @@
         if(!str_empty(apn->apn)) {
             snprintf(prop_data, 1024, "%d,%d,%d,%s,%s,%s,%s", apn->ip_type, apn->auth, apn->auto_boot_call,
                 apn->apn,
-                str_empty(apn->user) ? "NULL" : apn->user,
-                str_empty(apn->pass) ? "NULL" : apn->pass,
-                str_empty(apn->pass) ? "NULL" : apn->type);
+                str_empty(apn->user) ? "NULL" : (char*)apn->user,
+                str_empty(apn->pass) ? "NULL" : (char*)apn->pass,
+                str_empty(apn->pass) ? "NULL" : (char*)apn->type);
         }
 
 #if 0
@@ -808,7 +813,7 @@
         lines_ptr = lines_ptr->p_next;
     }
 
-    char prop_name[128] = {0};
+ //   char prop_name[128] = {0};
     char prop_data[1024] = {0};
     char def_cid[10] = {0};
     sprintf(def_cid, "%d", MBTK_RIL_CID_DEF);
@@ -872,7 +877,7 @@
                 break;
             }
         }
-        if(strlen(apn->apn) > 0) {
+        if(strlen((char*)apn->apn) > 0) {
             index += sprintf(cmd + index,"\"%s\"", apn->apn);
         }
 
diff --git a/mbtk/mbtk_rild_v2/src/ril_dev.c b/mbtk/mbtk_rild_v2/src/ril_dev.c
index 0fe2d2f..4d267de 100755
--- a/mbtk/mbtk_rild_v2/src/ril_dev.c
+++ b/mbtk/mbtk_rild_v2/src/ril_dev.c
@@ -221,7 +221,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){
diff --git a/mbtk/mbtk_rild_v2/src/ril_ecall.c b/mbtk/mbtk_rild_v2/src/ril_ecall.c
index 4de85b4..3c61159 100755
--- a/mbtk/mbtk_rild_v2/src/ril_ecall.c
+++ b/mbtk/mbtk_rild_v2/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
                 {
-                    ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, msd, strlen(msd));
+                    ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, 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_RIL_ERR_CME_NON)
+                if(req_ecall_sms_num_get(number, &cme_err) || strlen((char*)number) == 0 || cme_err != MBTK_RIL_ERR_CME_NON)
                 {
                     if(cme_err != MBTK_RIL_ERR_CME_NON) {
                         err = MBTK_RIL_ERR_CME + cme_err;
@@ -1181,7 +1181,7 @@
                 }
                 else
                 {
-                    ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, number, strlen(number));
+                    ril_rsp_pack_send(cli_info->fd, pack->msg_id, pack->msg_index, number, strlen((char*)number));
                 }
             }
             else     // Set
diff --git a/mbtk/mbtk_rild_v2/src/ril_net.c b/mbtk/mbtk_rild_v2/src/ril_net.c
index 16d3118..8aacb7c 100755
--- a/mbtk/mbtk_rild_v2/src/ril_net.c
+++ b/mbtk/mbtk_rild_v2/src/ril_net.c
@@ -1150,7 +1150,7 @@
 static int req_cell_info_set(const char *cmgl, char *reg, int len, int *cme_err)
 {
     ATResponse *response = NULL;
-    char cmd[30] = {0};
+    char cmd[500] = {0};
 	char data[218] = {0};
     int err = 0;
 
@@ -1168,8 +1168,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;
diff --git a/mbtk/mbtk_rild_v2/src/ril_pb.c b/mbtk/mbtk_rild_v2/src/ril_pb.c
index 088aa46..522f578 100755
--- a/mbtk/mbtk_rild_v2/src/ril_pb.c
+++ b/mbtk/mbtk_rild_v2/src/ril_pb.c
@@ -25,7 +25,7 @@
 mbtk_ril_err_enum pb_pack_req_process(sock_cli_info_t* cli_info, ril_msg_pack_info_t* pack)
 {
     mbtk_ril_err_enum err = MBTK_RIL_ERR_SUCCESS;
-    int cme_err = MBTK_RIL_ERR_CME_NON;
+//    int cme_err = MBTK_RIL_ERR_CME_NON;
     switch(pack->msg_id)
     {
         case RIL_MSG_ID_PB_STATE:
diff --git a/mbtk/mbtk_rild_v2/src/ril_sim.c b/mbtk/mbtk_rild_v2/src/ril_sim.c
index ebc09f2..78ef0f0 100755
--- a/mbtk/mbtk_rild_v2/src/ril_sim.c
+++ b/mbtk/mbtk_rild_v2/src/ril_sim.c
@@ -157,7 +157,7 @@
 static int req_sim_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){
@@ -297,7 +297,7 @@
 static int req_sim_lock_state_get(int *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){
@@ -501,7 +501,8 @@
 static int req_pin_puk_last_times_get(mbtk_pin_puk_last_times_t *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){
@@ -516,29 +517,33 @@
         goto exit;
     }
     mbtk_pin_puk_last_times_t 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:
@@ -546,6 +551,7 @@
     return err;
 }
 
+
 /*
 AT+CPOL?
 *EUICC: 1
@@ -555,7 +561,7 @@
 static int req_plmn_get(mbtk_plmn_info *info, 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){
diff --git a/mbtk/mbtk_rild_v2/src/ril_sms.c b/mbtk/mbtk_rild_v2/src/ril_sms.c
index 081ad01..c2c87d6 100755
--- a/mbtk/mbtk_rild_v2/src/ril_sms.c
+++ b/mbtk/mbtk_rild_v2/src/ril_sms.c
@@ -29,7 +29,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){
@@ -63,8 +63,8 @@
 */
 static int req_cmgf_set(int state, int *cme_err)
 {
-    printf("req_cmgf_set()-------------start\n");
-    printf("state:%d\n",state);
+    LOGD("req_cmgf_set()-------------start");
+    LOGD("state:%d",state);
     ATResponse *response = NULL;
     char cmd[30] = {0};
     if(state)
@@ -76,7 +76,7 @@
         strcpy(cmd, "AT+CMGF=0");
     }
 
-    printf("req_cmgf_set()----cmd:%s\n", cmd);
+    LOGD("req_cmgf_set()----cmd:%s", cmd);
     int err = at_send_command(cmd, &response);
 
     if (err < 0 || response->success == 0) {
@@ -127,7 +127,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){
@@ -226,15 +226,15 @@
 */
 static int req_cmgs_set(char *cmgs, char *reg, int len, int *cme_err)
 {
-    printf("req_cmgs_set()----------------start\n");
-    printf("cmgs:%s\n", cmgs);
+    LOGD("req_cmgs_set()----------------start");
+    LOGD("cmgs:%s", cmgs);
     ATResponse *response = NULL;
     char cmd[30] = {0};
 	char data[218] = {0};
 	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)
@@ -249,14 +249,21 @@
 		memcpy(data, src, data_len);
 		//LOG("[XIAORUI]req_cmgs_set()----------------data %s",data);
 	}
+    else
+    {
+        LOGD("cmgs param is error");
+        return -1;
+    }
+    LOGD("num:%s", pnum);
+    LOGD("data:%s", data);
 
 	sprintf(cmd, "AT+CMGS=%s", pnum);
-	LOG("cmd:%s,data:%s---------", cmd,data);
+    LOGD("cmd:%s", cmd);
 
 	if(strlen(cmd) > 0)
 	{
 		int err = at_send_command_sms(cmd, data, "+CMGS: ", &response);
-		printf("err:%d, response:%d\n", err, response->success);
+		LOGD("err:%d, response:%d", err, response->success);
 
 		if (err < 0 || response->success == 0) {
 	        *cme_err = at_get_cme_error(response);
@@ -265,7 +272,7 @@
 		char *line;
 		line = response->p_intermediates->line;
 		memcpy(reg, line, strlen(line));
-		printf("line:%s\n", line);
+		LOGD("line:%s", line);
 
 	}
     err = 0;
@@ -328,10 +335,10 @@
     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 );
@@ -368,7 +375,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){
@@ -424,7 +431,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;
 
@@ -512,8 +519,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:
@@ -530,7 +537,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){
@@ -563,10 +570,10 @@
     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);
@@ -596,10 +603,10 @@
     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);
@@ -631,8 +638,8 @@
     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);
@@ -839,7 +846,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_RIL_ERR_CME_NON)
                 {
                     if(cme_err != MBTK_RIL_ERR_CME_NON) {