From 4c8876424cca41c8ce8ce67c1c0a394932cbdd58 Mon Sep 17 00:00:00 2001 From: Angelo Mantellini Date: Sun, 10 Feb 2019 12:49:21 +0100 Subject: [HICN-46] Remove warnings libtransport on windows Change-Id: I09456770dcbca979491cdcadb310eab95a0dea17 Signed-off-by: Angelo Mantellini --- .../src/hicn/transport/interfaces/rtc_socket_producer.cc | 14 +++++++------- .../src/hicn/transport/interfaces/socket_consumer.cc | 4 ++-- .../transport/interfaces/socket_options_default_values.h | 3 ++- .../src/hicn/transport/interfaces/socket_producer.cc | 10 +++++----- .../src/hicn/transport/interfaces/socket_producer.h | 2 +- 5 files changed, 17 insertions(+), 16 deletions(-) (limited to 'libtransport/src/hicn/transport/interfaces') diff --git a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc index 84c80dad7..740e03c3c 100644 --- a/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc +++ b/libtransport/src/hicn/transport/interfaces/rtc_socket_producer.cc @@ -51,7 +51,7 @@ RTCProducerSocket::RTCProducerSocket(asio::io_service &io_service) nack_payload->append(NACK_HEADER_SIZE); nack_->appendPayload(std::move(nack_payload)); lastStats_ = std::chrono::steady_clock::now(); - srand(time(NULL)); + srand((unsigned int)time(NULL)); prodLabel_ = ((rand() % 255) << 24UL); } @@ -68,7 +68,7 @@ RTCProducerSocket::RTCProducerSocket() nack_payload->append(NACK_HEADER_SIZE); nack_->appendPayload(std::move(nack_payload)); lastStats_ = std::chrono::steady_clock::now(); - srand(time(NULL)); + srand((unsigned int)time(NULL)); prodLabel_ = ((rand() % 255) << 24UL); } @@ -117,7 +117,7 @@ void RTCProducerSocket::produce(const uint8_t *buf, size_t buffer_size) { return; } - updateStats(buffer_size + headerSize_ + TIMESTAMP_LEN); + updateStats((uint32_t)(buffer_size + headerSize_ + TIMESTAMP_LEN)); ContentObject content_object(flowName_.setSuffix(currentSeg_)); @@ -148,10 +148,10 @@ void RTCProducerSocket::onInterest(Interest::Ptr &&interest) { // XXX // packetsProductionRate_ is modified by another thread in updateStats // this should be safe since I just read here. but, you never know. - max_gap = - floor((double)((double)((double)lifetime * - INTEREST_LIFETIME_REDUCTION_FACTOR / 1000.0) * - (double)packetsProductionRate_)); + max_gap = (uint32_t)floor( + (double)((double)((double)lifetime * INTEREST_LIFETIME_REDUCTION_FACTOR / + 1000.0) * + (double)packetsProductionRate_)); if (interestSeg < currentSeg_ || interestSeg > (max_gap + currentSeg_)) { sendNack(*interest); diff --git a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc index 89411e92c..eacaf932b 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_consumer.cc +++ b/libtransport/src/hicn/transport/interfaces/socket_consumer.cc @@ -507,11 +507,11 @@ int ConsumerSocket::getSocketOption(int socket_option_key, uint32_t &socket_option_value) { switch (socket_option_key) { case GeneralTransportOptions::INPUT_BUFFER_SIZE: - socket_option_value = input_buffer_size_; + socket_option_value = (uint32_t)input_buffer_size_; return SOCKET_OPTION_GET; case GeneralTransportOptions::OUTPUT_BUFFER_SIZE: - socket_option_value = output_buffer_size_; + socket_option_value = (uint32_t)output_buffer_size_; return SOCKET_OPTION_GET; case GeneralTransportOptions::MAX_INTEREST_RETX: diff --git a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h index b4ff44f1e..f9cbb5a44 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h +++ b/libtransport/src/hicn/transport/interfaces/socket_options_default_values.h @@ -27,7 +27,8 @@ namespace default_values { const uint32_t interest_lifetime = 1001; // milliseconds const uint32_t never_expire_time = HICN_MAX_LIFETIME; -const uint32_t content_object_expiry_time = never_expire_time; // milliseconds -> 50 seconds +const uint32_t content_object_expiry_time = + never_expire_time; // milliseconds -> 50 seconds const uint32_t content_object_packet_size = 1500; // The ethernet MTU const uint32_t producer_socket_input_buffer_size = 150000; // Interests const uint32_t producer_socket_output_buffer_size = 150000; // Content Object diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.cc b/libtransport/src/hicn/transport/interfaces/socket_producer.cc index ab9de4a95..66c656924 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_producer.cc +++ b/libtransport/src/hicn/transport/interfaces/socket_producer.cc @@ -314,7 +314,7 @@ uint32_t ProducerSocket::produce(Name content_name, const uint8_t *buf, if (packaged_segments == number_of_segments - 1) { content_object->appendPayload(&buf[bytes_segmented], buffer_size - bytes_segmented); - bytes_segmented += buffer_size - bytes_segmented; + bytes_segmented += (int)(buffer_size - bytes_segmented); if (is_last && making_manifest_) { is_last_manifest = true; @@ -325,7 +325,7 @@ uint32_t ProducerSocket::produce(Name content_name, const uint8_t *buf, } else { content_object->appendPayload(&buf[bytes_segmented], free_space_for_content); - bytes_segmented += free_space_for_content; + bytes_segmented += (int)(free_space_for_content); } if (making_manifest_) { @@ -716,15 +716,15 @@ int ProducerSocket::getSocketOption(int socket_option_key, uint32_t &socket_option_value) { switch (socket_option_key) { case GeneralTransportOptions::INPUT_BUFFER_SIZE: - socket_option_value = input_buffer_capacity_; + socket_option_value = (int)input_buffer_capacity_; return SOCKET_OPTION_GET; case GeneralTransportOptions::OUTPUT_BUFFER_SIZE: - socket_option_value = output_buffer_.getLimit(); + socket_option_value = (uint32_t)output_buffer_.getLimit(); return SOCKET_OPTION_GET; case GeneralTransportOptions::DATA_PACKET_SIZE: - socket_option_value = data_packet_size_; + socket_option_value = (uint32_t)data_packet_size_; return SOCKET_OPTION_GET; case GeneralTransportOptions::CONTENT_OBJECT_EXPIRY_TIME: diff --git a/libtransport/src/hicn/transport/interfaces/socket_producer.h b/libtransport/src/hicn/transport/interfaces/socket_producer.h index bd7d3f35f..d51464b77 100644 --- a/libtransport/src/hicn/transport/interfaces/socket_producer.h +++ b/libtransport/src/hicn/transport/interfaces/socket_producer.h @@ -223,7 +223,7 @@ class ProducerSocket : public Socket, HashAlgorithm hash_algorithm_; utils::CryptoSuite crypto_suite_; - //std::unique_ptr identity_; + // std::unique_ptr identity_; // utils::Signer& signer_; // buffers -- cgit 1.2.3-korg