Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix warnings about comparisons of integers of different types.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 20 Nov 2013 21:35:51 +0000 (22:35 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Wed, 20 Nov 2013 21:35:51 +0000 (22:35 +0100)
src/surf/cpu.cpp
src/surf/cpu_cas01.cpp
src/surf/network.cpp
src/surf/surf_routing.cpp
src/surf/surf_routing_dijkstra.cpp
src/surf/surf_routing_floyd.cpp
src/surf/surf_routing_full.cpp
src/surf/vm_workstation.cpp

index 2a9acf9..342c1bb 100644 (file)
@@ -205,8 +205,7 @@ void CpuActionLmm::setAffinity(CpuLmmPtr cpu, unsigned long mask)
     unsigned long nbits = 0;
 
     /* FIXME: There is much faster algorithms doing this. */
     unsigned long nbits = 0;
 
     /* FIXME: There is much faster algorithms doing this. */
-    unsigned long i;
-    for (i = 0; i < cpu->m_core; i++) {
+    for (int i = 0; i < cpu->m_core; i++) {
       unsigned long has_affinity = (1UL << i) & mask;
       if (has_affinity)
         nbits += 1;
       unsigned long has_affinity = (1UL << i) & mask;
       if (has_affinity)
         nbits += 1;
@@ -219,11 +218,8 @@ void CpuActionLmm::setAffinity(CpuLmmPtr cpu, unsigned long mask)
     }
   }
 
     }
   }
 
-
-
-  unsigned long i;
-  for (i = 0; i < cpu->m_core; i++) {
-    XBT_DEBUG("clear affinity %p to cpu-%lu@%s", this, i,  cpu->m_name);
+  for (int i = 0; i < cpu->m_core; i++) {
+    XBT_DEBUG("clear affinity %p to cpu-%d@%s", this, i,  cpu->m_name);
     lmm_shrink(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i], var_obj);
 
     unsigned long has_affinity = (1UL << i) & mask;
     lmm_shrink(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i], var_obj);
 
     unsigned long has_affinity = (1UL << i) & mask;
@@ -237,7 +233,7 @@ void CpuActionLmm::setAffinity(CpuLmmPtr cpu, unsigned long mask)
        * accept affinity settings on a future host. We might be able to assign
        * zero to elem->value to maintain such inactive affinity settings in the
        * system. But, this will make the system complex. */
        * accept affinity settings on a future host. We might be able to assign
        * zero to elem->value to maintain such inactive affinity settings in the
        * system. But, this will make the system complex. */
-      XBT_DEBUG("set affinity %p to cpu-%lu@%s", this, i, cpu->m_name);
+      XBT_DEBUG("set affinity %p to cpu-%d@%s", this, i, cpu->m_name);
       lmm_expand(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i], var_obj, 1.0);
     }
   }
       lmm_expand(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i], var_obj, 1.0);
     }
   }
index 2cca94a..2191f8b 100644 (file)
@@ -463,7 +463,7 @@ double CpuCas01Lmm::getCurrentPowerPeak()
 double CpuCas01Lmm::getPowerPeakAt(int pstate_index)
 {
   xbt_dynar_t plist = p_powerPeakList;
 double CpuCas01Lmm::getPowerPeakAt(int pstate_index)
 {
   xbt_dynar_t plist = p_powerPeakList;
-  xbt_assert((pstate_index <= xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
+  xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
 
   return xbt_dynar_get_as(plist, pstate_index, double);
 }
 
   return xbt_dynar_get_as(plist, pstate_index, double);
 }
@@ -476,7 +476,7 @@ int CpuCas01Lmm::getNbPstates()
 void CpuCas01Lmm::setPowerPeakAt(int pstate_index)
 {
   xbt_dynar_t plist = p_powerPeakList;
 void CpuCas01Lmm::setPowerPeakAt(int pstate_index)
 {
   xbt_dynar_t plist = p_powerPeakList;
-  xbt_assert((pstate_index <= xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
+  xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
 
   double new_power_peak = xbt_dynar_get_as(plist, pstate_index, double);
   m_pstate = pstate_index;
 
   double new_power_peak = xbt_dynar_get_as(plist, pstate_index, double);
   m_pstate = pstate_index;
index 66d2a31..0516594 100644 (file)
@@ -322,7 +322,7 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double delta)
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
       int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->p_variable);
 #ifdef HAVE_TRACING
     if (TRACE_is_enabled()) {
       int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->p_variable);
-      unsigned int i;
+      int i;
       for (i = 0; i < n; i++){
         lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem,
                                                             action->p_variable,
       for (i = 0; i < n; i++){
         lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem,
                                                             action->p_variable,
index d667710..1d6035e 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010, 2011. The SimGrid Team.
+/* Copyright (c) 2009, 2010, 2011, 2013. The SimGrid Team.
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
  * All rights reserved.                                                     */
 
 /* This program is free software; you can redistribute it and/or modify it
@@ -132,7 +132,7 @@ static void parse_S_host_link(sg_platf_host_link_cbarg_t host)
     current_routing->p_linkUpDownList = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);
 
   // If dynar is is greater than edge id and if the host_link is already defined
     current_routing->p_linkUpDownList = xbt_dynar_new(sizeof(s_surf_parsing_link_up_down_t),NULL);
 
   // If dynar is is greater than edge id and if the host_link is already defined
-  if(xbt_dynar_length(current_routing->p_linkUpDownList) > info->m_id &&
+  if((int)xbt_dynar_length(current_routing->p_linkUpDownList) > info->m_id &&
       xbt_dynar_get_as(current_routing->p_linkUpDownList, info->m_id, void*))
     xbt_die("Host_link for '%s' is already defined!",host->id);
 
       xbt_dynar_get_as(current_routing->p_linkUpDownList, info->m_id, void*))
     xbt_die("Host_link for '%s' is already defined!",host->id);
 
index d3ae335..417e3c9 100644 (file)
@@ -184,7 +184,7 @@ xbt_dynar_t AsDijkstra::getOnelinkRoutes()
 
   int src,dst;
   RoutingEdgePtr src_elm, dst_elm;
 
   int src,dst;
   RoutingEdgePtr src_elm, dst_elm;
-  size_t table_size = xbt_dynar_length(p_indexNetworkElm);
+  int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
   for(src=0; src < table_size; src++) {
     for(dst=0; dst< table_size; dst++) {
       xbt_dynar_reset(route->link_list);
   for(src=0; src < table_size; src++) {
     for(dst=0; dst< table_size; dst++) {
       xbt_dynar_reset(route->link_list);
index 17472ea..6bd1969 100644 (file)
@@ -30,8 +30,8 @@ AsFloyd::AsFloyd(): AsGeneric() {
 
 AsFloyd::~AsFloyd(){
   int i, j;
 
 AsFloyd::~AsFloyd(){
   int i, j;
-  size_t table_size;
-  table_size = xbt_dynar_length(p_indexNetworkElm);
+  int table_size;
+  table_size = (int)xbt_dynar_length(p_indexNetworkElm);
     /* Delete link_table */
     for (i = 0; i < table_size; i++)
       for (j = 0; j < table_size; j++)
     /* Delete link_table */
     for (i = 0; i < table_size; i++)
       for (j = 0; j < table_size; j++)
@@ -144,7 +144,7 @@ void AsFloyd::parseRoute(sg_platf_route_cbarg_t route)
   int as_route = 0;
 
   /* set the size of table routing */
   int as_route = 0;
 
   /* set the size of table routing */
-  size_t table_size = xbt_dynar_length(p_indexNetworkElm);
+  int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
   RoutingEdgePtr src_net_elm, dst_net_elm;
 
   src_net_elm = sg_routing_edge_by_name_or_null(src);
   RoutingEdgePtr src_net_elm, dst_net_elm;
 
   src_net_elm = sg_routing_edge_by_name_or_null(src);
index 9c74b22..814aba7 100644 (file)
@@ -24,12 +24,12 @@ AS_t model_full_create(void)
 
 void model_full_end(AS_t _routing)
 {
 
 void model_full_end(AS_t _routing)
 {
-  unsigned int i;
+  int i;
   sg_platf_route_cbarg_t e_route;
 
   /* set utils vars */
   AsFullPtr routing = ((AsFullPtr) _routing);
   sg_platf_route_cbarg_t e_route;
 
   /* set utils vars */
   AsFullPtr routing = ((AsFullPtr) _routing);
-  size_t table_size = xbt_dynar_length(routing->p_indexNetworkElm);
+  int table_size = (int)xbt_dynar_length(routing->p_indexNetworkElm);
 
   /* Create table if necessary */
   if (!routing->p_routingTable)
 
   /* Create table if necessary */
   if (!routing->p_routingTable)
@@ -56,7 +56,7 @@ AsFull::AsFull(){
 }
 
 AsFull::~AsFull(){
 }
 
 AsFull::~AsFull(){
-  size_t table_size = xbt_dynar_length(p_indexNetworkElm);
+  int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
   int i, j;
   /* Delete routing table */
   for (i = 0; i < table_size; i++)
   int i, j;
   /* Delete routing table */
   for (i = 0; i < table_size; i++)
index 072942c..fe17e16 100644 (file)
@@ -273,17 +273,14 @@ WorkstationVM2013Lmm::~WorkstationVM2013Lmm()
   /* Free the cpu resource of the VM. If using power_trace, we will have to
    * free other objects than lmm_constraint. */
   lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraint);
   /* Free the cpu resource of the VM. If using power_trace, we will have to
    * free other objects than lmm_constraint. */
   lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraint);
-  {
-    unsigned long i;
-    for (i = 0; i < cpu->m_core; i++) {
-      void *cnst_id = cpu->p_constraintCore[i]->id;
-      lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i]);
-      xbt_free(cnst_id);
-    }
-
-    xbt_free(cpu->p_constraintCore);
+  for (int i = 0; i < cpu->m_core; i++) {
+    void *cnst_id = cpu->p_constraintCore[i]->id;
+    lmm_constraint_free(cpu->p_model->p_maxminSystem, cpu->p_constraintCore[i]);
+    xbt_free(cnst_id);
   }
 
   }
 
+  xbt_free(cpu->p_constraintCore);
+
   delete cpu;
 
   /* Free the network resource of the VM. */
   delete cpu;
 
   /* Free the network resource of the VM. */