diff options
Diffstat (limited to 'storage/innobase/dict/dict0mem.cc')
-rw-r--r-- | storage/innobase/dict/dict0mem.cc | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index d5d734acf66..61f23890d12 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -166,7 +166,7 @@ dict_mem_table_create( table->space_id = space ? space->id : ULINT_UNDEFINED; table->n_t_cols = unsigned(n_cols + DATA_N_SYS_COLS); table->n_v_cols = (unsigned int) (n_v_cols); - table->n_cols = table->n_t_cols - table->n_v_cols; + table->n_cols = unsigned(table->n_t_cols - table->n_v_cols); table->cols = static_cast<dict_col_t*>( mem_heap_alloc(heap, table->n_cols * sizeof(dict_col_t))); @@ -276,7 +276,7 @@ dict_add_col_name( s += strlen(s) + 1; } - old_len = s - col_names; + old_len = unsigned(s - col_names); } else { old_len = 0; } @@ -435,7 +435,7 @@ dict_mem_table_add_s_col( dict_table_t* table, ulint num_base) { - ulint i = table->n_def - 1; + unsigned i = unsigned(table->n_def) - 1; dict_col_t* col = dict_table_get_nth_col(table, i); dict_s_col_t s_col; @@ -495,13 +495,13 @@ dict_mem_table_col_rename_low( /* We need to adjust all affected index->field pointers, as in dict_index_add_col(). First, copy table->col_names. */ - ulint prefix_len = s - t_col_names; + ulint prefix_len = ulint(s - t_col_names); for (; i < n_col; i++) { s += strlen(s) + 1; } - ulint full_len = s - t_col_names; + ulint full_len = ulint(s - t_col_names); char* col_names; if (to_len > from_len) { @@ -539,7 +539,7 @@ dict_mem_table_col_rename_low( } ulint name_ofs - = field->name - t_col_names; + = ulint(field->name - t_col_names); if (name_ofs <= prefix_len) { field->name = col_names + name_ofs; } else { @@ -1045,7 +1045,7 @@ dict_mem_index_add_field( index->n_def++; - field = dict_index_get_nth_field(index, index->n_def - 1); + field = dict_index_get_nth_field(index, unsigned(index->n_def) - 1); field->name = name; field->prefix_len = (unsigned int) prefix_len; @@ -1104,7 +1104,7 @@ dict_mem_create_temporary_tablename( char* name; const char* dbend = strchr(dbtab, '/'); ut_ad(dbend); - size_t dblen = dbend - dbtab + 1; + size_t dblen = size_t(dbend - dbtab) + 1; /* Increment a randomly initialized number for each temp file. */ my_atomic_add32((int32*) &dict_temp_file_num, 1); @@ -1248,8 +1248,9 @@ void dict_table_t::instant_add_column(const dict_table_t& table) const char* end = table.col_names; for (unsigned i = table.n_cols; i--; ) end += strlen(end) + 1; - col_names = static_cast<char*>(mem_heap_dup(heap, table.col_names, - end - table.col_names)); + col_names = static_cast<char*>( + mem_heap_dup(heap, table.col_names, + ulint(end - table.col_names))); const dict_col_t* const old_cols = cols; const dict_col_t* const old_cols_end = cols + n_cols; cols = static_cast<dict_col_t*>(mem_heap_dup(heap, table.cols, @@ -1258,7 +1259,7 @@ void dict_table_t::instant_add_column(const dict_table_t& table) /* Preserve the default values of previously instantly added columns. */ - for (unsigned i = n_cols - DATA_N_SYS_COLS; i--; ) { + for (unsigned i = unsigned(n_cols) - DATA_N_SYS_COLS; i--; ) { cols[i].def_val = old_cols[i].def_val; } @@ -1276,7 +1277,7 @@ void dict_table_t::instant_add_column(const dict_table_t& table) } const unsigned old_n_cols = n_cols; - const unsigned n_add = table.n_cols - n_cols; + const unsigned n_add = unsigned(table.n_cols - n_cols); n_t_def += n_add; n_t_cols += n_add; @@ -1349,14 +1350,17 @@ dict_table_t::rollback_instant( for (unsigned i = index->n_fields - n_remove; i < index->n_fields; i++) { - index->n_nullable -= index->fields[i].col->is_nullable(); + if (index->fields[i].col->is_nullable()) { + index->n_nullable--; + } } index->n_fields -= n_remove; index->n_def = index->n_fields; if (index->n_core_fields > index->n_fields) { index->n_core_fields = index->n_fields; - index->n_core_null_bytes = UT_BITS_IN_BYTES(index->n_nullable); + index->n_core_null_bytes + = UT_BITS_IN_BYTES(unsigned(index->n_nullable)); } const dict_col_t* const new_cols = cols; @@ -1423,7 +1427,9 @@ void dict_table_t::rollback_instant(unsigned n) DBUG_ASSERT(!memcmp(sys, system, sizeof system)); for (unsigned i = index->n_fields - n_remove; i < index->n_fields; i++) { - index->n_nullable -= index->fields[i].col->is_nullable(); + if (index->fields[i].col->is_nullable()) { + index->n_nullable--; + } } index->n_fields -= n_remove; index->n_def = index->n_fields; |