Commit c6251752 authored by Kristof Szabados's avatar Kristof Szabados
Browse files

static_casts in the core folder


Signed-off-by: Kristof Szabados's avatarkristof <Kristof.Szabados@ericsson.com>
parent cdbd5b69
......@@ -1096,8 +1096,8 @@ VALUE_ARRAY<T_type,array_size,index_offset>
VALUE_ARRAY<T_type,array_size,index_offset>::
operator>>=(int rotate_count) const {
unsigned int rc;
if (rotate_count>=0) rc = (unsigned int)rotate_count % array_size;
else rc = array_size - ((unsigned int)(-rotate_count) % array_size);
if (rotate_count>=0) rc = static_cast<unsigned int>(rotate_count) % array_size;
else rc = array_size - (static_cast<unsigned int>(-rotate_count) % array_size);
if (rc == 0) return *this;
VALUE_ARRAY<T_type,array_size,index_offset> ret_val;
for (unsigned int i=0; i<array_size; i++) {
......@@ -2937,7 +2937,7 @@ boolean match_permutation_array(const Base_Type *value_ptr,
// permutation
if (nof_permutations == 1 && template_ptr->get_permutation_start(0) == 0 &&
template_ptr->get_permutation_end(0) ==
(unsigned int)(template_size - 1))
static_cast<unsigned int>(template_size - 1))
return match_set_of(value_ptr, value_size, template_ptr, template_size,
match_function, legacy);
......
......@@ -782,7 +782,7 @@ void BITSTRING::BER_encode_putbits(unsigned char *target,
target[0]=0x00;
return;
}
target[0]=(unsigned char)(nof_octets*8-bit_count);
target[0] = static_cast<unsigned char>(nof_octets*8-bit_count);
for(i=0; i<nof_octets-1; i++) {
c=0;
for(j=0; j<8; j++) {
......
......@@ -2988,8 +2988,8 @@ void CHARSTRING_template::set_param(Module_Param& param) {
set_selection(VALUE_RANGE);
value_range.min_is_set = TRUE;
value_range.max_is_set = TRUE;
value_range.min_value = (char)(lower_uchar.uc_cell);
value_range.max_value = (char)(upper_uchar.uc_cell);
value_range.min_value = static_cast<char>(lower_uchar.uc_cell);
value_range.max_value = static_cast<char>(upper_uchar.uc_cell);
set_min_exclusive(mp->get_is_min_exclusive());
set_max_exclusive(mp->get_is_max_exclusive());
} break;
......
......@@ -45,7 +45,7 @@
#include "Event_Handler.hh"
static const int MAX_INT_VAL = (int) ((unsigned int) -2 >> 1u);
static const int MAX_INT_VAL = static_cast<int>(static_cast<unsigned int>( -2 ) >> 1u);
/******************************************************************************
* class FdMap *
......
......@@ -1219,7 +1219,7 @@ boolean match_record_of(const Base_Type *value_ptr, int value_size,
// permutation
if (nof_permutations == 1 && template_ptr->get_permutation_start(0) == 0 &&
template_ptr->get_permutation_end(0) ==
(unsigned int)(template_size - 1))
static_cast<unsigned int>(template_size - 1) )
return match_set_of(value_ptr, value_size, template_ptr, template_size,
match_function, legacy);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment