X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=blob.h;h=a092f5dabca6ac3bc3c9a6bc579ae58240dcaa6a;hp=595834dd9a392610982847f4150fb7cf78984155;hb=6a7fb7d8df308d18167051447fa489de389588df;hpb=4436338588cb317b5799d3aa3107d2cb0b6192cc diff --git a/blob.h b/blob.h index 595834d..a092f5d 100644 --- a/blob.h +++ b/blob.h @@ -39,6 +39,7 @@ enum { BLOB_ATTR_INT16, BLOB_ATTR_INT32, BLOB_ATTR_INT64, + BLOB_ATTR_DOUBLE, BLOB_ATTR_LAST }; @@ -191,7 +192,7 @@ extern void blob_set_raw_len(struct blob_attr *attr, unsigned int len); extern bool blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2); extern int blob_buf_init(struct blob_buf *buf, int id); extern void blob_buf_free(struct blob_buf *buf); -extern void blob_buf_grow(struct blob_buf *buf, int required); +extern bool blob_buf_grow(struct blob_buf *buf, int required); extern struct blob_attr *blob_new(struct blob_buf *buf, int id, int payload); extern void *blob_nest_start(struct blob_buf *buf, int id); extern void blob_nest_end(struct blob_buf *buf, void *cookie); @@ -240,7 +241,7 @@ blob_put_u64(struct blob_buf *buf, int id, uint64_t val) #define blob_put_int64 blob_put_u64 #define __blob_for_each_attr(pos, attr, rem) \ - for (pos = (void *) attr; \ + for (pos = (struct blob_attr *) attr; \ rem > 0 && (blob_pad_len(pos) <= rem) && \ (blob_pad_len(pos) >= sizeof(struct blob_attr)); \ rem -= blob_pad_len(pos), pos = blob_next(pos)) @@ -248,7 +249,7 @@ blob_put_u64(struct blob_buf *buf, int id, uint64_t val) #define blob_for_each_attr(pos, attr, rem) \ for (rem = attr ? blob_len(attr) : 0, \ - pos = attr ? blob_data(attr) : 0; \ + pos = (struct blob_attr *) (attr ? blob_data(attr) : NULL); \ rem > 0 && (blob_pad_len(pos) <= rem) && \ (blob_pad_len(pos) >= sizeof(struct blob_attr)); \ rem -= blob_pad_len(pos), pos = blob_next(pos))