John Crispin
c83a84afbe
fix segfault when passed blobmsg attr is NULL
...
Signed-off-by: John Crispin <john@phrozen.org>
2018-07-25 10:30:05 +02:00
André Gaul
7f671b1e68
blobmsg: add support for double
...
This adds support for double floating point type to make it more JSON
compatible. For type checking it also adds a stub BLOB_ATTR_DOUBLE type.
If necessary, the accessor functions for blob can be added later
Signed-off-by: André Gaul <andre@gaul.io>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2017-01-04 21:36:31 +01:00
Matthias Schiffer
1f019ceea1
Fix various memory management issues
...
Consistently handle allocation failures. Some functions are changed to
return bool or int instead of void to allow returning an error.
Also fix a buffer size miscalculation in lua/uloop and use _exit() instead
of exit() on errors after forking.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2016-06-26 12:53:51 +02:00
Yousong Zhou
7f1ce63a84
blobmsg: remove unneeded assignment in blobmsg_alloc_string_buffer().
...
data_dest should already be assigned by blobmsg_new() if the return
value is not NULL.
Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
2014-12-11 17:58:29 +01:00
ewolfok
22bbcfddd7
blob: improve out-of-memory handling
...
Signed-off-by: Chen Bin <ewolfok@126.com>
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-26 03:50:50 +02:00
Felix Fietkau
7ba1f8acd8
blobmsg: add blobmsg_check_array, which returns the size of the array
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-07-15 10:52:12 +02:00
Felix Fietkau
d07b174de8
blobmsg: make length variables unsigned
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-27 16:32:09 +02:00
Felix Fietkau
93a4cb92c1
blobmsg: remove unnecessary initialization
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 20:20:36 +02:00
Felix Fietkau
58aec3c59a
blobmsg: allow data/length iterator/accessor functions to work on non-blobmsg elements
...
This primarily helps with simplifying the ubus APIs.
blobmsg header presence is indicated by the BLOB_ATTR_EXTENDED bit in
the id_len field.
This changes the format ABI, but not the API.
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-12 20:18:12 +01:00
Felix Fietkau
458c3937bc
blob: add a magic offset to nesting cookies to ensure that NULL is never returned as a normal value
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-16 01:22:02 +02:00
Felix Fietkau
af2f52a37b
blobmsg: implement blobmsg_printf and blobmsg_vprintf
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-17 16:42:12 +01:00
Felix Fietkau
4ab499899c
blobmsg: add blobmsg_realloc_string_buffer()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-10 20:43:51 +01:00
Felix Fietkau
1ec5b85848
blobmsg: fix blobmsg_parse_array, drop name field requirement
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13 09:07:32 +01:00
Felix Fietkau
4b5f278195
blobmsg: allow BLOBMSG_TYPE_UNSPEC attributes, treat them as null for JSON conversion
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13 09:02:51 +01:00
Felix Fietkau
2f74dbad14
blobmsg: add blobmsg_parse_array()
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-08 02:05:03 +01:00
Felix Fietkau
bbdc3bdb05
blobmsg: remove the unnecessary name argument from blobmsg_check_attr_list, infer it from the list type
2012-06-24 21:11:06 +02:00
Felix Fietkau
f1494cde4d
blobmsg: add blobmsg_check_attr_list() to validate element types of arrays and tables
2012-06-24 21:07:47 +02:00
Felix Fietkau
74cdaf796f
switch blobmsg over to permissive license
2012-05-26 18:02:30 +02:00
Felix Fietkau
51711be625
fix more instances of uninitialized padding bytes
2011-10-06 17:57:13 +02:00
Felix Fietkau
7c80b7c514
blobmsg: fill padding between name and data
2011-10-06 17:19:28 +02:00
Felix Fietkau
08aada9a93
make the blobmsg format endian agnostic (stick to big-endian)
2011-10-06 17:15:00 +02:00
Felix Fietkau
1d3e4ccb6a
fix a bug in blobmsg_parse
...
a second entry that has the same length as an existing found entry would
abort the parse loop (reported by Stefan Mächler)
2011-08-17 10:44:11 -07:00
Felix Fietkau
6bbde6e647
allow blobmsg_add_field to add arrays/tables
2011-02-07 01:12:07 +01:00
Felix Fietkau
0918243e90
move json formatting to the blobmsg_json library
2011-02-06 21:23:28 +01:00
Felix Fietkau
01ad5162b2
add a callback to the blobmsg-to-json function to override the formatting of specific attributes
2011-02-06 16:48:28 +01:00
Felix Fietkau
3bc18fcadc
blobmsg: fix dynamic string buffer length calculation
2011-02-06 02:07:26 +01:00
Felix Fietkau
29598e3dc8
add functions for allocating and adding a string buffer field
2011-02-04 21:57:59 +01:00
Felix Fietkau
3da4427fb5
fix json string formatting
2011-01-31 17:17:40 +01:00
Felix Fietkau
7a0571a9ff
blobmsg: constify and add more validation
2011-01-31 03:51:06 +01:00
Felix Fietkau
da2876acd9
add support for json-formatting blobmsg elements
2011-01-30 14:15:57 +01:00
Felix Fietkau
ff585b97c0
fix json list parsing
2011-01-30 01:13:32 +01:00
Felix Fietkau
5129bc9401
blobmsg: make arrays structually the same as tables - simplifies library user code
2011-01-29 18:00:40 +01:00
Felix Fietkau
d28eb7fc28
add a blobmsg-to-json function
2011-01-23 22:52:53 +01:00
Felix Fietkau
5e5abe33fe
improve validation - add header length
2011-01-23 20:32:57 +01:00
Felix Fietkau
71f0be5e11
add blobmsg validation function
2011-01-23 19:55:41 +01:00
Felix Fietkau
e82d74f898
Initial import
2010-10-13 21:29:08 +02:00