Fix warning as error for V2
Change-Id: I70cfd971fda629011ba1be84fef15afea196d393
diff --git a/mbtk/libmbtk_lib_v2/ril/mbtk_pdu_sms.c b/mbtk/libmbtk_lib_v2/ril/mbtk_pdu_sms.c
index 05da8a8..c00a924 100755
--- a/mbtk/libmbtk_lib_v2/ril/mbtk_pdu_sms.c
+++ b/mbtk/libmbtk_lib_v2/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) {
diff --git a/mbtk/libmbtk_lib_v2/ril/ril_utils.c b/mbtk/libmbtk_lib_v2/ril/ril_utils.c
index 9c39019..236c06f 100755
--- a/mbtk/libmbtk_lib_v2/ril/ril_utils.c
+++ b/mbtk/libmbtk_lib_v2/ril/ril_utils.c
@@ -157,12 +157,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 = (const char*)strstr(ptr, ".");
if(ptr == NULL)
return -1;
ptr++;
@@ -183,8 +183,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;
}