utils: add little-endian swap helpers
[project/libubox.git] / blobmsg.h
index 44f1f3b..c4bf10d 100644 (file)
--- a/blobmsg.h
+++ b/blobmsg.h
@@ -180,7 +180,10 @@ static inline uint32_t blobmsg_get_u32(struct blob_attr *attr)
 
 static inline uint64_t blobmsg_get_u64(struct blob_attr *attr)
 {
-       return be64_to_cpu(*(uint64_t *) blobmsg_data(attr));
+       uint32_t *ptr = blobmsg_data(attr);
+       uint64_t tmp = ((uint64_t) be32_to_cpu(ptr[0])) << 32;
+       tmp |= be32_to_cpu(ptr[1]);
+       return tmp;
 }
 
 static inline char *blobmsg_get_string(struct blob_attr *attr)
@@ -189,6 +192,7 @@ static inline char *blobmsg_get_string(struct blob_attr *attr)
 }
 
 void *blobmsg_alloc_string_buffer(struct blob_buf *buf, const char *name, int maxlen);
+void *blobmsg_realloc_string_buffer(struct blob_buf *buf, int maxlen);
 void blobmsg_add_string_buffer(struct blob_buf *buf);
 
 /* blobmsg to json formatting */