Merge pull request #297 from simonduq/contrib/PRI
Use PRI macros for safe printf and logs
This commit is contained in:
commit
12432cbdd0
@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Include Project Specific conf */
|
/* Include Project Specific conf */
|
||||||
#ifdef PROJECT_CONF_PATH
|
#ifdef PROJECT_CONF_PATH
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
#define CONTIKI_CONF_H
|
#define CONTIKI_CONF_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <inttypes.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Include Project Specific conf */
|
/* Include Project Specific conf */
|
||||||
#ifdef PROJECT_CONF_PATH
|
#ifdef PROJECT_CONF_PATH
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Include Project Specific conf */
|
/* Include Project Specific conf */
|
||||||
#ifdef PROJECT_CONF_PATH
|
#ifdef PROJECT_CONF_PATH
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#define CONTIKI_CONF_H
|
#define CONTIKI_CONF_H
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <inttypes.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Include Project Specific conf */
|
/* Include Project Specific conf */
|
||||||
#ifdef PROJECT_CONF_PATH
|
#ifdef PROJECT_CONF_PATH
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <inttypes.h>
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
/* Include Project Specific conf */
|
/* Include Project Specific conf */
|
||||||
#ifdef PROJECT_CONF_PATH
|
#ifdef PROJECT_CONF_PATH
|
||||||
|
@ -314,7 +314,7 @@ add_req_handler(const linkaddr_t *peer_addr,
|
|||||||
sizeof(sixp_pkt_cell_options_t) +
|
sizeof(sixp_pkt_cell_options_t) +
|
||||||
sizeof(sixp_pkt_num_cells_t) +
|
sizeof(sixp_pkt_num_cells_t) +
|
||||||
sizeof(sf_plugtest_cell_t))) {
|
sizeof(sf_plugtest_cell_t))) {
|
||||||
LOG_ERR("invalid Add Request length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Add Request length: %lu\n", (unsigned long)body_len);
|
||||||
}
|
}
|
||||||
assert(
|
assert(
|
||||||
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
|
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
|
||||||
@ -359,7 +359,7 @@ add_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
|
|||||||
struct tsch_slotframe *slotframe;
|
struct tsch_slotframe *slotframe;
|
||||||
|
|
||||||
if(body_len != 4) {
|
if(body_len != 4) {
|
||||||
LOG_ERR("invalid Add Response length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Add Response length: %lu\n", (unsigned long)body_len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -399,7 +399,7 @@ delete_req_handler(const linkaddr_t *peer_addr,
|
|||||||
sizeof(sixp_pkt_cell_options_t) +
|
sizeof(sixp_pkt_cell_options_t) +
|
||||||
sizeof(sixp_pkt_num_cells_t) +
|
sizeof(sixp_pkt_num_cells_t) +
|
||||||
sizeof(sf_plugtest_cell_t))) {
|
sizeof(sf_plugtest_cell_t))) {
|
||||||
LOG_ERR("invalid Delete Request length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Delete Request length: %lu\n", (unsigned long)body_len);
|
||||||
}
|
}
|
||||||
assert(
|
assert(
|
||||||
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
|
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
|
||||||
@ -446,7 +446,7 @@ delete_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
|
|||||||
uint16_t timeslot;
|
uint16_t timeslot;
|
||||||
|
|
||||||
if(body_len != 4) {
|
if(body_len != 4) {
|
||||||
LOG_ERR("invalid Delete Response length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Delete Response length: %lu\n", (unsigned long)body_len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,7 +489,7 @@ count_req_handler(const linkaddr_t *peer_addr,
|
|||||||
assert(peer_addr != NULL && body != NULL);
|
assert(peer_addr != NULL && body != NULL);
|
||||||
if(body_len != (sizeof(sixp_pkt_metadata_t) +
|
if(body_len != (sizeof(sixp_pkt_metadata_t) +
|
||||||
sizeof(sixp_pkt_cell_options_t))) {
|
sizeof(sixp_pkt_cell_options_t))) {
|
||||||
LOG_ERR("invalid Count Request length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Count Request length: %lu\n", (unsigned long)body_len);
|
||||||
}
|
}
|
||||||
assert(
|
assert(
|
||||||
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
|
sixp_pkt_get_cell_options(SIXP_PKT_TYPE_REQUEST,
|
||||||
@ -534,7 +534,7 @@ count_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
|
|||||||
sixp_pkt_total_num_cells_t total_num_cells;
|
sixp_pkt_total_num_cells_t total_num_cells;
|
||||||
|
|
||||||
if(body_len != 2) {
|
if(body_len != 2) {
|
||||||
LOG_ERR("invalid Count Response length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Count Response length: %lu\n", (unsigned long)body_len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ list_req_handler(const linkaddr_t *peer_addr,
|
|||||||
sizeof(sixp_pkt_reserved_t) +
|
sizeof(sixp_pkt_reserved_t) +
|
||||||
sizeof(sixp_pkt_offset_t) +
|
sizeof(sixp_pkt_offset_t) +
|
||||||
sizeof(sixp_pkt_max_num_cells_t))) {
|
sizeof(sixp_pkt_max_num_cells_t))) {
|
||||||
LOG_ERR("invalid List Request length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid List Request length: %lu\n", (unsigned long)body_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(
|
assert(
|
||||||
@ -679,7 +679,7 @@ clear_req_handler(const linkaddr_t *peer_addr,
|
|||||||
|
|
||||||
assert(peer_addr != NULL && body != NULL);
|
assert(peer_addr != NULL && body != NULL);
|
||||||
if(body_len != sizeof(sixp_pkt_metadata_t)) {
|
if(body_len != sizeof(sixp_pkt_metadata_t)) {
|
||||||
LOG_ERR("invalid Clear Request length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Clear Request length: %lu\n", (unsigned long)body_len);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL) {
|
if((slotframe = tsch_schedule_get_slotframe_by_handle(0)) == NULL) {
|
||||||
@ -717,7 +717,7 @@ clear_res_handler(const linkaddr_t *peer_addr, sixp_pkt_rc_t rc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(body_len != 0) {
|
if(body_len != 0) {
|
||||||
LOG_ERR("invalid Clear Response length: %u\n", (unsigned int)body_len);
|
LOG_ERR("invalid Clear Response length: %lu\n", (unsigned long)body_len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ multicast_send(void)
|
|||||||
PRINTF("Send to: ");
|
PRINTF("Send to: ");
|
||||||
PRINT6ADDR(&mcast_conn->ripaddr);
|
PRINT6ADDR(&mcast_conn->ripaddr);
|
||||||
PRINTF(" Remote Port %u,", uip_ntohs(mcast_conn->rport));
|
PRINTF(" Remote Port %u,", uip_ntohs(mcast_conn->rport));
|
||||||
PRINTF(" (msg=0x%08lx)", (unsigned long)uip_ntohl(*((uint32_t *)buf)));
|
PRINTF(" (msg=0x%08"PRIx32")", uip_ntohl(*((uint32_t *)buf)));
|
||||||
PRINTF(" %lu bytes\n", (unsigned long)sizeof(id));
|
PRINTF(" %lu bytes\n", (unsigned long)sizeof(id));
|
||||||
|
|
||||||
seq_id++;
|
seq_id++;
|
||||||
|
@ -347,7 +347,7 @@ heapmem_alloc(size_t size)
|
|||||||
chunk->line = line;
|
chunk->line = line;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
PRINTF("%s ptr %p size %u\n", __func__, GET_PTR(chunk), (unsigned)size);
|
PRINTF("%s ptr %p size %lu\n", __func__, GET_PTR(chunk), (unsigned long)size);
|
||||||
|
|
||||||
return GET_PTR(chunk);
|
return GET_PTR(chunk);
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,7 @@ progress_request(coap_request_state_t *state) {
|
|||||||
coap_serialize_message(request, state->transaction->message);
|
coap_serialize_message(request, state->transaction->message);
|
||||||
|
|
||||||
coap_send_transaction(state->transaction);
|
coap_send_transaction(state->transaction);
|
||||||
LOG_DBG("Requested #%lu (MID %u)\n", (unsigned long)state->block_num,
|
LOG_DBG("Requested #%"PRIu32" (MID %u)\n", state->block_num, request->mid);
|
||||||
request->mid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,8 +119,7 @@ coap_request_callback(void *callback_data, coap_message_t *response)
|
|||||||
/* this is only for counting BLOCK2 blocks.*/
|
/* this is only for counting BLOCK2 blocks.*/
|
||||||
++(state->block_num);
|
++(state->block_num);
|
||||||
} else {
|
} else {
|
||||||
LOG_WARN("WRONG BLOCK %lu/%lu\n", (unsigned long)res_block,
|
LOG_WARN("WRONG BLOCK %"PRIu32"/%"PRIu32"\n", res_block, state->block_num);
|
||||||
(unsigned long)state->block_num);
|
|
||||||
++block_error;
|
++block_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +507,7 @@ output_to_peer(struct dtls_context_t *ctx,
|
|||||||
struct uip_udp_conn *udp_connection = dtls_get_app_data(ctx);
|
struct uip_udp_conn *udp_connection = dtls_get_app_data(ctx);
|
||||||
LOG_DBG("output_to DTLS peer [");
|
LOG_DBG("output_to DTLS peer [");
|
||||||
LOG_DBG_6ADDR(&session->ipaddr);
|
LOG_DBG_6ADDR(&session->ipaddr);
|
||||||
LOG_DBG_("]:%u %d bytes\n", uip_ntohs(session->port), (int)len);
|
LOG_DBG_("]:%u %ld bytes\n", uip_ntohs(session->port), (long)len);
|
||||||
uip_udp_packet_sendto(udp_connection, data, len,
|
uip_udp_packet_sendto(udp_connection, data, len,
|
||||||
&session->ipaddr, session->port);
|
&session->ipaddr, session->port);
|
||||||
return len;
|
return len;
|
||||||
|
@ -528,7 +528,7 @@ coap_parse_message(coap_message_t *coap_pkt, uint8_t *data, uint16_t data_len)
|
|||||||
case COAP_OPTION_MAX_AGE:
|
case COAP_OPTION_MAX_AGE:
|
||||||
coap_pkt->max_age = coap_parse_int_option(current_option,
|
coap_pkt->max_age = coap_parse_int_option(current_option,
|
||||||
option_length);
|
option_length);
|
||||||
LOG_DBG_("Max-Age [%lu]\n", (unsigned long)coap_pkt->max_age);
|
LOG_DBG_("Max-Age [%"PRIu32"]\n", coap_pkt->max_age);
|
||||||
break;
|
break;
|
||||||
case COAP_OPTION_ETAG:
|
case COAP_OPTION_ETAG:
|
||||||
coap_pkt->etag_len = MIN(COAP_ETAG_LEN, option_length);
|
coap_pkt->etag_len = MIN(COAP_ETAG_LEN, option_length);
|
||||||
@ -638,7 +638,7 @@ coap_parse_message(coap_message_t *coap_pkt, uint8_t *data, uint16_t data_len)
|
|||||||
case COAP_OPTION_OBSERVE:
|
case COAP_OPTION_OBSERVE:
|
||||||
coap_pkt->observe = coap_parse_int_option(current_option,
|
coap_pkt->observe = coap_parse_int_option(current_option,
|
||||||
option_length);
|
option_length);
|
||||||
LOG_DBG_("Observe [%lu]\n", (unsigned long)coap_pkt->observe);
|
LOG_DBG_("Observe [%"PRId32"]\n", coap_pkt->observe);
|
||||||
break;
|
break;
|
||||||
case COAP_OPTION_BLOCK2:
|
case COAP_OPTION_BLOCK2:
|
||||||
coap_pkt->block2_num = coap_parse_int_option(current_option,
|
coap_pkt->block2_num = coap_parse_int_option(current_option,
|
||||||
@ -666,11 +666,11 @@ coap_parse_message(coap_message_t *coap_pkt, uint8_t *data, uint16_t data_len)
|
|||||||
break;
|
break;
|
||||||
case COAP_OPTION_SIZE2:
|
case COAP_OPTION_SIZE2:
|
||||||
coap_pkt->size2 = coap_parse_int_option(current_option, option_length);
|
coap_pkt->size2 = coap_parse_int_option(current_option, option_length);
|
||||||
LOG_DBG_("Size2 [%lu]\n", (unsigned long)coap_pkt->size2);
|
LOG_DBG_("Size2 [%"PRIu32"]\n", coap_pkt->size2);
|
||||||
break;
|
break;
|
||||||
case COAP_OPTION_SIZE1:
|
case COAP_OPTION_SIZE1:
|
||||||
coap_pkt->size1 = coap_parse_int_option(current_option, option_length);
|
coap_pkt->size1 = coap_parse_int_option(current_option, option_length);
|
||||||
LOG_DBG_("Size1 [%lu]\n", (unsigned long)coap_pkt->size1);
|
LOG_DBG_("Size1 [%"PRIu32"]\n", coap_pkt->size1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
LOG_DBG_("unknown (%u)\n", option_number);
|
LOG_DBG_("unknown (%u)\n", option_number);
|
||||||
|
@ -973,7 +973,7 @@ ra_input(void)
|
|||||||
default:
|
default:
|
||||||
LOG_DBG("Updating timer of prefix ");
|
LOG_DBG("Updating timer of prefix ");
|
||||||
LOG_DBG_6ADDR(&prefix->ipaddr);
|
LOG_DBG_6ADDR(&prefix->ipaddr);
|
||||||
LOG_DBG_(" new value %lu\n", (unsigned long)uip_ntohl(nd6_opt_prefix_info->validlt));
|
LOG_DBG_(" new value %"PRIu32"\n", uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||||
stimer_set(&prefix->vlifetime,
|
stimer_set(&prefix->vlifetime,
|
||||||
uip_ntohl(nd6_opt_prefix_info->validlt));
|
uip_ntohl(nd6_opt_prefix_info->validlt));
|
||||||
prefix->isinfinite = 0;
|
prefix->isinfinite = 0;
|
||||||
@ -1034,7 +1034,7 @@ ra_input(void)
|
|||||||
while(naddr-- > 0) {
|
while(naddr-- > 0) {
|
||||||
LOG_DBG("nameserver: ");
|
LOG_DBG("nameserver: ");
|
||||||
LOG_DBG_6ADDR(ip);
|
LOG_DBG_6ADDR(ip);
|
||||||
LOG_DBG_(" lifetime: %lx\n", (unsigned long)uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
LOG_DBG_(" lifetime: %"PRIx32"\n", uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
||||||
uip_nameserver_update(ip, uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
uip_nameserver_update(ip, uip_ntohl(UIP_ND6_OPT_RDNSS_BUF->lifetime));
|
||||||
ip++;
|
ip++;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,7 @@ tsch_log_process_pending(void)
|
|||||||
if(log->rx.drift_used) {
|
if(log->rx.drift_used) {
|
||||||
printf(", dr %d", log->rx.drift);
|
printf(", dr %d", log->rx.drift);
|
||||||
}
|
}
|
||||||
printf(", edr %d\n", (int)log->rx.estimated_drift);
|
printf(", edr %d\n", log->rx.estimated_drift);
|
||||||
break;
|
break;
|
||||||
case tsch_log_message:
|
case tsch_log_message:
|
||||||
printf("%s\n", log->message);
|
printf("%s\n", log->message);
|
||||||
|
@ -767,7 +767,7 @@ perform_multi_resource_read_op(lwm2m_object_t *object,
|
|||||||
/* Now we need to initialize the object writing for this new object */
|
/* Now we need to initialize the object writing for this new object */
|
||||||
len = ctx->writer->init_write(ctx);
|
len = ctx->writer->init_write(ctx);
|
||||||
ctx->outbuf->len += len;
|
ctx->outbuf->len += len;
|
||||||
LOG_DBG("INIT WRITE len:%d size:%d\n", len, (int) ctx->outbuf->size);
|
LOG_DBG("INIT WRITE len:%d size:%"PRIu16"\n", len, ctx->outbuf->size);
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1516,10 +1516,10 @@ lwm2m_handler_callback(coap_message_t *request, coap_message_t *response,
|
|||||||
/* for debugging */
|
/* for debugging */
|
||||||
LOG_DBG("[");
|
LOG_DBG("[");
|
||||||
LOG_DBG_COAP_STRING(url, url_len);
|
LOG_DBG_COAP_STRING(url, url_len);
|
||||||
LOG_DBG_("] %s Format:%d ID:%d bsize:%u offset:%d\n",
|
LOG_DBG_("] %s Format:%d ID:%d bsize:%u offset:%"PRId32"\n",
|
||||||
get_method_as_string(coap_get_method_type(request)),
|
get_method_as_string(coap_get_method_type(request)),
|
||||||
format, context.object_id, buffer_size,
|
format, context.object_id, buffer_size,
|
||||||
offset != NULL ? ((int)*offset) : 0);
|
offset != NULL ? *offset : 0);
|
||||||
if(format == TEXT_PLAIN) {
|
if(format == TEXT_PLAIN) {
|
||||||
/* a string */
|
/* a string */
|
||||||
const uint8_t *data;
|
const uint8_t *data;
|
||||||
@ -1573,8 +1573,8 @@ lwm2m_handler_callback(coap_message_t *request, coap_message_t *response,
|
|||||||
if(success == LWM2M_STATUS_OK) {
|
if(success == LWM2M_STATUS_OK) {
|
||||||
/* Handle blockwise 1 */
|
/* Handle blockwise 1 */
|
||||||
if(coap_is_option(request, COAP_OPTION_BLOCK1)) {
|
if(coap_is_option(request, COAP_OPTION_BLOCK1)) {
|
||||||
LOG_DBG("Setting BLOCK 1 num:%d o2:%d o:%d\n", (int) bnum, (int) boffset,
|
LOG_DBG("Setting BLOCK 1 num:%"PRIu32" o2:%"PRIu32" o:%"PRId32"\n", bnum, boffset,
|
||||||
(int) (offset != NULL ? *offset : 0));
|
(offset != NULL ? *offset : 0));
|
||||||
coap_set_header_block1(response, bnum, 0, bsize);
|
coap_set_header_block1(response, bnum, 0, bsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,9 +219,9 @@ write_int(lwm2m_context_t *ctx, uint8_t *outbuf, size_t outlen,
|
|||||||
char *sep = (ctx->writer_flags & WRITER_OUTPUT_VALUE) ? "," : "";
|
char *sep = (ctx->writer_flags & WRITER_OUTPUT_VALUE) ? "," : "";
|
||||||
int len;
|
int len;
|
||||||
if(ctx->writer_flags & WRITER_RESOURCE_INSTANCE) {
|
if(ctx->writer_flags & WRITER_RESOURCE_INSTANCE) {
|
||||||
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"v\":%" PRId32 "}", sep, ctx->resource_id, ctx->resource_instance_id, value);
|
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u/%u\",\"v\":%"PRId32"}", sep, ctx->resource_id, ctx->resource_instance_id, value);
|
||||||
} else {
|
} else {
|
||||||
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"v\":%" PRId32 "}", sep, ctx->resource_id, value);
|
len = snprintf((char *)outbuf, outlen, "%s{\"n\":\"%u\",\"v\":%"PRId32"}", sep, ctx->resource_id, value);
|
||||||
}
|
}
|
||||||
if((len < 0) || (len >= outlen)) {
|
if((len < 0) || (len >= outlen)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -177,7 +177,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
|
|||||||
/* Handle the writes */
|
/* Handle the writes */
|
||||||
switch(ctx->resource_id) {
|
switch(ctx->resource_id) {
|
||||||
case LWM2M_SECURITY_SERVER_URI_ID:
|
case LWM2M_SECURITY_SERVER_URI_ID:
|
||||||
LOG_DBG("Writing security URI value: len: %d\n", (int)ctx->inbuf->size);
|
LOG_DBG("Writing security URI value: len: %"PRId16"\n", ctx->inbuf->size);
|
||||||
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->server_uri, LWM2M_SECURITY_URI_SIZE);
|
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->server_uri, LWM2M_SECURITY_URI_SIZE);
|
||||||
/* This is string... */
|
/* This is string... */
|
||||||
security->server_uri_len = ctx->last_value_len;
|
security->server_uri_len = ctx->last_value_len;
|
||||||
@ -204,7 +204,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
|
|||||||
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->public_key, LWM2M_SECURITY_KEY_SIZE);
|
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->public_key, LWM2M_SECURITY_KEY_SIZE);
|
||||||
security->public_key_len = ctx->last_value_len;
|
security->public_key_len = ctx->last_value_len;
|
||||||
|
|
||||||
LOG_DBG("Writing client PKI: len: %d '", (int)ctx->last_value_len);
|
LOG_DBG("Writing client PKI: len: %"PRIu16" '", ctx->last_value_len);
|
||||||
LOG_DBG_COAP_STRING((const char *)security->public_key,
|
LOG_DBG_COAP_STRING((const char *)security->public_key,
|
||||||
ctx->last_value_len);
|
ctx->last_value_len);
|
||||||
LOG_DBG_("'\n");
|
LOG_DBG_("'\n");
|
||||||
@ -213,7 +213,7 @@ lwm2m_callback(lwm2m_object_instance_t *object,
|
|||||||
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->secret_key, LWM2M_SECURITY_KEY_SIZE);
|
value = lwm2m_object_read_string(ctx, ctx->inbuf->buffer, ctx->inbuf->size, security->secret_key, LWM2M_SECURITY_KEY_SIZE);
|
||||||
security->secret_key_len = ctx->last_value_len;
|
security->secret_key_len = ctx->last_value_len;
|
||||||
|
|
||||||
LOG_DBG("Writing secret key: len: %d '", (int)ctx->last_value_len);
|
LOG_DBG("Writing secret key: len: %"PRIu16" '", ctx->last_value_len);
|
||||||
LOG_DBG_COAP_STRING((const char *)security->secret_key,
|
LOG_DBG_COAP_STRING((const char *)security->secret_key,
|
||||||
ctx->last_value_len);
|
ctx->last_value_len);
|
||||||
LOG_DBG_("'\n");
|
LOG_DBG_("'\n");
|
||||||
|
@ -205,7 +205,7 @@ lwm2m_tlv_write_int32(uint8_t type, int16_t id, int32_t value, uint8_t *buffer,
|
|||||||
int i;
|
int i;
|
||||||
int v;
|
int v;
|
||||||
int last_bit;
|
int last_bit;
|
||||||
LOG_DBG("Exporting int32 %d %ld ", id, (long)value);
|
LOG_DBG("Exporting int32 %d %"PRId32" ", id, value);
|
||||||
|
|
||||||
v = value < 0 ? -1 : 0;
|
v = value < 0 ? -1 : 0;
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -252,9 +252,9 @@ lwm2m_tlv_write_float32(uint8_t type, int16_t id, int32_t value, int bits,
|
|||||||
e++;
|
e++;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_DBG("Sign: %d, Fraction: %06lx 0b", value < 0, (long)val);
|
LOG_DBG("Sign: %d, Fraction: %06"PRIx32" 0b", value < 0, val);
|
||||||
for(i = 0; i < 23; i++) {
|
for(i = 0; i < 23; i++) {
|
||||||
LOG_DBG_("%d", (int)((val >> (22 - i)) & 1));
|
LOG_DBG_("%"PRId32"", ((val >> (22 - i)) & 1));
|
||||||
}
|
}
|
||||||
LOG_DBG_("\nExp:%d\n", e);
|
LOG_DBG_("\nExp:%d\n", e);
|
||||||
|
|
||||||
@ -292,9 +292,9 @@ lwm2m_tlv_float32_to_fix(const lwm2m_tlv_t *tlv, int32_t *value, int bits)
|
|||||||
e = ((tlv->value[0] << 1) & 0xff) | (tlv->value[1] >> 7);
|
e = ((tlv->value[0] << 1) & 0xff) | (tlv->value[1] >> 7);
|
||||||
val = (((long)tlv->value[1] & 0x7f) << 16) | (tlv->value[2] << 8) | tlv->value[3];
|
val = (((long)tlv->value[1] & 0x7f) << 16) | (tlv->value[2] << 8) | tlv->value[3];
|
||||||
|
|
||||||
LOG_DBG("Sign: %d, Fraction: %06lx 0b", val < 0, (long)val);
|
LOG_DBG("Sign: %d, Fraction: %06"PRIx32" 0b", val < 0, val);
|
||||||
for(i = 0; i < 23; i++) {
|
for(i = 0; i < 23; i++) {
|
||||||
LOG_DBG_("%d", (int)((val >> (22 - i)) & 1));
|
LOG_DBG_("%"PRId32"", ((val >> (22 - i)) & 1));
|
||||||
}
|
}
|
||||||
LOG_DBG("\nExp:%d => %d\n", e, e - 127);
|
LOG_DBG("\nExp:%d => %d\n", e, e - 127);
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* \file
|
* \file
|
||||||
* This component forwards index calls using the generic index
|
* This component forwards index calls using the generic index
|
||||||
* API to specific implementations.
|
* API to specific implementations.
|
||||||
* \author
|
* \author
|
||||||
* Nicolas Tsiftes <nvt@sics.se>
|
* Nicolas Tsiftes <nvt@sics.se>
|
||||||
@ -241,7 +241,7 @@ index_delete(index_t *index, attribute_value_t *value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
db_result_t
|
db_result_t
|
||||||
index_get_iterator(index_iterator_t *iterator, index_t *index,
|
index_get_iterator(index_iterator_t *iterator, index_t *index,
|
||||||
attribute_value_t *min_value,
|
attribute_value_t *min_value,
|
||||||
attribute_value_t *max_value)
|
attribute_value_t *max_value)
|
||||||
{
|
{
|
||||||
@ -266,15 +266,15 @@ index_get_iterator(index_iterator_t *iterator, index_t *index,
|
|||||||
range = (unsigned long)max - min;
|
range = (unsigned long)max - min;
|
||||||
if(range > 0) {
|
if(range > 0) {
|
||||||
/*
|
/*
|
||||||
* Index structures that do not have a natural ability to handle
|
* Index structures that do not have a natural ability to handle
|
||||||
* range queries (e.g., a hash index) can nevertheless emulate them.
|
* range queries (e.g., a hash index) can nevertheless emulate them.
|
||||||
*
|
*
|
||||||
* The range query emulation attempts to look up the key for each
|
* The range query emulation attempts to look up the key for each
|
||||||
* value in the search range. If the search range is sparse, this
|
* value in the search range. If the search range is sparse, this
|
||||||
* iteration will incur a considerable overhead per found key.
|
* iteration will incur a considerable overhead per found key.
|
||||||
*
|
*
|
||||||
* Hence, the emulation is preferable when an external module wants
|
* Hence, the emulation is preferable when an external module wants
|
||||||
* to iterate over a narrow range of keys, for which the total
|
* to iterate over a narrow range of keys, for which the total
|
||||||
* search cost is smaller than that of an iteration over all tuples
|
* search cost is smaller than that of an iteration over all tuples
|
||||||
* in the relation.
|
* in the relation.
|
||||||
*/
|
*/
|
||||||
@ -294,7 +294,7 @@ index_get_iterator(index_iterator_t *iterator, index_t *index,
|
|||||||
iterator->max_value = *max_value;
|
iterator->max_value = *max_value;
|
||||||
iterator->next_item_no = 0;
|
iterator->next_item_no = 0;
|
||||||
|
|
||||||
PRINTF("DB: Acquired an index iterator for %s.%s over the range (%ld,%ld)\n",
|
PRINTF("DB: Acquired an index iterator for %s.%s over the range (%ld,%ld)\n",
|
||||||
index->rel->name, index->attr->name,
|
index->rel->name, index->attr->name,
|
||||||
min_value->u.long_value, max_value->u.long_value);
|
min_value->u.long_value, max_value->u.long_value);
|
||||||
|
|
||||||
@ -380,7 +380,7 @@ PROCESS_THREAD(db_indexer, ev, data)
|
|||||||
PRINTF("DB: Loading the index for %s.%s...\n",
|
PRINTF("DB: Loading the index for %s.%s...\n",
|
||||||
index->rel->name, index->attr->name);
|
index->rel->name, index->attr->name);
|
||||||
|
|
||||||
/* Project the values of the indexed attribute from all tuples in
|
/* Project the values of the indexed attribute from all tuples in
|
||||||
the relation, and insert them into the index again. */
|
the relation, and insert them into the index again. */
|
||||||
if(DB_ERROR(db_query(&handle, "SELECT %s FROM %s;", index->attr->name, index->rel->name))) {
|
if(DB_ERROR(db_query(&handle, "SELECT %s FROM %s;", index->attr->name, index->rel->name))) {
|
||||||
index->flags |= INDEX_LOAD_ERROR;
|
index->flags |= INDEX_LOAD_ERROR;
|
||||||
|
@ -105,7 +105,7 @@ db_result_t index_load(relation_t *, attribute_t *);
|
|||||||
db_result_t index_release(index_t *);
|
db_result_t index_release(index_t *);
|
||||||
db_result_t index_insert(index_t *, attribute_value_t *, tuple_id_t);
|
db_result_t index_insert(index_t *, attribute_value_t *, tuple_id_t);
|
||||||
db_result_t index_delete(index_t *, attribute_value_t *);
|
db_result_t index_delete(index_t *, attribute_value_t *);
|
||||||
db_result_t index_get_iterator(index_iterator_t *, index_t *,
|
db_result_t index_get_iterator(index_iterator_t *, index_t *,
|
||||||
attribute_value_t *, attribute_value_t *);
|
attribute_value_t *, attribute_value_t *);
|
||||||
tuple_id_t index_get_next(index_iterator_t *);
|
tuple_id_t index_get_next(index_iterator_t *);
|
||||||
int index_exists(attribute_t *);
|
int index_exists(attribute_t *);
|
||||||
|
@ -1094,7 +1094,7 @@ cfs_read(int fd, void *buf, unsigned size)
|
|||||||
|
|
||||||
fdp = &coffee_fd_set[fd];
|
fdp = &coffee_fd_set[fd];
|
||||||
file = fdp->file;
|
file = fdp->file;
|
||||||
|
|
||||||
if(fdp->io_flags & CFS_COFFEE_IO_ENSURE_READ_LENGTH) {
|
if(fdp->io_flags & CFS_COFFEE_IO_ENSURE_READ_LENGTH) {
|
||||||
while(fdp->offset + size > file->end) {
|
while(fdp->offset + size > file->end) {
|
||||||
((char *)buf)[--size] = '\0';
|
((char *)buf)[--size] = '\0';
|
||||||
|
@ -106,7 +106,7 @@ void
|
|||||||
ctimer_set_with_process(struct ctimer *c, clock_time_t t,
|
ctimer_set_with_process(struct ctimer *c, clock_time_t t,
|
||||||
void (*f)(void *), void *ptr, struct process *p)
|
void (*f)(void *), void *ptr, struct process *p)
|
||||||
{
|
{
|
||||||
PRINTF("ctimer_set %p %u\n", c, (unsigned)t);
|
PRINTF("ctimer_set %p %lu\n", c, (unsigned long)t);
|
||||||
c->p = p;
|
c->p = p;
|
||||||
c->f = f;
|
c->f = f;
|
||||||
c->ptr = ptr;
|
c->ptr = ptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user