db845c: qcom: Fix pointer arithmetic warnings.
Building the qcom tools, we see a lot of the following:
warning: arithmetic on a pointer to void is a GNU extension
Fix this by casting the void* ptrs to char* when doing pointer
arithmatic.
Change-Id: Id2b0098388406bfc434ee01344a39e3413cb281c
Signed-off-by: John Stultz <john.stultz@linaro.org>
diff --git a/qcom/qrtr/lib/qmi.c b/qcom/qrtr/lib/qmi.c
index 88f81d8..f1c0293 100644
--- a/qcom/qrtr/lib/qmi.c
+++ b/qcom/qrtr/lib/qmi.c
@@ -249,8 +249,8 @@
LOGW("%s: STRUCT Encode failure\n", __func__);
return rc;
}
- buf_dst = buf_dst + rc;
- buf_src = buf_src + temp_ei->elem_size;
+ buf_dst = (char*)buf_dst + rc;
+ buf_src = (char*)buf_src + temp_ei->elem_size;
encoded_bytes += rc;
}
@@ -310,7 +310,7 @@
encoded_bytes += rc;
}
- rc = qmi_encode_basic_elem(buf_dst + encoded_bytes, buf_src,
+ rc = qmi_encode_basic_elem((char*)buf_dst + encoded_bytes, buf_src,
string_len, temp_ei->elem_size);
encoded_bytes += rc;
@@ -354,7 +354,7 @@
buf_dst = buf_dst + (TLV_LEN_SIZE + TLV_TYPE_SIZE);
while (temp_ei->data_type != QMI_EOTI) {
- buf_src = in_c_struct + temp_ei->offset;
+ buf_src = (char*)in_c_struct + temp_ei->offset;
tlv_type = temp_ei->tlv_type;
if (temp_ei->array_type == NO_ARRAY) {
@@ -522,8 +522,8 @@
tlv_len - decoded_bytes, dec_level);
if (rc < 0)
return rc;
- buf_src = buf_src + rc;
- buf_dst = buf_dst + temp_ei->elem_size;
+ buf_src = (char*)buf_src + rc;
+ buf_dst = (char*)buf_dst + temp_ei->elem_size;
decoded_bytes += rc;
}
@@ -585,7 +585,7 @@
return -EFAULT;
}
- rc = qmi_decode_basic_elem(buf_dst, buf_src + decoded_bytes,
+ rc = qmi_decode_basic_elem(buf_dst, (char*)buf_src + decoded_bytes,
string_len, temp_ei->elem_size);
*((char *)buf_dst + string_len) = '\0';
decoded_bytes += rc;
@@ -654,7 +654,7 @@
tlv_pointer = buf_src;
QMI_ENCDEC_DECODE_TLV(&tlv_type,
&tlv_len, tlv_pointer);
- buf_src += (TLV_TYPE_SIZE + TLV_LEN_SIZE);
+ buf_src = (uint8_t*)buf_src + (TLV_TYPE_SIZE + TLV_LEN_SIZE);
decoded_bytes += (TLV_TYPE_SIZE + TLV_LEN_SIZE);
temp_ei = find_ei(ei_array, tlv_type);
if (!temp_ei && tlv_type < OPTIONAL_TLV_TYPE_START) {
@@ -673,11 +673,11 @@
tlv_len = in_buf_len - decoded_bytes;
}
- buf_dst = out_c_struct + temp_ei->offset;
+ buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
if (temp_ei->data_type == QMI_OPT_FLAG) {
memcpy(buf_dst, &opt_flag_value, sizeof(uint8_t));
temp_ei = temp_ei + 1;
- buf_dst = out_c_struct + temp_ei->offset;
+ buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
}
if (temp_ei->data_type == QMI_DATA_LEN) {
@@ -687,7 +687,7 @@
1, data_len_sz);
memcpy(buf_dst, &data_len_value, sizeof(uint32_t));
temp_ei = temp_ei + 1;
- buf_dst = out_c_struct + temp_ei->offset;
+ buf_dst = (uint8_t*)out_c_struct + temp_ei->offset;
tlv_len -= data_len_sz;
UPDATE_DECODE_VARIABLES(buf_src, decoded_bytes, rc);
}
@@ -777,7 +777,7 @@
/* Encode message, if we have a message */
if (c_struct) {
- msglen = qmi_encode(ei, pkt->data + sizeof(*hdr), c_struct,
+ msglen = qmi_encode(ei, (char*)pkt->data + sizeof(*hdr), c_struct,
pkt->data_len - sizeof(*hdr), 1);
if (msglen < 0)
return msglen;
@@ -839,7 +839,7 @@
if (txn)
*txn = hdr->txn_id;
- return qmi_decode(ei, c_struct, pkt->data + sizeof(*hdr), pkt->data_len - sizeof(*hdr), 1);
+ return qmi_decode(ei, c_struct, (char*)pkt->data + sizeof(*hdr), pkt->data_len - sizeof(*hdr), 1);
}
/* Common header in all QMI responses */
diff --git a/qcom/rmtfs/sharedmem.c b/qcom/rmtfs/sharedmem.c
index a1301da..b6d3279 100644
--- a/qcom/rmtfs/sharedmem.c
+++ b/qcom/rmtfs/sharedmem.c
@@ -348,7 +348,7 @@
if (start < rmem->address || end > rmem->address + rmem->size)
return NULL;
- return rmem->base + phys_address - rmem->address;
+ return (char*)rmem->base + phys_address - rmem->address;
}
ssize_t rmtfs_mem_read(struct rmtfs_mem *rmem, unsigned long phys_address, void *buf, ssize_t len)
diff --git a/qcom/rmtfs/storage.c b/qcom/rmtfs/storage.c
index 4c78ab3..c8e69ed 100644
--- a/qcom/rmtfs/storage.c
+++ b/qcom/rmtfs/storage.c
@@ -203,13 +203,13 @@
} else {
n = MIN(nbyte, rmtfd->shadow_len - offset);
if (n > 0)
- memcpy(buf, rmtfd->shadow_buf + offset, n);
+ memcpy(buf, (char*)rmtfd->shadow_buf + offset, n);
else
n = 0;
}
if (n < nbyte)
- memset(buf + n, 0, nbyte - n);
+ memset((char*)buf + n, 0, nbyte - n);
return nbyte;
}
@@ -239,7 +239,7 @@
rmtfd->shadow_len = new_len;
}
- memcpy(rmtfd->shadow_buf + offset, buf, nbyte);
+ memcpy((char*)rmtfd->shadow_buf + offset, buf, nbyte);
return nbyte;
}