Fix compiler warnings

This commit is contained in:
Vasily Evseenko 2017-04-07 14:47:52 +03:00
parent 6496b831b8
commit b3a3847765
2 changed files with 5 additions and 5 deletions

6
rx.cpp
View File

@ -395,14 +395,14 @@ void LocalAggregator::send_packet(int ring_idx, int fragment_idx)
if (packet_hdr->seq > seq + 1) if (packet_hdr->seq > seq + 1)
{ {
fprintf(stderr, "%d packets lost\n", packet_hdr->seq - seq - 1); fprintf(stderr, "%u packets lost\n", packet_hdr->seq - seq - 1);
} }
seq = packet_hdr->seq; seq = packet_hdr->seq;
if(packet_hdr->packet_size > MAX_PAYLOAD_SIZE) if(packet_hdr->packet_size > MAX_PAYLOAD_SIZE)
{ {
fprintf(stderr, "corrupted packet %d\n", seq); fprintf(stderr, "corrupted packet %u\n", seq);
}else{ }else{
send(sockfd, payload, packet_hdr->packet_size, 0); send(sockfd, payload, packet_hdr->packet_size, 0);
} }
@ -546,7 +546,7 @@ int main(int argc, char* const *argv)
}else{ }else{
throw runtime_error(string_format("Unknown rx_mode=%d", rx_mode)); throw runtime_error(string_format("Unknown rx_mode=%d", rx_mode));
} }
}catch(runtime_error e) }catch(runtime_error &e)
{ {
fprintf(stderr, "Error: %s\n", e.what()); fprintf(stderr, "Error: %s\n", e.what());
exit(1); exit(1);

4
tx.cpp
View File

@ -253,7 +253,7 @@ int main(int argc, char * const *argv)
fprintf(stderr, "Usage: %s [-m mavlink_agg_in_ms] [-k RS_K] [-n RS_N] [-u udp_port] [-r tx_rate] [-p radio_port] interface\n", fprintf(stderr, "Usage: %s [-m mavlink_agg_in_ms] [-k RS_K] [-n RS_N] [-u udp_port] [-r tx_rate] [-p radio_port] interface\n",
argv[0]); argv[0]);
fprintf(stderr, "Default: k=%d, n=%d, udp_port=%d, tx_rate=%d Mbit/s, radio_port=%d\n", k, n, udp_port, radio_rate, radio_port); fprintf(stderr, "Default: k=%d, n=%d, udp_port=%d, tx_rate=%d Mbit/s, radio_port=%d\n", k, n, udp_port, radio_rate, radio_port);
fprintf(stderr, "Radio MTU: %ld\n", MAX_PAYLOAD_SIZE); fprintf(stderr, "Radio MTU: %lu\n", MAX_PAYLOAD_SIZE);
exit(1); exit(1);
} }
} }
@ -274,7 +274,7 @@ int main(int argc, char * const *argv)
{ {
normal_rx(t, fd); normal_rx(t, fd);
} }
}catch(runtime_error e) }catch(runtime_error &e)
{ {
fprintf(stderr, "Error: %s\n", e.what()); fprintf(stderr, "Error: %s\n", e.what());
exit(1); exit(1);