From: Arnaud Giersch Date: Tue, 25 Jan 2011 17:21:10 +0000 (+0100) Subject: Cosmetics: make cppcheck happy. X-Git-Tag: v0.1~188^2~6 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/4875a2f2ad219d4f1ebd94b39d86272177760567?ds=sidebyside;hp=-c Cosmetics: make cppcheck happy. --- 4875a2f2ad219d4f1ebd94b39d86272177760567 diff --git a/communicator.cpp b/communicator.cpp index 7784a48..bcdce2f 100644 --- a/communicator.cpp +++ b/communicator.cpp @@ -23,7 +23,7 @@ std::string message::to_string() } communicator::communicator() - : host((hostdata* )MSG_host_get_data(MSG_host_self())) + : host(static_cast(MSG_host_get_data(MSG_host_self()))) , mutex(xbt_mutex_init()) , cond(xbt_cond_init()) , ctrl_task(NULL) @@ -116,7 +116,7 @@ bool communicator::recv(message*& msg, m_host_t& from, double timeout) m_task_t task = received.front(); received.pop(); - msg = (message* )MSG_task_get_data(task); + msg = static_cast(MSG_task_get_data(task)); from = MSG_task_get_source(task); MSG_task_destroy(task); @@ -158,7 +158,7 @@ bool communicator::comm_test_n_destroy(msg_comm_t comm) int communicator::receiver_wrapper(int, char* []) { communicator* comm; - comm = (communicator* )MSG_process_get_data(MSG_process_self()); + comm = static_cast(MSG_process_get_data(MSG_process_self())); int result = comm->receiver(); DEBUG0("terminate"); diff --git a/neighbor.cpp b/neighbor.cpp index c45fc8f..7523783 100644 --- a/neighbor.cpp +++ b/neighbor.cpp @@ -8,7 +8,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(proc); // needed to compile neighbor.h #include "neighbor.h" neighbor::neighbor(const char* hostname) - : host((hostdata* )MSG_host_get_data(MSG_get_host_by_name(hostname))) + : host(static_cast(MSG_host_get_data(MSG_get_host_by_name(hostname)))) , load(std::numeric_limits::infinity()) , debt(0.0) , to_send(0.0) diff --git a/process.cpp b/process.cpp index 54573d3..9959376 100644 --- a/process.cpp +++ b/process.cpp @@ -44,6 +44,8 @@ process::process(int argc, char* argv[]) close_received = false; finalizing = false; + comp_iter = lb_iter = 0; + e_xbt_log_priority_t logp = xbt_log_priority_verbose; if (!LOG_ISENABLED(logp)) return; @@ -81,7 +83,6 @@ int process::run() double next_iter_after_date = 0.0; INFO1("Initial load: %g", real_load); VERB0("Starting..."); - comp_iter = lb_iter = 0; while (true) { if (get_load() > 0.0) { double now = MSG_get_clock(); diff --git a/process.h b/process.h index 78fc507..24d4c39 100644 --- a/process.h +++ b/process.h @@ -98,7 +98,9 @@ private: void send_all(); // Returns true if there remains neighbors to listen for - bool may_receive() { return ctrl_close_pending || data_close_pending; } + bool may_receive() const { + return ctrl_close_pending || data_close_pending; + } // Receive procedure // Parameter "timeout" may be 0 for non-blocking operation, -1 for