From 807987361f2ba3df3562c24f579d02010ca47172 Mon Sep 17 00:00:00 2001 From: Martin Anderseck Date: Fri, 6 Aug 2021 20:41:48 +0200 Subject: lib: rfnoc: Make implicit typecasts explicit Fix implicit typecasts that could potentially lose data. Doing this to show that these typecasts are done on purpose (and to resolve warnings from VS). --- host/lib/rfnoc/mgmt_portal.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'host/lib/rfnoc/mgmt_portal.cpp') diff --git a/host/lib/rfnoc/mgmt_portal.cpp b/host/lib/rfnoc/mgmt_portal.cpp index 0e2ea3266..e719a9c72 100644 --- a/host/lib/rfnoc/mgmt_portal.cpp +++ b/host/lib/rfnoc/mgmt_portal.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -1047,11 +1048,11 @@ private: // Functions chdr_header header; header.set_pkt_type(PKT_TYPE_MGMT); header.set_num_mdata(0); - header.set_seq_num(_send_seqnum++); - header.set_length(payload.get_size_bytes() + (chdr_w_to_bits(_chdr_w) / 8)); + header.set_seq_num(static_cast(_send_seqnum++)); + header.set_length(uhd::narrow_cast(payload.get_size_bytes() + (chdr_w_to_bits(_chdr_w) / 8))); header.set_dst_epid(0); - auto send_buff = xport.get_send_buff(timeout * 1000); + auto send_buff = xport.get_send_buff(static_cast(timeout * 1000)); if (not send_buff) { UHD_LOG_ERROR( "RFNOC::MGMT", "Timed out getting send buff for management transaction"); @@ -1077,7 +1078,7 @@ private: // Functions // Send the transaction over the wire _send_mgmt_transaction(xport, send); - auto mgmt_buff = xport.get_mgmt_buff(timeout * 1000); + auto mgmt_buff = xport.get_mgmt_buff(static_cast(timeout * 1000)); if (not mgmt_buff) { throw uhd::io_error("Timed out getting recv buff for management transaction"); } -- cgit v1.2.3