Resolve MSVC conversion warnings C4244 (#519)
authorAlpar Juttner <alpar@cs.elte.hu>
Thu, 02 Apr 2015 13:36:16 +0200 (2015-04-02)
changeset 1124d51126dc39fa
parent 1123 18c89646185e
child 1126 043a787c3cee
Resolve MSVC conversion warnings C4244 (#519)
lemon/elevator.h
lemon/radix_sort.h
lemon/random.h
lemon/static_graph.h
     1.1 --- a/lemon/elevator.h	Thu Apr 02 12:57:18 2015 +0200
     1.2 +++ b/lemon/elevator.h	Thu Apr 02 13:36:16 2015 +0200
     1.3 @@ -167,7 +167,7 @@
     1.4      ///Return the number of items on level \c l.
     1.5      int onLevel(int l) const
     1.6      {
     1.7 -      return _first[l+1]-_first[l];
     1.8 +      return static_cast<int>(_first[l+1]-_first[l]);
     1.9      }
    1.10      ///Return true if level \c l is empty.
    1.11      bool emptyLevel(int l) const
    1.12 @@ -177,12 +177,12 @@
    1.13      ///Return the number of items above level \c l.
    1.14      int aboveLevel(int l) const
    1.15      {
    1.16 -      return _first[_max_level+1]-_first[l+1];
    1.17 +      return static_cast<int>(_first[_max_level+1]-_first[l+1]);
    1.18      }
    1.19      ///Return the number of active items on level \c l.
    1.20      int activesOnLevel(int l) const
    1.21      {
    1.22 -      return _last_active[l]-_first[l]+1;
    1.23 +      return static_cast<int>(_last_active[l]-_first[l]+1);
    1.24      }
    1.25      ///Return true if there is no active item on level \c l.
    1.26      bool activeFree(int l) const
     2.1 --- a/lemon/radix_sort.h	Thu Apr 02 12:57:18 2015 +0200
     2.2 +++ b/lemon/radix_sort.h	Thu Apr 02 13:36:16 2015 +0200
     2.3 @@ -328,7 +328,7 @@
     2.4        typedef std::allocator<Key> Allocator;
     2.5        Allocator allocator;
     2.6  
     2.7 -      int length = std::distance(first, last);
     2.8 +      int length = static_cast<int>(std::distance(first, last));
     2.9        Key* buffer = allocator.allocate(2 * length);
    2.10        try {
    2.11          bool dir = true;
     3.1 --- a/lemon/random.h	Thu Apr 02 12:57:18 2015 +0200
     3.2 +++ b/lemon/random.h	Thu Apr 02 13:36:16 2015 +0200
     3.3 @@ -199,7 +199,7 @@
     3.4  
     3.5          initState(init);
     3.6  
     3.7 -        num = length > end - begin ? length : end - begin;
     3.8 +        num = static_cast<int>(length > end - begin ? length : end - begin);
     3.9          while (num--) {
    3.10            curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul1))
    3.11              + *it + cnt;
    3.12 @@ -213,7 +213,7 @@
    3.13            --curr;
    3.14          }
    3.15  
    3.16 -        num = length - 1; cnt = length - (curr - state) - 1;
    3.17 +        num = length - 1; cnt = static_cast<int>(length - (curr - state) - 1);
    3.18          while (num--) {
    3.19            curr[0] = (curr[0] ^ ((curr[1] ^ (curr[1] >> (bits - 2))) * mul2))
    3.20              - cnt;
     4.1 --- a/lemon/static_graph.h	Thu Apr 02 12:57:18 2015 +0200
     4.2 +++ b/lemon/static_graph.h	Thu Apr 02 13:36:16 2015 +0200
     4.3 @@ -203,7 +203,7 @@
     4.4        built = true;
     4.5  
     4.6        node_num = n;
     4.7 -      arc_num = std::distance(first, last);
     4.8 +      arc_num = static_cast<int>(std::distance(first, last));
     4.9  
    4.10        node_first_out = new int[node_num + 1];
    4.11        node_first_in = new int[node_num];