Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Explicit cast when loosing precision (teshsuite/).
[simgrid.git] / teshsuite / simdag / flatifier / flatifier.cpp
index 041c022..e0a01e4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008-2019. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2008-2020. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -42,7 +42,7 @@ static void create_environment(xbt_os_timer_t parse_time, const char *platformFi
 
 static void dump_hosts()
 {
-  unsigned int totalHosts = sg_host_count();
+  unsigned int totalHosts = static_cast<unsigned int>(sg_host_count());
   sg_host_t* hosts        = sg_host_list();
   std::sort(hosts, hosts + totalHosts,
             [](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
@@ -99,7 +99,7 @@ static void dump_routers()
   std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
       simgrid::s4u::Engine::get_instance()->get_all_netpoints();
   std::sort(netpoints.begin(), netpoints.end(),
-            [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
+            [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
               return a->get_name() < b->get_name();
             });
 
@@ -110,14 +110,14 @@ static void dump_routers()
 
 static void dump_routes()
 {
-  unsigned int totalHosts = sg_host_count();
+  unsigned int totalHosts = static_cast<unsigned int>(sg_host_count());
   sg_host_t* hosts        = sg_host_list();
   std::sort(hosts, hosts + totalHosts,
             [](const_sg_host_t a, const_sg_host_t b) { return strcmp(sg_host_get_name(a), sg_host_get_name(b)) < 0; });
   std::vector<simgrid::kernel::routing::NetPoint*> netpoints =
       simgrid::s4u::Engine::get_instance()->get_all_netpoints();
   std::sort(netpoints.begin(), netpoints.end(),
-            [](simgrid::kernel::routing::NetPoint* a, simgrid::kernel::routing::NetPoint* b) {
+            [](const simgrid::kernel::routing::NetPoint* a, const simgrid::kernel::routing::NetPoint* b) {
               return a->get_name() < b->get_name();
             });