NuttX: fixes for printing size_t and int64_t

Added definition of PRId64 for C99 compatibility.
Used %zd for portable wat to print size_t.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois 2015-06-19 11:28:47 -07:00
parent 1e46f44123
commit 63f7995b41
3 changed files with 6 additions and 3 deletions

View File

@ -115,6 +115,9 @@ typedef param_t px4_param_t;
#ifndef PRIu64
#define PRIu64 "llu"
#endif
#ifndef PRId64
#define PRId64 "lld"
#endif
/*
* POSIX Specific defines

View File

@ -174,7 +174,7 @@ decode_callback(bson_decoder_t decoder, void *private, bson_node_t node)
len = bson_decoder_data_pending(decoder);
if (len != strlen(sample_string) + 1) {
PX4_ERR("FAIL: decoder: string1 length %d wrong, expected %ld", len, strlen(sample_string) + 1);
PX4_ERR("FAIL: decoder: string1 length %d wrong, expected %zd", len, strlen(sample_string) + 1);
return 1;
}
@ -213,7 +213,7 @@ decode_callback(bson_decoder_t decoder, void *private, bson_node_t node)
len = bson_decoder_data_pending(decoder);
if (len != sizeof(sample_data)) {
PX4_ERR("FAIL: decoder: data1 length %d, expected %lu", len, sizeof(sample_data));
PX4_ERR("FAIL: decoder: data1 length %d, expected %zu", len, sizeof(sample_data));
return 1;
}

View File

@ -37,13 +37,13 @@
****************************************************************************/
#include <px4_config.h>
#include <px4_defines.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>