From 608fb5582b9cee1156ca92d2215036af1a7c26d3 Mon Sep 17 00:00:00 2001 From: Christian Mehlis Date: Sun, 16 Jun 2013 14:13:38 +0200 Subject: [PATCH] fix printf patterns --- sys/net/destiny/socket.c | 15 ++++++++------- sys/net/destiny/tcp.c | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sys/net/destiny/socket.c b/sys/net/destiny/socket.c index e66dbd7f1b..3feeb40665 100644 --- a/sys/net/destiny/socket.c +++ b/sys/net/destiny/socket.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "udp.h" #include "tcp.h" @@ -24,8 +25,8 @@ socket_internal_t sockets[MAX_SOCKETS]; void printf_tcp_context(tcp_hc_context_t *current_tcp_context) { printf("Context: %u\n", current_tcp_context->context_id); - printf("Rcv Seq: %lu Rcv Ack: %lu, Rcv Wnd: %u\n", current_tcp_context->seq_rcv, current_tcp_context->ack_rcv, current_tcp_context->wnd_rcv); - printf("Snd Seq: %lu Snd Ack: %lu, Snd Wnd: %u\n", current_tcp_context->seq_snd, current_tcp_context->ack_snd, current_tcp_context->wnd_snd); + printf("Rcv Seq: %" PRIu32 " Rcv Ack: %" PRIu32 ", Rcv Wnd: %u\n", current_tcp_context->seq_rcv, current_tcp_context->ack_rcv, current_tcp_context->wnd_rcv); + printf("Snd Seq: %" PRIu32 " Snd Ack: %" PRIu32 ", Snd Wnd: %u\n", current_tcp_context->seq_snd, current_tcp_context->ack_snd, current_tcp_context->wnd_snd); } void print_tcp_flags (tcp_hdr_t *tcp_header) @@ -76,9 +77,9 @@ void print_tcp_cb(tcp_cb_t *cb) { timex_t now; vtimer_now(&now); - printf("Send_ISS: %lu\nSend_UNA: %lu\nSend_NXT: %lu\nSend_WND: %u\n", cb->send_iss, cb->send_una, cb->send_nxt, cb->send_wnd); - printf("Rcv_IRS: %lu\nRcv_NXT: %lu\nRcv_WND: %u\n", cb->rcv_irs, cb->rcv_nxt, cb->rcv_wnd); - printf("Time difference: %lu, No_of_retries: %u, State: %u\n\n", timex_sub(now, cb->last_packet_time).microseconds, cb->no_of_retries, cb->state); + printf("Send_ISS: %" PRIu32 "\nSend_UNA: %" PRIu32 "\nSend_NXT: %" PRIu32 "\nSend_WND: %u\n", cb->send_iss, cb->send_una, cb->send_nxt, cb->send_wnd); + printf("Rcv_IRS: %" PRIu32 "\nRcv_NXT: %" PRIu32 "\nRcv_WND: %u\n", cb->rcv_irs, cb->rcv_nxt, cb->rcv_wnd); + printf("Time difference: %" PRIu32 ", No_of_retries: %u, State: %u\n\n", timex_sub(now, cb->last_packet_time).microseconds, cb->no_of_retries, cb->state); } void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_header, socket_t *tcp_socket) @@ -91,8 +92,8 @@ void print_tcp_status(int in_or_out, ipv6_hdr_t *ipv6_header, tcp_hdr_t *tcp_hea printf("TCP Length: %x\n", ipv6_header->length-TCP_HDR_LEN); printf("Source Port: %x, Dest. Port: %x\n", NTOHS(tcp_header->src_port), NTOHS(tcp_header->dst_port)); printf("Source Port: %u, Dest. Port: %u\n", NTOHS(tcp_header->src_port), NTOHS(tcp_header->dst_port)); - printf("ACK: %lx, SEQ: %lx, Window: %x\n", tcp_header->ack_nr, tcp_header->seq_nr, tcp_header->window); - printf("ACK: %lu, SEQ: %lu, Window: %u\n", tcp_header->ack_nr, tcp_header->seq_nr, tcp_header->window); + printf("ACK: %" PRIu32 ", SEQ: %" PRIu32 ", Window: %x\n", tcp_header->ack_nr, tcp_header->seq_nr, tcp_header->window); + printf("ACK: %" PRIu32 ", SEQ: %" PRIu32 ", Window: %u\n", tcp_header->ack_nr, tcp_header->seq_nr, tcp_header->window); print_tcp_flags(tcp_header); print_tcp_cb(&tcp_socket->tcp_control); #ifdef TCP_HC diff --git a/sys/net/destiny/tcp.c b/sys/net/destiny/tcp.c index 76cd6f4a50..8e2b8a48a4 100644 --- a/sys/net/destiny/tcp.c +++ b/sys/net/destiny/tcp.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "vtimer.h" #include "tcp_timer.h" @@ -23,12 +24,12 @@ void printTCPHeader(tcp_hdr_t *tcp_header) { printf("\nBEGIN: TCP HEADER\n"); - printf("ack_nr: %lu\n", tcp_header->ack_nr); + printf("ack_nr: %" PRIu32 "\n", tcp_header->ack_nr); printf("checksum: %i\n", tcp_header->checksum); printf("dataOffset_reserved: %i\n", tcp_header->dataOffset_reserved); printf("dst_port: %i\n", tcp_header->dst_port); printf("reserved_flags: %i\n", tcp_header->reserved_flags); - printf("seq_nr: %lu\n", tcp_header->seq_nr); + printf("seq_nr: %" PRIu32 "\n", tcp_header->seq_nr); printf("src_port: %i\n", tcp_header->src_port); printf("urg_pointer: %i\n", tcp_header->urg_pointer); printf("window: %i\n", tcp_header->window);