Fix warning as error for V2
Change-Id: I70cfd971fda629011ba1be84fef15afea196d393
diff --git a/mbtk/test/libmbtk_ril/mbtk_ril_test.c b/mbtk/test/libmbtk_ril/mbtk_ril_test.c
index dc0c65d..a95e571 100755
--- a/mbtk/test/libmbtk_ril/mbtk_ril_test.c
+++ b/mbtk/test/libmbtk_ril/mbtk_ril_test.c
@@ -10,11 +10,16 @@
#include <string.h>
#include <fcntl.h>
#include <signal.h>
+#include <arpa/inet.h>
#include "mbtk_ril_api.h"
+#include "mbtk_str.h"
#define CLI_THREAD_MAX 3
+#define RIL_DEBUG_THREAD 0
+
+#if RIL_DEBUG_THREAD
typedef struct {
pthread_t pid;
bool is_running;
@@ -23,6 +28,7 @@
static ril_cli_thread_info_t cli_threads[CLI_THREAD_MAX];
static int cli_pid_index = 1;
+#endif
static void help()
{
@@ -84,6 +90,7 @@
printf("ims_reg: Get IMS register state.\n");
}
+#if RIL_DEBUG_THREAD
static void thread_exit_with_wait()
{
int i = 0;
@@ -101,11 +108,12 @@
i++;
}
}
+#endif
static void ril_ser_state_change_cb(const void* data, int data_len)
{
if(data) {
- uint8 *ptr = (const char*)data;
+ const uint8 *ptr = (const uint8*)data;
mbtk_ril_ser_state_enum state = (mbtk_ril_ser_state_enum)ptr[0];
printf("ril server state : %d.\n", state);
}
@@ -182,21 +190,27 @@
case SIGINT: // Ctrl + C
{
LOGI("Exit by SIGINT.\n");
+#if RIL_DEBUG_THREAD
thread_exit_with_wait();
+#endif
mbtk_ril_deinit();
exit(0);
}
case SIGQUIT: // Ctrl + \ (类似 SIGINT ,但要产生core文件)
{
LOGI("Exit by SIGQUIT.\n");
+#if RIL_DEBUG_THREAD
thread_exit_with_wait();
+#endif
mbtk_ril_deinit();
exit(0);
}
case SIGTERM:// 默认kill (同 SIGKILL ,但 SIGKILL 不可捕获)
{
LOGI("Exit by SIGTERM.\n");
+#if RIL_DEBUG_THREAD
thread_exit_with_wait();
+#endif
mbtk_ril_deinit();
exit(0);
}
@@ -218,6 +232,7 @@
}
}
+#if RIL_DEBUG_THREAD
static char* thread_id2name(pthread_t pid)
{
int i = 0;
@@ -255,6 +270,7 @@
printf("[%s] exit.\n", thread_id2name(cli->pid));
return NULL;
}
+#endif
int main(int argc, char *argv[])
{
@@ -298,7 +314,7 @@
mbtk_ecall_state_change_cb_reg(ecall_state_change_cb);
-#if 0
+#if RIL_DEBUG_THREAD
memset(cli_threads, 0, sizeof(ril_cli_thread_info_t) * CLI_THREAD_MAX);
pthread_t pid1, pid2, pid3;
@@ -739,10 +755,10 @@
// printf("APN : %d, %s, %s\n", apns.apns[i].cid, apn2str(apns.apns[i].ip_type), apns.apns[i].apn);
printf("APN : %d, %s, auth-%d, auto_save-%d, auto_boot_call-%d, %s, %s, %s, %s\n", apns.apns[i].cid, apn2str(apns.apns[i].ip_type),
apns.apns[i].auth, apns.apns[i].auto_save, apns.apns[i].auto_boot_call,
- str_empty(apns.apns[i].apn) ? "NULL" : apns.apns[i].apn,
- str_empty(apns.apns[i].user) ? "NULL" : apns.apns[i].user,
- str_empty(apns.apns[i].pass) ? "NULL" : apns.apns[i].pass,
- str_empty(apns.apns[i].type) ? "NULL" : apns.apns[i].type);
+ str_empty(apns.apns[i].apn) ? "NULL" : (char*)apns.apns[i].apn,
+ str_empty(apns.apns[i].user) ? "NULL" : (char*)apns.apns[i].user,
+ str_empty(apns.apns[i].pass) ? "NULL" : (char*)apns.apns[i].pass,
+ str_empty(apns.apns[i].type) ? "NULL" : (char*)apns.apns[i].type);
i++;
}
printf("Def route : %d, def dns : %d\n", apns.cid_for_def_route, apns.cid_for_def_dns);
@@ -757,7 +773,7 @@
&def_route, &as_dns, apn.apn);
// Delete APN
- if(strcmp(apn.apn,"null") == 0 || strcmp(apn.apn,"NULL") == 0) {
+ if(strcmp((char*)apn.apn,"null") == 0 || strcmp((char*)apn.apn,"NULL") == 0) {
memset(apn.apn, 0, sizeof(apn.apn));
}
if(count == 7) {
@@ -1001,7 +1017,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();
if(err) {
@@ -1125,7 +1141,7 @@
char mem[100] = {0};
char resp[100] = {0};
if(!strcasecmp(cmd, "cpms")) { // Get
- err = mbtk_sms_cpms_get(&mem);
+ err = mbtk_sms_cpms_get(mem);
if(err) {
printf("Error : %d\n", err);
} else {
@@ -1484,9 +1500,10 @@
}
}
+#if RIL_DEBUG_THREAD
thread_exit_with_wait();
-
exit:
+#endif
mbtk_ril_deinit();
LOG("Client exec complete.");