blob/blobmsg: Perform explicit casts from void* to avoid compilation errors when using libubox from C++.

Signed-off by: Jacob Siverskog <jacob@teenageengineering.com>
This commit is contained in:
Jacob Siverskog 2014-05-09 14:31:37 +02:00 committed by Felix Fietkau
parent f32a53f92b
commit 4436338588
2 changed files with 4 additions and 4 deletions

2
blob.h
View file

@ -144,7 +144,7 @@ blob_get_u32(const struct blob_attr *attr)
static inline uint64_t static inline uint64_t
blob_get_u64(const struct blob_attr *attr) blob_get_u64(const struct blob_attr *attr)
{ {
uint32_t *ptr = blob_data(attr); uint32_t *ptr = (uint32_t *) blob_data(attr);
uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32; uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32;
tmp |= be32_to_cpu(ptr[1]); tmp |= be32_to_cpu(ptr[1]);
return tmp; return tmp;

View file

@ -65,7 +65,7 @@ static inline int blobmsg_type(const struct blob_attr *attr)
static inline void *blobmsg_data(const struct blob_attr *attr) static inline void *blobmsg_data(const struct blob_attr *attr)
{ {
struct blobmsg_hdr *hdr = (struct blobmsg_hdr *) blob_data(attr); struct blobmsg_hdr *hdr = (struct blobmsg_hdr *) blob_data(attr);
char *data = blob_data(attr); char *data = (char *) blob_data(attr);
if (blob_is_extended(attr)) if (blob_is_extended(attr))
data += blobmsg_hdrlen(be16_to_cpu(hdr->namelen)); data += blobmsg_hdrlen(be16_to_cpu(hdr->namelen));
@ -191,7 +191,7 @@ static inline uint32_t blobmsg_get_u32(struct blob_attr *attr)
static inline uint64_t blobmsg_get_u64(struct blob_attr *attr) static inline uint64_t blobmsg_get_u64(struct blob_attr *attr)
{ {
uint32_t *ptr = blobmsg_data(attr); uint32_t *ptr = (uint32_t *) blobmsg_data(attr);
uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32; uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32;
tmp |= be32_to_cpu(ptr[1]); tmp |= be32_to_cpu(ptr[1]);
return tmp; return tmp;
@ -199,7 +199,7 @@ static inline uint64_t blobmsg_get_u64(struct blob_attr *attr)
static inline char *blobmsg_get_string(struct blob_attr *attr) static inline char *blobmsg_get_string(struct blob_attr *attr)
{ {
return blobmsg_data(attr); return (char *) blobmsg_data(attr);
} }
void *blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, unsigned int maxlen); void *blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, unsigned int maxlen);