aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorAngelo Mantellini <manangel@cisco.com>2019-02-09 10:49:35 +0100
committerAngelo Mantellini <manangel@cisco.com>2019-02-11 14:35:47 +0100
commit3c9836d46747358fa73e0eb818d95b7907967cb2 (patch)
tree9457e3d3443aa4c5f3e479667f2b0108f51275f8 /utils
parent13ec18b4b3ec8455daad674a0c0e616885b83608 (diff)
[HICN-47] Remove warnings utils on windows
Change-Id: Id8616bc6b68ec2854078ecfe3b30f4573e7d7c6c Signed-off-by: Angelo Mantellini <manangel@cisco.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/CMakeLists.txt3
-rw-r--r--utils/src/hiperf.cc21
-rw-r--r--utils/src/ping_client.cc8
-rw-r--r--utils/src/ping_server.cc6
4 files changed, 21 insertions, 17 deletions
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 077789f57..5cdfbb50f 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -42,6 +42,9 @@ list(APPEND UTILS_SRC
src/ping_server.cc
)
+if (WIN32)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4200 /wd4996")
+endif ()
foreach(util ${UTILS_SRC})
get_filename_component(_util_name ${util} NAME)
string(REGEX REPLACE ".cc" "" util_name ${_util_name})
diff --git a/utils/src/hiperf.cc b/utils/src/hiperf.cc
index 629de54de..8db4d9f0d 100644
--- a/utils/src/hiperf.cc
+++ b/utils/src/hiperf.cc
@@ -35,7 +35,9 @@ namespace transport {
namespace interface {
+#ifndef ERROR_SUCCESS
#define ERROR_SUCCESS 0
+#endif
#define ERROR_SETUP -5
using CryptoSuite = utils::CryptoSuite;
@@ -112,7 +114,7 @@ class HIperfClient {
const std::error_code &ec) {
Time t2 = std::chrono::steady_clock::now();
TimeDuration dt = std::chrono::duration_cast<TimeDuration>(t2 - t1_);
- long usec = dt.count();
+ long usec = (long)dt.count();
std::cout << "Content retrieved. Size: " << bytes_transferred << " [Bytes]"
<< std::endl;
@@ -179,7 +181,7 @@ class HIperfClient {
std::cout << std::left << std::setw(width) << avg_rtt.str() << std::endl;
std::cout << std::endl;
- total_duration_milliseconds_ += exact_duration.count();
+ total_duration_milliseconds_ += (uint32_t)exact_duration.count();
old_bytes_value_ = byte_count;
}
@@ -235,7 +237,8 @@ class HIperfClient {
}
if (consumer_socket_->setSocketOption(OtherOptions::VIRTUAL_DOWNLOAD,
- configuration_.virtual_download) == SOCKET_OPTION_NOT_SET) {
+ configuration_.virtual_download) ==
+ SOCKET_OPTION_NOT_SET) {
return ERROR_SETUP;
}
@@ -324,9 +327,9 @@ class HIperfServer {
HIperfServer(ServerConfiguration &conf)
: configuration_(conf),
// signals_(io_service_, SIGINT, SIGQUIT),
- content_objects_((1 << log2_content_object_buffer_size)),
+ content_objects_((std::uint16_t)(1 << log2_content_object_buffer_size)),
content_objects_index_(0),
- mask_((1 << log2_content_object_buffer_size) - 1) {
+ mask_((std::uint16_t)(1 << log2_content_object_buffer_size) - 1) {
// signals_.async_wait([this] (const std::error_code&, const int&)
// {std::cout << "STOPPING!!" << std::endl; io_service_.stop();});
@@ -546,12 +549,11 @@ void usage() {
}
int main(int argc, char *argv[]) {
-
#ifndef _WIN32
// Common
bool daemon = false;
#else
- WSADATA wsaData = { 0 };
+ WSADATA wsaData = {0};
WSAStartup(MAKEWORD(2, 2), &wsaData);
#endif
@@ -710,9 +712,10 @@ int main(int argc, char *argv[]) {
dup2(STDOUT_FILENO, STDERR_FILENO);
close(fd);
#else
- int fd = _open(log_file, _O_WRONLY | _O_APPEND | _O_CREAT, _S_IWRITE | _S_IREAD);
+ int fd =
+ _open(log_file, _O_WRONLY | _O_APPEND | _O_CREAT, _S_IWRITE | _S_IREAD);
_dup2(fd, _fileno(stdout));
- _dup2(_fileno(stdout), _fileno(strerr));
+ _dup2(_fileno(stdout), _fileno(stderr));
_close(fd);
#endif
}
diff --git a/utils/src/ping_client.cc b/utils/src/ping_client.cc
index a99652b9c..598012143 100644
--- a/utils/src/ping_client.cc
+++ b/utils/src/ping_client.cc
@@ -77,8 +77,7 @@ class Configuration {
class Client : interface::BasePortal::ConsumerCallback {
public:
Client(Configuration *c)
- : portal_(),
- signals_(portal_.getIoService(), SIGINT) {
+ : portal_(), signals_(portal_.getIoService(), SIGINT) {
// Let the main thread to catch SIGINT
portal_.connect();
portal_.setConsumerCallback(this);
@@ -206,7 +205,7 @@ class Client : interface::BasePortal::ConsumerCallback {
}
void doPing() {
- Name interest_name(config_->name_, sequence_number_);
+ Name interest_name(config_->name_, (uint32_t)sequence_number_);
hicn_format_t format;
if (interest_name.getAddressFamily() == AF_INET) {
format = HF_INET_TCP;
@@ -341,9 +340,8 @@ void help() {
}
int main(int argc, char *argv[]) {
-
#ifdef _WIN32
- WSADATA wsaData = { 0 };
+ WSADATA wsaData = {0};
WSAStartup(MAKEWORD(2, 2), &wsaData);
#endif
diff --git a/utils/src/ping_server.cc b/utils/src/ping_server.cc
index 9d68aec34..7d1df2448 100644
--- a/utils/src/ping_server.cc
+++ b/utils/src/ping_server.cc
@@ -46,8 +46,8 @@ class CallbackContainer {
bool dump, bool quite, bool flags, bool reset, uint8_t ttl,
utils::Identity *identity, bool sign)
: buffer_(object_size, 'X'),
- content_objects_(1 << log2_content_object_buffer_size),
- mask_((1 << log2_content_object_buffer_size) - 1),
+ content_objects_((std::uint32_t)(1 << log2_content_object_buffer_size)),
+ mask_((std::uint16_t)(1 << log2_content_object_buffer_size) - 1),
content_objects_index_(0),
verbose_(verbose),
dump_(dump),
@@ -193,7 +193,7 @@ void help() {
int main(int argc, char **argv) {
#ifdef _WIN32
- WSADATA wsaData = { 0 };
+ WSADATA wsaData = {0};
WSAStartup(MAKEWORD(2, 2), &wsaData);
#else
bool daemon = false;