Add 'show' and 'test' verbs to the boardinfo command. Teach rcS how to use the new version.

This commit is contained in:
px4dev
2012-10-29 21:46:56 -07:00
parent 7203ba797e
commit 0616d58340
4 changed files with 159 additions and 16 deletions
+8 -3
View File
@@ -127,13 +127,18 @@ bson_decoder_init_buf(bson_decoder_t decoder, void *buf, unsigned bufsize, bson_
int32_t len;
/* argument sanity */
if ((buf == NULL) || (bufsize < 5) || (callback == NULL))
if ((buf == NULL) || (callback == NULL))
return -1;
decoder->fd = -1;
decoder->buf = (uint8_t *)buf;
decoder->dead = false;
decoder->bufsize = bufsize;
if (bufsize == 0) {
decoder->bufsize = *(uint32_t *)buf;
debug("auto-detected %u byte object", decoder->bufsize);
} else {
decoder->bufsize = bufsize;
}
decoder->bufpos = 0;
decoder->callback = callback;
decoder->private = private;
@@ -144,7 +149,7 @@ bson_decoder_init_buf(bson_decoder_t decoder, void *buf, unsigned bufsize, bson_
/* read and discard document size */
if (read_int32(decoder, &len))
CODER_KILL(decoder, "failed reading length");
if ((len > 0) && (len > (int)bufsize))
if ((len > 0) && (len > (int)decoder->bufsize))
CODER_KILL(decoder, "document length larger than buffer");
/* ready for decoding */
+3 -1
View File
@@ -134,7 +134,9 @@ __EXPORT int bson_decoder_init_file(bson_decoder_t decoder, int fd, bson_decoder
*
* @param decoder Decoder state structure to be initialised.
* @param buf Buffer to read from.
* @param bufsize Size of the buffer (BSON object may be smaller).
* @param bufsize Size of the buffer (BSON object may be smaller). May be
* passed as zero if the buffer size should be extracted from the
* BSON header only.
* @param callback Callback to be invoked by bson_decoder_next
* @param private Callback private data, stored in node.
* @return Zero on success.