Fix some compilation warnings
authorAlexander Tarasikov <alexander.tarasikov@gmail.com>
Wed, 25 Jul 2012 07:23:02 +0000 (11:23 +0400)
committerAlexander Tarasikov <alexander.tarasikov@gmail.com>
Wed, 25 Jul 2012 07:23:02 +0000 (11:23 +0400)
client.c
misc.c
net.c
samsung-ril.h
sec.c
sms.c
srs.c
ss.c
util.c

index 7f2b987..ee3e0bc 100644 (file)
--- a/client.c
+++ b/client.c
@@ -129,7 +129,7 @@ void *ril_client_thread(void *data)
                return 0;
        }
 
-       client = (struct ipc_client *) data;
+       client = (struct ril_client *) data;
 
        for(c = 5 ; c > 0 ; c--) {
                client->state = RIL_CLIENT_READY;
diff --git a/misc.c b/misc.c
index 2ef9e4f..b6d70bc 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -30,7 +30,8 @@ void ril_request_get_imei_send(RIL_Token t)
        unsigned char data;
 
        data = IPC_MISC_ME_SN_SERIAL_NUM;
-       ipc_fmt_send(IPC_MISC_ME_SN, IPC_TYPE_GET, (unsigned char *) &data, sizeof(data), reqGetId(t));
+       ipc_fmt_send(IPC_MISC_ME_SN, IPC_TYPE_GET,
+               (unsigned char *) &data, sizeof(data), reqGetId(t));
 }
 
 void ril_request_get_imei(RIL_Token t)
@@ -44,7 +45,7 @@ void ril_request_get_imei(RIL_Token t)
        ril_state.tokens.get_imei = t;
 
        if(ril_state.tokens.get_imeisv) {
-               LOGD("IMEISV token found: 0x%x", ril_state.tokens.get_imeisv);
+               LOGD("IMEISV token found: 0x%p", ril_state.tokens.get_imeisv);
 
                if(ril_state.radio_state != RADIO_STATE_OFF) {
                        ril_request_get_imei_send(ril_state.tokens.get_imei);
@@ -67,7 +68,7 @@ void ril_request_get_imeisv(RIL_Token t)
        ril_state.tokens.get_imeisv = t;
 
        if(ril_state.tokens.get_imei) {
-               LOGD("IMEI token found: 0x%x", ril_state.tokens.get_imei);
+               LOGD("IMEI token found: 0x%p", ril_state.tokens.get_imei);
 
                if(ril_state.radio_state != RADIO_STATE_OFF) {
                        ril_request_get_imei_send(ril_state.tokens.get_imei);
@@ -88,7 +89,8 @@ void ipc_misc_me_sn_imei(RIL_Token t, void *data, int length)
        imei_info = (struct ipc_misc_me_sn *) data;
 
        if(ril_state.tokens.get_imei != t) 
-               LOGE("IMEI tokens mismatch (0x%x and 0x%x)", ril_state.tokens.get_imei, t);
+               LOGE("IMEI tokens mismatch (0x%p and 0x%p)",
+                       ril_state.tokens.get_imei, t);
 
        if(imei_info->length > 32)
                return;
@@ -108,13 +110,15 @@ void ipc_misc_me_sn_imei(RIL_Token t, void *data, int length)
 
        // IMEI
        if(ril_state.tokens.get_imei) {
-               RIL_onRequestComplete(ril_state.tokens.get_imei, RIL_E_SUCCESS, imei, sizeof(char *));
+               RIL_onRequestComplete(ril_state.tokens.get_imei,
+                       RIL_E_SUCCESS, imei, sizeof(char *));
                ril_state.tokens.get_imei = 0;
        }
 
        // IMEI SV
        if(ril_state.tokens.get_imeisv) {
-               RIL_onRequestComplete(ril_state.tokens.get_imeisv, RIL_E_SUCCESS, imeisv, sizeof(char *));
+               RIL_onRequestComplete(ril_state.tokens.get_imeisv,
+                       RIL_E_SUCCESS, imeisv, sizeof(char *));
                ril_state.tokens.get_imeisv = 0;
        }
 }
@@ -128,7 +132,8 @@ void ipc_misc_me_sn(struct ipc_message_info *info)
                        ipc_misc_me_sn_imei(reqGetToken(info->aseq), info->data, info->length);
                        break;
                case IPC_MISC_ME_SN_SERIAL_NUM_SERIAL:
-                       LOGD("Got IPC_MISC_ME_SN_SERIAL_NUM_SERIAL: %s\n", me_sn_info->data);
+                       LOGD("Got IPC_MISC_ME_SN_SERIAL_NUM_SERIAL: %s\n",
+                               me_sn_info->data);
                        break;
        }
 }
@@ -147,18 +152,22 @@ void ril_request_baseband_version(RIL_Token t)
        if(ril_state.radio_state != RADIO_STATE_OFF) {
                data = 0xff;
 
-               ipc_fmt_send(IPC_MISC_ME_VERSION, IPC_TYPE_GET, (unsigned char *) &data, sizeof(data), reqGetId(t));
+               ipc_fmt_send(IPC_MISC_ME_VERSION, IPC_TYPE_GET,
+                       (unsigned char *) &data, sizeof(data), reqGetId(t));
        }
 }
 
 void ipc_misc_me_version(struct ipc_message_info *info)
 {
        char sw_version[33];
-       struct ipc_misc_me_version *version = (struct ipc_misc_me_version *) info->data;
+       struct ipc_misc_me_version *version =
+               (struct ipc_misc_me_version *) info->data;
        RIL_Token t = reqGetToken(info->aseq);
 
        if(ril_state.tokens.baseband_version != t) 
-               LOGE("Baseband tokens mismatch (0x%x and 0x%x)", ril_state.tokens.baseband_version, t);
+               LOGE("Baseband tokens mismatch (0x%p and 0x%p)",
+                       ril_state.tokens.baseband_version, t);
+       
 
        memcpy(sw_version, version->sw_version, 32);
        sw_version[32] = '\0';
@@ -195,7 +204,8 @@ void ipc_misc_me_imsi(struct ipc_message_info *info)
 
        if(info->length < 1) {
                LOGE("%s: zero data length", __FUNCTION__);
-               RIL_onRequestComplete(reqGetToken(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+               RIL_onRequestComplete(reqGetToken(info->aseq),
+                       RIL_E_GENERIC_FAILURE, NULL, 0);
                return;
        }
 
@@ -203,7 +213,8 @@ void ipc_misc_me_imsi(struct ipc_message_info *info)
 
        if(((int) info->length) < *imsi_length + 1) {
                LOGE("%s: missing IMSI data", __FUNCTION__);
-               RIL_onRequestComplete(reqGetToken(info->aseq), RIL_E_GENERIC_FAILURE, NULL, 0);
+               RIL_onRequestComplete(reqGetToken(info->aseq),
+                       RIL_E_GENERIC_FAILURE, NULL, 0);
                return;
        }
 
@@ -212,7 +223,8 @@ void ipc_misc_me_imsi(struct ipc_message_info *info)
        memcpy(imsi, ((unsigned char*) info->data) + 1, *imsi_length);
        imsi[*imsi_length] = '\0';
 
-       RIL_onRequestComplete(reqGetToken(info->aseq), RIL_E_SUCCESS, imsi, *imsi_length+1);
+       RIL_onRequestComplete(reqGetToken(info->aseq),
+               RIL_E_SUCCESS, imsi, *imsi_length+1);
 }
 
 void ipc_misc_time_info(struct ipc_message_info *info)
@@ -221,7 +233,9 @@ void ipc_misc_time_info(struct ipc_message_info *info)
        char str[128];
 
        sprintf(str, "%02u/%02u/%02u,%02u:%02u:%02u+%02d,%02d",
-               nitz->year, nitz->mon, nitz->day, nitz->hour, nitz->min, nitz->sec, nitz->tz, 0);
+               nitz->year, nitz->mon, nitz->day, nitz->hour,
+               nitz->min, nitz->sec, nitz->tz, 0);
 
-       RIL_onUnsolicitedResponse(RIL_UNSOL_NITZ_TIME_RECEIVED, str, strlen(str) + 1);
+       RIL_onUnsolicitedResponse(RIL_UNSOL_NITZ_TIME_RECEIVED,
+               str, strlen(str) + 1);
 }
diff --git a/net.c b/net.c
index e19fb5f..83ea129 100644 (file)
--- a/net.c
+++ b/net.c
@@ -217,9 +217,9 @@ int ril_tokens_net_get_data_waiting(void)
 void ril_tokens_net_state_dump(void)
 {
        LOGD("ril_tokens_net_state_dump:\n\
-       \tril_state.tokens.registration_state = 0x%x\n\
-       \tril_state.tokens.gprs_registration_state = 0x%x\n\
-       \tril_state.tokens.operator = 0x%x\n", ril_state.tokens.registration_state, ril_state.tokens.gprs_registration_state, ril_state.tokens.operator);
+       \tril_state.tokens.registration_state = 0x%p\n\
+       \tril_state.tokens.gprs_registration_state = 0x%p\n\
+       \tril_state.tokens.operator = 0x%p\n", ril_state.tokens.registration_state, ril_state.tokens.gprs_registration_state, ril_state.tokens.operator);
 }
 
 void ril_plmn_split(char *plmn_data, char **plmn, unsigned int *mcc, unsigned int *mnc)
@@ -323,7 +323,7 @@ void ril_plmn_string(char *plmn_data, char *response[3])
 void ril_request_operator(RIL_Token t)
 {
        char *response[3];
-       int i;
+       size_t i;
 
        // IPC_NET_REGISTRATION_STATE_ROAMING is the biggest valid value
        if(ril_state.netinfo.reg_state == IPC_NET_REGISTRATION_STATE_NONE ||
@@ -388,7 +388,7 @@ void ipc_net_current_plmn(struct ipc_message_info *message)
        struct ipc_net_current_plmn *plmndata = (struct ipc_net_current_plmn *) message->data;
 
        char *response[3];
-       int i;
+       size_t i;
 
        switch(message->type) {
                case IPC_TYPE_NOTI:
@@ -528,7 +528,7 @@ void ril_request_gprs_registration_state(RIL_Token t)
 {
        struct ipc_net_regist_get regist_req;
        char *response[4];
-       int i;
+       size_t i;
 
        if(ril_state.tokens.gprs_registration_state == RIL_TOKEN_DATA_WAITING) {
                LOGD("Got RILJ request for UNSOL data");
@@ -621,7 +621,7 @@ void ipc_net_regist_unsol(struct ipc_message_info *message)
 void ipc_net_regist_sol(struct ipc_message_info *message)
 {
        char *response[4];
-       int i;
+       size_t i;
 
        struct ipc_net_regist *netinfo = (struct ipc_net_regist *) message->data;
        RIL_Token t = reqGetToken(message->aseq);
index acb5077..d94d583 100644 (file)
@@ -27,7 +27,7 @@
 #include <telephony/ril.h>
 #include <radio.h>
 
-#include <cutils/log.h>
+#include <utils/Log.h>
 
 #ifndef LOGE
        #define LOGE ALOGE
@@ -276,6 +276,7 @@ void ril_request_enter_sim_pin(RIL_Token t, void *data, size_t datalen);
 void ril_request_change_sim_pin(RIL_Token t, void *data, size_t datalen);
 void ril_request_enter_sim_puk(RIL_Token t, void *data, size_t datalen);
 void ril_request_query_facility_lock(RIL_Token t, void *data, size_t datalen);
+void ipc_sec_phone_lock(struct ipc_message_info *info);
 void ipc_sec_phone_lock_complete(struct ipc_message_info *info);
 void ril_request_set_facility_lock(RIL_Token t, void *data, size_t datalen);
 
diff --git a/sec.c b/sec.c
index 46856ca..02083d8 100644 (file)
--- a/sec.c
+++ b/sec.c
@@ -191,7 +191,7 @@ void ipc2ril_card_status(struct ipc_sec_pin_status_response *pin_status, RIL_Car
 void ril_tokens_pin_status_dump(void)
 {
        LOGD("ril_tokens_pin_status_dump:\n\
-       \tril_state.tokens.pin_status = 0x%x\n", ril_state.tokens.pin_status);
+       \tril_state.tokens.pin_status = 0x%p\n", ril_state.tokens.pin_status);
 }
 
 /**
diff --git a/sms.c b/sms.c
index c594a3b..ce53d8a 100644 (file)
--- a/sms.c
+++ b/sms.c
@@ -229,7 +229,7 @@ void ril_request_sms_lock_release(void)
  */
 void ril_request_send_sms(RIL_Token t, void *data, size_t datalen)
 {
-       const char **request = (char **) data;
+       char **request = (char **) data;
        char *pdu = request[1];
        int pdu_len = pdu != NULL ? strlen(pdu) : 0;
        char *smsc = request[0];
@@ -372,7 +372,7 @@ void ril_request_send_sms_complete(RIL_Token t, char *pdu, char *smsc)
        LOGD("data_len is 0x%x + 0x%x + 0x%x = 0x%x\n", pdu_dec_len, smsc_len, send_msg_len, data_len);
 
        pdu_dec = malloc(pdu_dec_len);
-       hex2bin(pdu, pdu_len, pdu_dec);
+       hex2bin(pdu, pdu_len, (unsigned char*)pdu_dec);
 
        /* PDU operations */
        int pdu_tp_da_index = 2;
diff --git a/srs.c b/srs.c
index 3b4e26b..3c519ab 100644 (file)
--- a/srs.c
+++ b/srs.c
@@ -69,7 +69,8 @@ int srs_server_send_message(struct srs_server *srs_server, struct srs_message *m
        memset(data, 0, header.length);
 
        memcpy(data, &header, sizeof(header));
-       memcpy((void *) (data + sizeof(header)), message->data, message->data_len);
+       memcpy((void *) ((char*)data + sizeof(header)),
+               message->data, message->data_len);
 
        FD_ZERO(&fds);
        FD_SET(srs_server->client_fd, &fds);
@@ -107,7 +108,7 @@ int srs_server_recv(struct srs_server *srs_server, struct srs_message *message)
        int rc;
 
        rc = read(srs_server->client_fd, raw_data, SRS_DATA_MAX_SIZE);
-       if(rc < sizeof(struct srs_header)) {
+       if(rc < (int)sizeof(struct srs_header)) {
                return -1;
        }
 
@@ -117,7 +118,8 @@ int srs_server_recv(struct srs_server *srs_server, struct srs_message *message)
        message->data_len = header->length - sizeof(struct srs_header);
        message->data = malloc(message->data_len);
 
-       memcpy(message->data, raw_data + sizeof(struct srs_header), message->data_len);
+       memcpy(message->data, (char*)raw_data + sizeof(struct srs_header),
+               message->data_len);
 
        free(raw_data);
 
@@ -134,7 +136,8 @@ int srs_server_accept(struct srs_server *srs_server)
                return 0;
        }
 
-       client_fd = accept(srs_server->server_fd, (struct sockaddr_un *) &client_addr, &client_addr_len);
+       client_fd = accept(srs_server->server_fd,
+               (struct sockaddr*) &client_addr, &client_addr_len);
 
        if(client_fd > 0) {
                srs_server->client_fd = client_fd;
diff --git a/ss.c b/ss.c
index 3913afd..3201a21 100644 (file)
--- a/ss.c
+++ b/ss.c
@@ -61,9 +61,7 @@ void ril_request_send_ussd(RIL_Token t, void *data, size_t datalen)
                case IPC_SS_USSD_TIME_OUT:
                        LOGD("USSD Tx encoding is GSM7");
 
-                       data_enc_len = ascii2gsm7(data, &data_enc, datalen);
-                       // message_size = data_enc_len + sizeof(struct ipc_ss_ussd);
-
+                       data_enc_len = ascii2gsm7(data, (unsigned char**)&data_enc, datalen);
                        if(data_enc_len > message_size) {
                                LOGE("USSD message size is too long, aborting");
                                RIL_onRequestComplete(t, RIL_E_GENERIC_FAILURE, NULL, 0);
@@ -90,8 +88,7 @@ void ril_request_send_ussd(RIL_Token t, void *data, size_t datalen)
                default:
                        LOGD("USSD Tx encoding is ASCII");
 
-                       data_enc_len = asprintf(&data_enc, "%s", data);
-                       // message_size = data_enc_len + sizeof(struct ipc_ss_ussd);
+                       data_enc_len = asprintf(&data_enc, "%s", (char*)data);
 
                        if(data_enc_len > message_size) {
                                LOGE("USSD message size is too long, aborting");
diff --git a/util.c b/util.c
index 5150c82..9c08c5a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -20,6 +20,7 @@
 
 #include <stdio.h>
 #include <string.h>
+#include <ctype.h>
 
 #define LOG_TAG "RIL-UTIL"
 #include <utils/Log.h>