]> AND Private Git Repository - loba.git/commitdiff
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Cosmetics: make cppcheck happy.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 25 Jan 2011 17:21:10 +0000 (18:21 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 25 Jan 2011 17:21:10 +0000 (18:21 +0100)
communicator.cpp
neighbor.cpp
process.cpp
process.h

index 7784a483ab724d10d41c9c96aef264b2f387f773..bcdce2fbda6d6dfda76e1558be50a62a68597925 100644 (file)
@@ -23,7 +23,7 @@ std::string message::to_string()
 }
 
 communicator::communicator()
 }
 
 communicator::communicator()
-    : host((hostdata* )MSG_host_get_data(MSG_host_self()))
+    : host(static_cast<hostdata*>(MSG_host_get_data(MSG_host_self())))
     , mutex(xbt_mutex_init())
     , cond(xbt_cond_init())
     , ctrl_task(NULL)
     , 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();
 
     m_task_t task = received.front();
     received.pop();
-    msg = (message* )MSG_task_get_data(task);
+    msg = static_cast<message*>(MSG_task_get_data(task));
     from = MSG_task_get_source(task);
     MSG_task_destroy(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;
 int communicator::receiver_wrapper(int, char* [])
 {
     communicator* comm;
-    comm = (communicator* )MSG_process_get_data(MSG_process_self());
+    comm = static_cast<communicator*>(MSG_process_get_data(MSG_process_self()));
     int result = comm->receiver();
 
     DEBUG0("terminate");
     int result = comm->receiver();
 
     DEBUG0("terminate");
index c45fc8f3c4daa41627b3ec87f2a7ce72d9c85f9e..752378312ef2a4ee0fad36cefdb89e221aba8bfd 100644 (file)
@@ -8,7 +8,7 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(proc); // needed to compile neighbor.h
 #include "neighbor.h"
 
 neighbor::neighbor(const char* hostname)
 #include "neighbor.h"
 
 neighbor::neighbor(const char* hostname)
-    : host((hostdata* )MSG_host_get_data(MSG_get_host_by_name(hostname)))
+    : host(static_cast<hostdata*>(MSG_host_get_data(MSG_get_host_by_name(hostname))))
     , load(std::numeric_limits<double>::infinity())
     , debt(0.0)
     , to_send(0.0)
     , load(std::numeric_limits<double>::infinity())
     , debt(0.0)
     , to_send(0.0)
index 54573d376232ab2d9a973db2ef8a9c9d2095a1ea..99593765b8e8febfd374da6fc4116b684ce4cb07 100644 (file)
@@ -44,6 +44,8 @@ process::process(int argc, char* argv[])
     close_received = false;
     finalizing = false;
 
     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;
     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...");
     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();
     while (true) {
         if (get_load() > 0.0) {
             double now = MSG_get_clock();
index 78fc507f963b58491477fc9e2a064efc7685bddf..24d4c395668b2d4209abaf6ddc5b4ebf8c315aa0 100644 (file)
--- a/process.h
+++ b/process.h
@@ -98,7 +98,9 @@ private:
     void send_all();
 
     // Returns true if there remains neighbors to listen for
     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
 
     // Receive procedure
     // Parameter "timeout" may be 0 for non-blocking operation, -1 for