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
Matthias Schiffer
155bf39896
blobmsg_json: simplify add_separator and fix thread-safety
...
The hard-coded length limits are replaced with strlen to make the code more
robust.
Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
2016-04-06 17:43:47 +02:00
Jo-Philipp Wich
f43da92dd7
blobmsg_json: support json_type_null in blobmsg_add_json_element()
...
We already serialize BLOBMSG_TYPE_UNSPEC as "null" so represent JSON null
values as blob attribute type unspec with payload size zero.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
2016-02-09 23:30:32 +01:00
Felix Fietkau
6f2c688d68
blobmsg_json: include json.h inside blobmsg_json.c instead of the public header file
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-23 12:03:32 +02:00
Felix Fietkau
c8fc0897cd
avoid using the deprecated is_error() function from json-c
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-09-23 12:02:31 +02:00
Felix Fietkau
411d10c845
blobmsg_json: use cross-platform macro for fprintf on 64-bit values
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-05-31 14:48:03 +02:00
Felix Fietkau
131b3352d9
blobmsg_json: let blobmsg_format_json_with_cb with list == true also format arrays
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-26 10:59:00 +02:00
Felix Fietkau
31b2d244fd
blobmsg_json: fix a memleak on error
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-04-12 20:23:23 +02:00
Felix Fietkau
c78b684104
blobmsg_json: unconditionally use blobmsg data/len accessor functions
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2014-03-12 20:18:12 +01:00
Jo-Philipp Wich
f6827c7c93
blobmsg_json: do not emit any whitespace when formatting without indentation
2013-11-27 18:56:04 +00:00
Felix Fietkau
76906bec1c
blobmsg_json: allow signed output of integers
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-10-04 16:55:45 +02:00
Felix Fietkau
6f192a6fb0
blobmsg_json: do not corrupt UTF-8 strings
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-21 17:19:37 +02:00
Felix Fietkau
7c5d2b3081
blobmsg_json: fix \u escaping for control characters
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-06-21 17:06:34 +02:00
Felix Fietkau
54a0b49326
blobmsg_json: add blobmsg_add_json_from_file
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-05-29 12:14:48 +02:00
Felix Fietkau
0bc317aa4d
blobmsg_json: fix buffer growing on blobmsg json formatting
2013-01-29 23:07:10 +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
76f584c761
blobmsg_json: export blobmsg_add_object
...
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-06 02:15:48 +01:00
Felix Fietkau
6a2e4f449d
switch blobmsg_json over to permissive license
2012-05-26 18:03:08 +02:00
Felix Fietkau
f565a7af42
blobmsg: add missing endian conversions
2011-11-17 00:47:54 +01:00
Felix Fietkau
5ce9b8912f
blobmsg_json: print int16 elements in blobmsg_format_element (patch by Luka Perkov)
2011-11-17 00:40:37 +01:00
Felix Fietkau
abbc140e8d
add BLOBMSG_TYPE_BOOL as an alias for BLOBMSG_TYPE_INT8
2011-07-29 12:56:48 +02:00
Felix Fietkau
ed9b5c986b
blobmsg_json: support indenting of output data
2011-07-18 13:04:23 +02:00
Felix Fietkau
89122a2c1e
remove int16, use int8 as bool instead of integer
2011-03-27 01:08:51 +01:00
Felix Fietkau
1ef7c81dfc
add a cast to fix 64 bit issues
2011-02-07 20:30:52 +01:00
Felix Fietkau
81839e259a
validate blobmsg attributes before converting them to json
2011-02-07 17:47:02 +01:00
Felix Fietkau
a5e2b50652
properly null-terminate formatted json strings
2011-02-07 01:18:56 +01:00
Felix Fietkau
0918243e90
move json formatting to the blobmsg_json library
2011-02-06 21:23:28 +01:00
Felix Fietkau
be41614060
add missing copyright headers
2011-02-06 16:20:57 +01:00
Felix Fietkau
7e9712363b
add a json to blobmsg parsing library
2011-02-06 16:14:15 +01:00