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