Fix code warning.
Change-Id: Ib11fb49f528d3688351ae349d5b4e307c28b3967
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) {