Commit graph

187 commits

Author SHA1 Message Date
Felix Fietkau
682e909819 utils.h: make 16-bit little endian conversion robust against pointer subtraction arguments
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-14 22:02:56 +01:00
Felix Fietkau
6eafe8e5fc utils: add little-endian swap helpers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-13 12:35:19 +01:00
Felix Fietkau
ed30207be0 utils: prefer using gccs builtin swapping functions which support constant folding
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-11 22:08:07 +01:00
Felix Fietkau
a61bc26a34 utils: move endian swap helpers and __packed definition to utils.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-11 21:46:41 +01:00
Felix Fietkau
1bfb299cbd blobmsg: add blobmsg_realloc_string_buffer()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-10 20:43:51 +01:00
Felix Fietkau
27d3551150 blob: add blob_buf_grow()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-02-10 20:43:33 +01:00
Felix Fietkau
0585f91c4e blobmsg_json: fix buffer growing on blobmsg json formatting 2013-01-29 23:07:10 +01:00
Felix Fietkau
412b300935 blob/blobmsg: use 32 bit load/store for 64 bit access, unaligned attributes cause data corruption on ARM
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-23 02:41:20 +01:00
Felix Fietkau
a5794deb7c blobmsg: add blobmsg_get_string
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13 15:29:14 +01:00
Felix Fietkau
42df438866 list_compat.h: add copyright info
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-13 09:49:16 +01:00
Felix Fietkau
1cd37b0860 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
a0562bff3c 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
c395304fe5 blobmsg: add blobmsg_parse_array()
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-08 02:05:03 +01:00
Felix Fietkau
bfdf3923c5 uloop: add a clock_gettime() implementation for mac os x
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-06 02:42:58 +01:00
Felix Fietkau
c247bd6c53 blobmsg_json: export blobmsg_add_object
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-06 02:15:48 +01:00
Felix Fietkau
d675f84c1b utils: add BUILD_BUG_ON (similar to the one in the linux kernel)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2013-01-01 16:10:44 +01:00
Felix Fietkau
1c52d2b0f3 utils: make it unnecessary to specify the last NULL argument for calloc_a
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-31 15:40:12 +01:00
Felix Fietkau
ead6099e0e utils: move ARRAY_SIZE from uloop to utils.h
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-31 15:24:27 +01:00
Felix Fietkau
b36b07bdd5 add utils.c, containing a calloc-like function to allocate multiple chunks with different sizes in one block and return pointers
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-31 15:24:26 +01:00
Felix Fietkau
0c408bb982 blob.h: fix endian check
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2012-12-02 17:49:12 +01:00
Felix Fietkau
6cba6caa29 add a cmake file for the examples and add the binaries to .gitignore 2012-10-21 23:01:30 +02:00
Felix Fietkau
9b0460ab9c 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
d3edff8434 blobmsg: add blobmsg_check_attr_list() to validate element types of arrays and tables 2012-06-24 21:07:47 +02:00
Felix Fietkau
7099131386 blob: add blob_memdup() 2012-06-01 20:54:20 +02:00
Felix Fietkau
53a8ac24dc remove uapi.h, afacis nothing uses it 2012-05-26 18:04:34 +02:00
Felix Fietkau
6ae097aef9 switch blobmsg_json over to permissive license 2012-05-26 18:03:08 +02:00
Felix Fietkau
286a94910d switch blobmsg over to permissive license 2012-05-26 18:02:30 +02:00
Felix Fietkau
1ef5e5b618 add blobmsg_add_blob() to copy over an existing blobmsg attribute 2012-05-08 15:59:19 +02:00
Felix Fietkau
f86133b987 blobmsg: add missing endian conversions 2011-11-17 00:47:54 +01:00
Felix Fietkau
b9a4fefcd4 blobmsg_json: print int16 elements in blobmsg_format_element (patch by Luka Perkov) 2011-11-17 00:40:37 +01:00
Felix Fietkau
1c0c4699bc blob: switch to ISC license, switch blob_{get,put}_int* to _u*, add wrappers 2011-11-10 09:05:33 +01:00
Felix Fietkau
811d3e3c05 make casts from void * explicit to avoid C++ warnings (patch by Arthur Davis) 2011-10-27 10:16:56 +02:00
Felix Fietkau
3e31d7ee21 fix more instances of uninitialized padding bytes 2011-10-06 17:57:13 +02:00
Felix Fietkau
8ef12741d4 blobmsg: fill padding between name and data 2011-10-06 17:19:28 +02:00
Felix Fietkau
a4ce44189d make the blobmsg format endian agnostic (stick to big-endian) 2011-10-06 17:15:00 +02:00
Felix Fietkau
e41f1d9a7d fill padding bytes when setting raw attribute length 2011-10-06 17:14:44 +02:00
Felix Fietkau
22d4c17601 explicitly zero extra buffer space added with realloc to silence valgrind warnings 2011-10-03 12:41:51 +02:00
Felix Fietkau
2c4cd375d2 fix reads beyond the end of the buffer when iterating over blob attributes 2011-10-03 12:36:46 +02:00
Felix Fietkau
d020dd5f2c add a blobmsg_type() inline function 2011-09-12 13:37:53 +02:00
Felix Fietkau
982fbc228a add blobmsg_get_bool 2011-09-07 06:33:36 +02:00
Felix Fietkau
bf27142190 blob_attr_equal: un-inline, add pointer checks 2011-09-05 06:25:51 +02:00
Felix Fietkau
5a2dadea3b add blob_attr_equal() for comparing attributes 2011-09-05 06:09:32 +02:00
Felix Fietkau
ed949b020c 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
f73925d603 add blob_buf_free 2011-07-29 19:38:30 +02:00
Felix Fietkau
4609b27c8e add BLOBMSG_TYPE_BOOL as an alias for BLOBMSG_TYPE_INT8 2011-07-29 12:56:48 +02:00
Felix Fietkau
68a4ba2c82 blobmsg_json: support indenting of output data 2011-07-18 13:04:23 +02:00
Felix Fietkau
69062857b9 add jshn 2011-05-23 22:21:27 +02:00
Felix Fietkau
656138e5f6 remove int16, use int8 as bool instead of integer 2011-03-27 01:08:51 +01:00
Felix Fietkau
c04feb1bcc add a cast to fix 64 bit issues 2011-02-07 20:30:52 +01:00
Felix Fietkau
84448556c4 validate blobmsg attributes before converting them to json 2011-02-07 17:47:02 +01:00