diff --git a/common/cpp/src/asapo_fabric/server/task/fabric_handshake_accepting_task.h b/common/cpp/src/asapo_fabric/server/task/fabric_handshake_accepting_task.h index dedf61822b10e97cd65d1035cd7fcda9728749f4..92ebd232ad254f512a03f0640c6c83e4867f26a7 100644 --- a/common/cpp/src/asapo_fabric/server/task/fabric_handshake_accepting_task.h +++ b/common/cpp/src/asapo_fabric/server/task/fabric_handshake_accepting_task.h @@ -12,7 +12,7 @@ class FabricServerImpl; class FabricHandshakeAcceptingTask : public FabricSelfRequeuingTask { private: - FabricHandshakePayload handshake_payload_{}; + FabricHandshakePayload handshake_payload_; public: explicit FabricHandshakeAcceptingTask(FabricServerImpl* server); diff --git a/common/cpp/src/system_io/system_io.cpp b/common/cpp/src/system_io/system_io.cpp index 0d8ddcb43753daaab083ea743a0f9f63f7d077cd..6b35e0491e8759315ec469a3d4918d3277de2e38 100644 --- a/common/cpp/src/system_io/system_io.cpp +++ b/common/cpp/src/system_io/system_io.cpp @@ -8,7 +8,8 @@ #include <mutex> #ifdef _WIN32 -# include <winsock2.h> +typedef long suseconds_t; +typedef short sa_family_t; #endif #if defined(__linux__) || defined (__APPLE__) diff --git a/examples/producer/dummy-data-producer/dummy_data_producer.cpp b/examples/producer/dummy-data-producer/dummy_data_producer.cpp index 1cf0e65af33356d55269208bf7cc10bcfe0cb7f1..24eacdb3300666afe741bdbdc7a066e9d0d93b49 100644 --- a/examples/producer/dummy-data-producer/dummy_data_producer.cpp +++ b/examples/producer/dummy-data-producer/dummy_data_producer.cpp @@ -211,9 +211,10 @@ std::unique_ptr<asapo::Producer> CreateProducer(const Args& args) { void PrintOutput(const Args& args, const system_clock::time_point& start) { system_clock::time_point t2 = system_clock::now(); - double duration_sec = std::chrono::duration_cast<std::chrono::milliseconds>( t2 - start ).count() / 1000.0; - double size_gb = double(args.number_of_bytes) * args.iterations / 1000.0 / 1000.0 / 1000.0 * 8.0; - double rate = args.iterations / duration_sec; + double duration_sec = static_cast<double>(std::chrono::duration_cast<std::chrono::milliseconds>(t2 - start).count()) + / 1000.0; + double size_gb = static_cast<double>(args.number_of_bytes*args.iterations) / 1000.0 / 1000.0 / 1000.0 * 8.0; + double rate = static_cast<double>(args.iterations) / duration_sec; std::cout << "Rate: " << rate << " Hz" << std::endl; std::cout << "Bandwidth " << size_gb / duration_sec << " Gbit/s" << std::endl; std::cout << "Bandwidth " << size_gb / duration_sec / 8 << " GBytes/s" << std::endl; diff --git a/producer/event_monitor_producer/src/inotify_event.cpp b/producer/event_monitor_producer/src/inotify_event.cpp index 8535caafe4c44d6341f51be7bd4558d558a42539..f28aa50f89b768e93428db19ba915609154974da 100644 --- a/producer/event_monitor_producer/src/inotify_event.cpp +++ b/producer/event_monitor_producer/src/inotify_event.cpp @@ -9,7 +9,7 @@ InotifyEvent::InotifyEvent(const struct inotify_event* inotify_event, } uint32_t InotifyEvent::Length() const { - return sizeof(struct inotify_event) + inotify_event_->len; + return sizeof(struct inotify_event) + static_cast<uint32_t>(inotify_event_->len); } bool InotifyEvent::IsDirectoryEvent() const { diff --git a/producer/event_monitor_producer/src/system_folder_watch_linux.cpp b/producer/event_monitor_producer/src/system_folder_watch_linux.cpp index b1aeb7ea0dece154d9842a07e60de40946e8a577..23f153fdff24d0c392598338fe07fa033ee484cc 100644 --- a/producer/event_monitor_producer/src/system_folder_watch_linux.cpp +++ b/producer/event_monitor_producer/src/system_folder_watch_linux.cpp @@ -199,7 +199,7 @@ Error SystemFolderWatch::ProcessInotifyEvent(const InotifyEvent& event, FilesToS } Error SystemFolderWatch::ReadInotifyEvents(int* bytes_read) { - *bytes_read = inotify__->Read(watch_fd_, buffer_.get(), kBufLen); + *bytes_read = static_cast<int>(inotify__->Read(watch_fd_, buffer_.get(), kBufLen)); if (*bytes_read < 0) { return EventMonitorErrorTemplates::kSystemError.Generate("read from inotify fd"); } diff --git a/producer/event_monitor_producer/unittests/test_system_folder_watch_linux.cpp b/producer/event_monitor_producer/unittests/test_system_folder_watch_linux.cpp index d2b1f50e4eedcc644756b961f1a69720707e45fb..a22c65f7445f26e49efeb5003cd975214ca9a04e 100644 --- a/producer/event_monitor_producer/unittests/test_system_folder_watch_linux.cpp +++ b/producer/event_monitor_producer/unittests/test_system_folder_watch_linux.cpp @@ -126,9 +126,9 @@ ssize_t SystemFolderWatchTests::AddEventToBuffer(std::string filename, uint32_t event->mask = mask; event->wd = fd; strcpy(event->name, filename.c_str()); - event->len = strlen(event->name) + 1; + event->len = static_cast<uint32_t>(strlen(event->name)) + 1; memcpy(buffer + cur_buffer_pointer, event, size); - cur_buffer_pointer += size; + cur_buffer_pointer += static_cast<int>(size); free(buf); return size; diff --git a/receiver/src/data_cache.cpp b/receiver/src/data_cache.cpp index d346164fbdff75381871a45b538b61fb6dc50589..f6765f46fac8db9a24e5b76b9f8dae40dfffffa5 100644 --- a/receiver/src/data_cache.cpp +++ b/receiver/src/data_cache.cpp @@ -72,7 +72,7 @@ bool DataCache::SlotTooCloseToCurrentPointer(const CacheMeta* meta) { } else { dist = cache_size_ - cur_pointer_ + shift; } - return dist < cache_size_ * keepunlocked_ratio_; + return dist < static_cast<uint64_t>(static_cast<float>(cache_size_) * keepunlocked_ratio_); } // we allow to read if it was already locked - if lock come from reading - no problems, from writing -should not happen! diff --git a/receiver/unittests/test_datacache.cpp b/receiver/unittests/test_datacache.cpp index 69d668a7d62ba52c7e355f170755bff88f244f06..d17f292767cd819b8a77a72eb39372bb394b55a4 100644 --- a/receiver/unittests/test_datacache.cpp +++ b/receiver/unittests/test_datacache.cpp @@ -102,7 +102,7 @@ TEST_F(DataCacheTests, PrepareToReadIdNotFound) { } TEST_F(DataCacheTests, PrepareToReadOk) { - auto data_size = static_cast<uint64_t>(expected_cache_size * 0.7); + auto data_size = static_cast<uint64_t>(static_cast<double>(expected_cache_size) * 0.7); uint8_t* ini_addr = (uint8_t*) cache.GetFreeSlotAndLock(data_size, &meta1); uint8_t* addr = (uint8_t*) cache.GetSlotToReadAndLock(meta1->id, data_size, &meta2); @@ -113,7 +113,7 @@ TEST_F(DataCacheTests, PrepareToReadOk) { TEST_F(DataCacheTests, PrepareToReadFailsIfTooCloseToCurrentPointer) { - auto data_size = static_cast<uint64_t>(expected_cache_size * 0.9); + auto data_size = static_cast<uint64_t>(static_cast<double>(expected_cache_size) * 0.9); cache.GetFreeSlotAndLock(data_size, &meta1); uint8_t* addr = (uint8_t*) cache.GetSlotToReadAndLock(meta1->id, data_size, &meta2); diff --git a/tests/automatic/consumer/consumer_api/consumer_api.c b/tests/automatic/consumer/consumer_api/consumer_api.c index 37501ed76399abbf1a47b6f59cf7d301e86a4e56..21cfa29371457f206d53f607c6ff24490f7d16df 100644 --- a/tests/automatic/consumer/consumer_api/consumer_api.c +++ b/tests/automatic/consumer/consumer_api/consumer_api.c @@ -12,7 +12,7 @@ void assert_eq_int_(uint64_t expected, uint64_t got, const char *message, int line) { printf("asserting %s at %d\n",message,line); if (expected!=got) { - printf("%s: expected %llu got %llu at %d\n",message, expected, got,line); + printf("%s: expected %llu got %llu at %d\n",message, (unsigned long long)expected, (unsigned long long)got,line); exit(EXIT_FAILURE); } } diff --git a/tests/automatic/consumer/next_multithread_broker/next_multithread_broker.cpp b/tests/automatic/consumer/next_multithread_broker/next_multithread_broker.cpp index 9934ec1a3f0c5c4aa362fa77ad6ac9dde23256b5..eb8c03c6f872c1c098d702e57f4dc071b5f1367f 100644 --- a/tests/automatic/consumer/next_multithread_broker/next_multithread_broker.cpp +++ b/tests/automatic/consumer/next_multithread_broker/next_multithread_broker.cpp @@ -12,7 +12,7 @@ void Assert(std::vector<asapo::MessageMetas> message_metas, uint64_t nthreads, i } int nfiles_read = 0; for (uint64_t i = 0; i < nthreads; i++) { - nfiles_read += message_metas[i].size(); + nfiles_read += static_cast<int>(message_metas[i].size()); for (const auto& fi : message_metas[i]) { result.push_back(fi.name); } diff --git a/tests/manual/performance_broker_receiver/getlast_broker.cpp b/tests/manual/performance_broker_receiver/getlast_broker.cpp index 9f3bf7f534c726b7aea148b26526a42eca48efcd..07e8032e96341c84dac204b1caadf15ec4122027 100644 --- a/tests/manual/performance_broker_receiver/getlast_broker.cpp +++ b/tests/manual/performance_broker_receiver/getlast_broker.cpp @@ -203,7 +203,7 @@ int main(int argc, char* argv[]) { } std::cout << "Errors : " << nerrors << std::endl; std::cout << "Elapsed : " << duration_ms << "ms" << std::endl; - std::cout << "Rate : " << 1000.0f * nfiles / (duration_ms) << " Hz" << std::endl; + std::cout << "Rate : " << 1000.0f * static_cast<float>(nfiles) / (static_cast<float>(duration_ms)) << " Hz" << std::endl; std::cout << "Using connection type: " << ConnectionTypeToString(connectionType) << std::endl;