summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-04-28 15:49:09 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2018-04-28 20:45:45 +0300
commitba19764209dc2e2cb0a688cada02e15720d9242b (patch)
treeb7b4f6512f0dc40ba2403de663f1955ba1847bfb
parente37df0f95a3b216c8cdecb5cacb360037dc631c3 (diff)
downloadmariadb-git-ba19764209dc2e2cb0a688cada02e15720d9242b.tar.gz
Fix most -Wsign-conversion in InnoDB
Change innodb_buffer_pool_size, innodb_fill_factor to unsigned.
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff13
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb.result6
-rw-r--r--storage/innobase/btr/btr0btr.cc7
-rw-r--r--storage/innobase/btr/btr0bulk.cc11
-rw-r--r--storage/innobase/btr/btr0cur.cc41
-rw-r--r--storage/innobase/btr/btr0defragment.cc4
-rw-r--r--storage/innobase/buf/buf0buddy.cc6
-rw-r--r--storage/innobase/buf/buf0buf.cc8
-rw-r--r--storage/innobase/buf/buf0flu.cc4
-rw-r--r--storage/innobase/data/data0data.cc8
-rw-r--r--storage/innobase/dict/dict0boot.cc8
-rw-r--r--storage/innobase/dict/dict0crea.cc16
-rw-r--r--storage/innobase/dict/dict0dict.cc38
-rw-r--r--storage/innobase/dict/dict0load.cc4
-rw-r--r--storage/innobase/dict/dict0mem.cc36
-rw-r--r--storage/innobase/dict/dict0stats.cc8
-rw-r--r--storage/innobase/eval/eval0eval.cc9
-rw-r--r--storage/innobase/fil/fil0fil.cc24
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc2
-rw-r--r--storage/innobase/fts/fts0config.cc2
-rw-r--r--storage/innobase/fts/fts0fts.cc14
-rw-r--r--storage/innobase/fts/fts0opt.cc22
-rw-r--r--storage/innobase/fts/fts0plugin.cc4
-rw-r--r--storage/innobase/fts/fts0que.cc10
-rw-r--r--storage/innobase/fts/fts0sql.cc3
-rw-r--r--storage/innobase/gis/gis0rtree.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc198
-rw-r--r--storage/innobase/handler/ha_innodb.h15
-rw-r--r--storage/innobase/handler/handler0alter.cc77
-rw-r--r--storage/innobase/handler/i_s.cc2
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc14
-rw-r--r--storage/innobase/include/btr0btr.h36
-rw-r--r--storage/innobase/include/btr0bulk.h5
-rw-r--r--storage/innobase/include/btr0cur.h8
-rw-r--r--storage/innobase/include/buf0buddy.h4
-rw-r--r--storage/innobase/include/buf0buddy.ic6
-rw-r--r--storage/innobase/include/buf0buf.ic9
-rw-r--r--storage/innobase/include/data0type.h4
-rw-r--r--storage/innobase/include/data0type.ic8
-rw-r--r--storage/innobase/include/dict0dict.ic15
-rw-r--r--storage/innobase/include/dict0mem.h12
-rw-r--r--storage/innobase/include/dict0types.h2
-rw-r--r--storage/innobase/include/fts0tokenize.h2
-rw-r--r--storage/innobase/include/fts0types.ic7
-rw-r--r--storage/innobase/include/ha_prototypes.h22
-rw-r--r--storage/innobase/include/mem0mem.ic3
-rw-r--r--storage/innobase/include/page0page.h6
-rw-r--r--storage/innobase/include/page0page.ic5
-rw-r--r--storage/innobase/include/page0size.h2
-rw-r--r--storage/innobase/include/page0zip.ic6
-rw-r--r--storage/innobase/include/pars0pars.h2
-rw-r--r--storage/innobase/include/rem0rec.h4
-rw-r--r--storage/innobase/include/rem0rec.ic3
-rw-r--r--storage/innobase/include/row0mysql.h2
-rw-r--r--storage/innobase/include/row0upd.h4
-rw-r--r--storage/innobase/include/srv0mon.h20
-rw-r--r--storage/innobase/include/sync0rw.ic10
-rw-r--r--storage/innobase/include/trx0sys.h5
-rw-r--r--storage/innobase/include/trx0trx.h6
-rw-r--r--storage/innobase/include/ut0pool.h2
-rw-r--r--storage/innobase/lock/lock0lock.cc20
-rw-r--r--storage/innobase/lock/lock0prdt.cc6
-rw-r--r--storage/innobase/lock/lock0wait.cc38
-rw-r--r--storage/innobase/log/log0recv.cc14
-rw-r--r--storage/innobase/mem/mem0mem.cc2
-rw-r--r--storage/innobase/mtr/mtr0log.cc6
-rw-r--r--storage/innobase/os/os0file.cc16
-rw-r--r--storage/innobase/os/os0thread.cc2
-rw-r--r--storage/innobase/page/page0cur.cc21
-rw-r--r--storage/innobase/page/page0page.cc17
-rw-r--r--storage/innobase/page/page0zip.cc105
-rw-r--r--storage/innobase/pars/pars0opt.cc5
-rw-r--r--storage/innobase/pars/pars0pars.cc13
-rw-r--r--storage/innobase/que/que0que.cc2
-rw-r--r--storage/innobase/rem/rem0cmp.cc2
-rw-r--r--storage/innobase/rem/rem0rec.cc21
-rw-r--r--storage/innobase/row/row0ftsort.cc34
-rw-r--r--storage/innobase/row/row0import.cc2
-rw-r--r--storage/innobase/row/row0ins.cc7
-rw-r--r--storage/innobase/row/row0log.cc44
-rw-r--r--storage/innobase/row/row0merge.cc16
-rw-r--r--storage/innobase/row/row0mysql.cc8
-rw-r--r--storage/innobase/row/row0purge.cc8
-rw-r--r--storage/innobase/row/row0quiesce.cc2
-rw-r--r--storage/innobase/row/row0row.cc4
-rw-r--r--storage/innobase/row/row0sel.cc31
-rw-r--r--storage/innobase/row/row0trunc.cc2
-rw-r--r--storage/innobase/row/row0uins.cc2
-rw-r--r--storage/innobase/row/row0umod.cc3
-rw-r--r--storage/innobase/row/row0upd.cc6
-rw-r--r--storage/innobase/srv/srv0conc.cc21
-rw-r--r--storage/innobase/srv/srv0mon.cc4
-rw-r--r--storage/innobase/srv/srv0srv.cc3
-rw-r--r--storage/innobase/srv/srv0start.cc4
-rw-r--r--storage/innobase/sync/sync0arr.cc4
-rw-r--r--storage/innobase/sync/sync0debug.cc8
-rw-r--r--storage/innobase/sync/sync0rw.cc22
-rw-r--r--storage/innobase/trx/trx0purge.cc2
-rw-r--r--storage/innobase/trx/trx0rec.cc16
-rw-r--r--storage/innobase/trx/trx0roll.cc2
-rw-r--r--storage/innobase/trx/trx0trx.cc2
-rw-r--r--storage/innobase/trx/trx0undo.cc4
-rw-r--r--storage/innobase/ut/ut0ut.cc8
103 files changed, 662 insertions, 735 deletions
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
index 3d9d6d27fb3..03db1f5c29f 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff
@@ -134,15 +134,6 @@
VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 4294967295
-@@ -922,7 +922,7 @@
- GLOBAL_VALUE_ORIGIN COMPILE-TIME
- DEFAULT_VALUE 100
- VARIABLE_SCOPE GLOBAL
--VARIABLE_TYPE BIGINT
-+VARIABLE_TYPE INT
- VARIABLE_COMMENT Percentage of B-tree page filled during bulk insert
- NUMERIC_MIN_VALUE 10
- NUMERIC_MAX_VALUE 100
@@ -936,7 +936,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
@@ -368,8 +359,8 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
--VARIABLE_TYPE BIGINT
-+VARIABLE_TYPE INT
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT How many files at the maximum InnoDB keeps open at the same time.
NUMERIC_MIN_VALUE 0
-NUMERIC_MAX_VALUE 9223372036854775807
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 5e73ee465c4..611eee7418b 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -321,7 +321,7 @@ GLOBAL_VALUE 8388608
GLOBAL_VALUE_ORIGIN CONFIG
DEFAULT_VALUE 134217728
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT
+VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT The size of the memory buffer InnoDB uses to cache data and indexes of its tables.
NUMERIC_MIN_VALUE 5242880
NUMERIC_MAX_VALUE 9223372036854775807
@@ -923,7 +923,7 @@ GLOBAL_VALUE 100
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 100
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Percentage of B-tree page filled during bulk insert
NUMERIC_MIN_VALUE 10
NUMERIC_MAX_VALUE 100
@@ -1679,7 +1679,7 @@ GLOBAL_VALUE 300
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT
+VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT How many files at the maximum InnoDB keeps open at the same time.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 9223372036854775807
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 07cec1844a6..ef88ba5fe67 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -2325,7 +2325,7 @@ btr_page_get_split_rec(
/* free_space is now the free space of a created new page */
total_data = page_get_data_size(page) + insert_size;
- total_n_recs = page_get_n_recs(page) + 1;
+ total_n_recs = ulint(page_get_n_recs(page)) + 1;
ut_ad(total_n_recs >= 2);
total_space = total_data + page_dir_calc_reserved_space(total_n_recs);
@@ -2436,7 +2436,7 @@ btr_page_insert_fits(
/* free_space is now the free space of a created new page */
total_data = page_get_data_size(page) + insert_size;
- total_n_recs = page_get_n_recs(page) + 1;
+ total_n_recs = ulint(page_get_n_recs(page)) + 1;
/* We determine which records (from rec to end_rec, not including
end_rec) will end up on the other half page from tuple when it is
@@ -3536,7 +3536,8 @@ btr_lift_page_up(
ulint* offsets = NULL;
mem_heap_t* heap = mem_heap_create(
sizeof(*offsets)
- * (REC_OFFS_HEADER_SIZE + 1 + 1 + index->n_fields));
+ * (REC_OFFS_HEADER_SIZE + 1 + 1
+ + unsigned(index->n_fields)));
buf_block_t* b;
if (dict_index_is_spatial(index)) {
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index 87316ec7638..3908b27e7b4 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -31,7 +31,7 @@ Created 03/11/2014 Shaohua Wang
#include "ibuf0ibuf.h"
/** Innodb B-tree index fill factor for bulk load. */
-long innobase_fill_factor;
+uint innobase_fill_factor;
/** Initialize members, allocate page if needed and start mtr.
Note: we commit all mtrs on failure.
@@ -462,15 +462,14 @@ PageBulk::copyOut(
page_rec_is_leaf(split_rec),
ULINT_UNDEFINED, &m_heap);
- m_free_space += rec_get_end(last_rec, offsets)
- - m_heap_top
+ m_free_space += ulint(rec_get_end(last_rec, offsets) - m_heap_top)
+ page_dir_calc_reserved_space(m_rec_no)
- page_dir_calc_reserved_space(n);
- ut_ad(m_free_space > 0);
+ ut_ad(lint(m_free_space) > 0);
m_rec_no = n;
#ifdef UNIV_DEBUG
- m_total_data -= rec_get_end(last_rec, offsets) - m_heap_top;
+ m_total_data -= ulint(rec_get_end(last_rec, offsets) - m_heap_top);
#endif /* UNIV_DEBUG */
}
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 1f827f567a8..89ddeed5e85 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -572,7 +572,8 @@ btr_cur_instant_root_init(dict_index_t* index, const page_t* page)
index root pages of ROW_FORMAT=COMPACT or
ROW_FORMAT=DYNAMIC when instant ADD COLUMN is not used. */
ut_ad(!page_is_comp(page) || !page_get_instant(page));
- 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));
return false;
case FIL_PAGE_TYPE_INSTANT:
break;
@@ -591,7 +592,7 @@ btr_cur_instant_root_init(dict_index_t* index, const page_t* page)
ut_ad(!index->is_dummy);
ut_d(index->is_dummy = true);
index->n_core_null_bytes = n == index->n_fields
- ? UT_BITS_IN_BYTES(index->n_nullable)
+ ? UT_BITS_IN_BYTES(unsigned(index->n_nullable))
: UT_BITS_IN_BYTES(index->get_n_nullable(n));
ut_d(index->is_dummy = false);
return false;
@@ -718,7 +719,7 @@ btr_cur_get_and_clear_intention(
/* both or unknown */
intention = BTR_INTENTION_BOTH;
}
- *latch_mode &= ~(BTR_LATCH_FOR_INSERT | BTR_LATCH_FOR_DELETE);
+ *latch_mode &= ulint(~(BTR_LATCH_FOR_INSERT | BTR_LATCH_FOR_DELETE));
return(intention);
}
@@ -865,7 +866,7 @@ btr_cur_will_modify_tree(
page_size.physical())
< rec_size * 2 + page_get_data_size(page)
+ page_dir_calc_reserved_space(
- page_get_n_recs(page) + 2) + 1) {
+ ulint(page_get_n_recs(page)) + 2) + 1) {
return(true);
}
}
@@ -1512,7 +1513,7 @@ retry_page_get:
root_height = height;
cursor->tree_height = root_height + 1;
- if (UNIV_UNLIKELY(dict_index_is_spatial(index))) {
+ if (dict_index_is_spatial(index)) {
ut_ad(cursor->rtr_info);
node_seq_t seq_no = rtr_get_current_ssn_id(index);
@@ -2263,14 +2264,14 @@ btr_cur_open_at_index_side_func(
rec_offs_init(offsets_);
estimate = latch_mode & BTR_ESTIMATE;
- latch_mode &= ~BTR_ESTIMATE;
+ latch_mode &= ulint(~BTR_ESTIMATE);
ut_ad(level != ULINT_UNDEFINED);
bool s_latch_by_caller;
s_latch_by_caller = latch_mode & BTR_ALREADY_S_LATCHED;
- latch_mode &= ~BTR_ALREADY_S_LATCHED;
+ latch_mode &= ulint(~BTR_ALREADY_S_LATCHED);
lock_intention = btr_cur_get_and_clear_intention(&latch_mode);
@@ -3522,7 +3523,7 @@ btr_cur_pessimistic_insert(
if (entry->info_bits & REC_INFO_MIN_REC_FLAG) {
ut_ad(entry->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(index->is_instant());
- ut_ad((flags & ~BTR_KEEP_IBUF_BITMAP)
+ ut_ad((flags & ulint(~BTR_KEEP_IBUF_BITMAP))
== BTR_NO_LOCKING_FLAG);
} else {
btr_search_update_hash_on_insert(
@@ -5773,11 +5774,10 @@ btr_estimate_n_rows_in_range_on_level(
estimation */
{
int64_t n_rows;
- ulint n_pages_read;
+ int n_pages_read = 0;
ulint level;
n_rows = 0;
- n_pages_read = 0;
/* Assume by default that we will scan all pages between
slot1->page_no and slot2->page_no. */
@@ -5787,14 +5787,14 @@ btr_estimate_n_rows_in_range_on_level(
the record which serves as a left border of the range, if any
(we don't include the record itself in this count). */
if (slot1->nth_rec <= slot1->n_recs) {
- n_rows += slot1->n_recs - slot1->nth_rec;
+ n_rows += int64_t(slot1->n_recs - slot1->nth_rec);
}
/* Add records from slot2->page_no which are to the left of
the record which servers as a right border of the range, if any
(we don't include the record itself in this count). */
if (slot2->nth_rec > 1) {
- n_rows += slot2->nth_rec - 1;
+ n_rows += int64_t(slot2->nth_rec) - 1;
}
/* Count the records in the pages between slot1->page_no and
@@ -5965,7 +5965,7 @@ btr_estimate_n_rows_in_range_low(
mtr_t mtr;
int64_t table_n_rows;
- table_n_rows = dict_table_get_n_rows(index->table);
+ table_n_rows = int64_t(dict_table_get_n_rows(index->table));
/* Below we dive to the two records specified by tuple1 and tuple2 and
we remember the entire dive paths from the tree root. The place where
@@ -6244,7 +6244,8 @@ btr_estimate_n_rows_in_range_low(
if (slot1->nth_rec < slot2->nth_rec) {
/* We do not count the borders (nor the left
nor the right one), thus "- 1". */
- n_rows = slot2->nth_rec - slot1->nth_rec - 1;
+ n_rows = int64_t(slot2->nth_rec
+ - slot1->nth_rec) - 1;
if (n_rows > 0) {
/* There is at least one row between
@@ -6280,12 +6281,12 @@ btr_estimate_n_rows_in_range_low(
n_rows = 0;
if (slot1->nth_rec < slot1->n_recs) {
- n_rows += slot1->n_recs
- - slot1->nth_rec;
+ n_rows += int64_t(slot1->n_recs
+ - slot1->nth_rec);
}
if (slot2->nth_rec > 1) {
- n_rows += slot2->nth_rec - 1;
+ n_rows += int64_t(slot2->nth_rec) - 1;
}
}
} else if (diverged_lot) {
@@ -6891,10 +6892,10 @@ btr_push_update_extern_fields(
uf->orig_len);
/* Copy the locally stored prefix. */
memcpy(buf, data,
- uf->orig_len
+ unsigned(uf->orig_len)
- BTR_EXTERN_FIELD_REF_SIZE);
/* Copy the BLOB pointer. */
- memcpy(buf + uf->orig_len
+ memcpy(buf + unsigned(uf->orig_len)
- BTR_EXTERN_FIELD_REF_SIZE,
data + len - BTR_EXTERN_FIELD_REF_SIZE,
BTR_EXTERN_FIELD_REF_SIZE);
@@ -7164,7 +7165,7 @@ btr_store_big_rec_extern_fields(
heap = mem_heap_create(250000);
page_zip_set_alloc(&c_stream, heap);
- err = deflateInit2(&c_stream, page_zip_level,
+ err = deflateInit2(&c_stream, int(page_zip_level),
Z_DEFLATED, 15, 7, Z_DEFAULT_STRATEGY);
ut_a(err == Z_OK);
}
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index e56df37107a..f074b304e70 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -669,7 +669,7 @@ btr_defragment_n_pages(
// For compressed pages, we take compression failures into account.
if (page_size.is_compressed()) {
ulint size = 0;
- int i = 0;
+ uint i = 0;
// We estimate the optimal data size of the index use samples of
// data size. These samples are taken when pages failed to
// compress due to insertion on the page. We use the average
@@ -683,7 +683,7 @@ btr_defragment_n_pages(
size += index->stat_defrag_data_size_sample[i];
}
if (i != 0) {
- size = size / i;
+ size /= i;
optimal_page_size = ut_min(optimal_page_size, size);
}
max_data_size = optimal_page_size;
diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc
index a1457956767..63a6ef0ea23 100644
--- a/storage/innobase/buf/buf0buddy.cc
+++ b/storage/innobase/buf/buf0buddy.cc
@@ -489,8 +489,8 @@ buf_buddy_alloc_low(
buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
ulint i, /*!< in: index of buf_pool->zip_free[],
or BUF_BUDDY_SIZES */
- ibool* lru) /*!< in: pointer to a variable that
- will be assigned TRUE if storage was
+ bool* lru) /*!< in: pointer to a variable that
+ will be assigned true if storage was
allocated from the LRU list and
buf_pool->mutex was temporarily
released */
@@ -522,7 +522,7 @@ buf_buddy_alloc_low(
/* Try replacing an uncompressed page in the buffer pool. */
buf_pool_mutex_exit(buf_pool);
block = buf_LRU_get_free_block(buf_pool);
- *lru = TRUE;
+ *lru = true;
buf_pool_mutex_enter(buf_pool);
alloc_big:
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 938da943bbd..3594be46d88 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -4044,7 +4044,7 @@ buf_block_from_ahi(const byte* ptr)
chunk = (--it)->second;
}
- ulint offs = ptr - chunk->blocks->frame;
+ ulint offs = ulint(ptr - chunk->blocks->frame);
offs >>= UNIV_PAGE_SIZE_SHIFT;
@@ -5336,7 +5336,7 @@ buf_page_init_for_read(
buf_page_t* watch_page;
rw_lock_t* hash_lock;
mtr_t mtr;
- ibool lru = FALSE;
+ bool lru = false;
void* data;
buf_pool_t* buf_pool = buf_pool_get(page_id);
@@ -5627,7 +5627,7 @@ buf_page_create(
if (page_size.is_compressed()) {
void* data;
- ibool lru;
+ bool lru;
/* Prevent race conditions during buf_buddy_alloc(),
which may release and reacquire buf_pool->mutex,
@@ -5986,7 +5986,7 @@ buf_page_io_complete(buf_page_t* bpage, bool dblwr, bool evict)
my_atomic_addlint(&buf_pool->n_pend_unzip, 1);
ibool ok = buf_zip_decompress((buf_block_t*) bpage,
FALSE);
- my_atomic_addlint(&buf_pool->n_pend_unzip, -1);
+ my_atomic_addlint(&buf_pool->n_pend_unzip, ulint(-1));
if (!ok) {
ib::info() << "Page "
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index 2ceb6bfd21a..f5e480ce453 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -2778,8 +2778,8 @@ pc_flush_slot(void)
{
ulint lru_tm = 0;
ulint list_tm = 0;
- int lru_pass = 0;
- int list_pass = 0;
+ ulint lru_pass = 0;
+ ulint list_pass = 0;
mutex_enter(&page_cleaner.mutex);
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index 6601edfec9d..809a60d6431 100644
--- a/storage/innobase/data/data0data.cc
+++ b/storage/innobase/data/data0data.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -346,7 +346,7 @@ dfield_print_also_hex(
val = mach_read_from_1(data);
if (!(prtype & DATA_UNSIGNED)) {
- val &= ~0x80;
+ val &= ~0x80U;
fprintf(stderr, "%ld", (long) val);
} else {
fprintf(stderr, "%lu", (ulong) val);
@@ -357,7 +357,7 @@ dfield_print_also_hex(
val = mach_read_from_2(data);
if (!(prtype & DATA_UNSIGNED)) {
- val &= ~0x8000;
+ val &= ~0x8000U;
fprintf(stderr, "%ld", (long) val);
} else {
fprintf(stderr, "%lu", (ulong) val);
@@ -368,7 +368,7 @@ dfield_print_also_hex(
val = mach_read_from_3(data);
if (!(prtype & DATA_UNSIGNED)) {
- val &= ~0x800000;
+ val &= ~0x800000U;
fprintf(stderr, "%ld", (long) val);
} else {
fprintf(stderr, "%lu", (ulong) val);
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index 047cc3abe14..cd4f6cab91c 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -368,7 +368,7 @@ dict_boot(void)
ut_a(index);
ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
- table->indexes.start->n_nullable);
+ unsigned(table->indexes.start->n_nullable));
/*-------------------------*/
index = dict_mem_index_create(table, "ID_IND", DICT_UNIQUE, 1);
@@ -410,7 +410,7 @@ dict_boot(void)
ut_a(index);
ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
- table->indexes.start->n_nullable);
+ unsigned(table->indexes.start->n_nullable));
/*-------------------------*/
table = dict_mem_table_create("SYS_INDEXES", fil_system.sys_space,
@@ -453,7 +453,7 @@ dict_boot(void)
ut_a(index);
ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
- table->indexes.start->n_nullable);
+ unsigned(table->indexes.start->n_nullable));
/*-------------------------*/
table = dict_mem_table_create("SYS_FIELDS", fil_system.sys_space,
@@ -482,7 +482,7 @@ dict_boot(void)
ut_a(index);
ut_ad(!table->is_instant());
table->indexes.start->n_core_null_bytes = UT_BITS_IN_BYTES(
- table->indexes.start->n_nullable);
+ unsigned(table->indexes.start->n_nullable));
mtr_commit(&mtr);
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index fa9eeeae620..0db7906c70d 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -101,13 +101,11 @@ dict_create_sys_tables_tuple(
/* If there is any virtual column, encode it in N_COLS */
mach_write_to_4(ptr, dict_table_encode_n_col(
- static_cast<ulint>(table->n_cols
- - DATA_N_SYS_COLS),
- static_cast<ulint>(table->n_v_def))
- | ((table->flags & DICT_TF_COMPACT) << 31));
+ ulint(table->n_cols - DATA_N_SYS_COLS),
+ ulint(table->n_v_def))
+ | (ulint(table->flags & DICT_TF_COMPACT) << 31));
dfield_set_data(dfield, ptr, 4);
-
/* 5: TYPE (table flags) -----------------------------*/
dfield = dtuple_get_nth_field(
entry, DICT_COL__SYS_TABLES__TYPE);
@@ -1350,9 +1348,10 @@ dict_create_index_step(
== ((dict_index_is_clust(node->index)
&& node->table->supports_instant())
? dict_index_t::NO_CORE_NULL_BYTES
- : UT_BITS_IN_BYTES(node->index->n_nullable)));
+ : UT_BITS_IN_BYTES(
+ unsigned(node->index->n_nullable))));
node->index->n_core_null_bytes = UT_BITS_IN_BYTES(
- node->index->n_nullable);
+ unsigned(node->index->n_nullable));
node->state = INDEX_CREATE_INDEX_TREE;
}
@@ -1931,7 +1930,8 @@ dict_create_add_foreign_to_dictionary(
foreign->referenced_table_name);
pars_info_add_int4_literal(info, "n_cols",
- foreign->n_fields + (foreign->type << 24));
+ ulint(foreign->n_fields)
+ | (ulint(foreign->type) << 24));
DBUG_PRINT("dict_create_add_foreign_to_dictionary",
("'%s', '%s', '%s', %d", foreign->id, name,
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 08d489a63c4..11c52a30519 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -251,7 +251,7 @@ dict_get_db_name_len(
const char* s;
s = strchr(name, '/');
ut_a(s);
- return(s - name);
+ return ulint(s - name);
}
/** Reserve the dictionary system mutex. */
@@ -619,12 +619,12 @@ const char* dict_col_t::name(const dict_table_t& table) const
const char *s;
if (is_virtual()) {
- col_nr = reinterpret_cast<const dict_v_col_t*>(this)
- - table.v_cols;
+ col_nr = size_t(reinterpret_cast<const dict_v_col_t*>(this)
+ - table.v_cols);
ut_ad(col_nr < table.n_v_def);
s = table.v_col_names;
} else {
- col_nr = this - table.cols;
+ col_nr = size_t(this - table.cols);
ut_ad(col_nr < table.n_def);
s = table.col_names;
}
@@ -2136,11 +2136,11 @@ dict_index_node_ptr_max_size(
if (comp) {
/* Include the "null" flags in the
maximum possible record size. */
- rec_max_size += UT_BITS_IN_BYTES(index->n_nullable);
+ rec_max_size += UT_BITS_IN_BYTES(unsigned(index->n_nullable));
} else {
/* For each column, include a 2-byte offset and a
"null" flag. */
- rec_max_size += 2 * index->n_fields;
+ rec_max_size += 2 * unsigned(index->n_fields);
}
/* Compute the maximum possible record size. */
@@ -2263,14 +2263,15 @@ dict_index_too_big_for_tree(
if (comp) {
/* Include the "null" flags in the
maximum possible record size. */
- rec_max_size += UT_BITS_IN_BYTES(new_index->n_nullable);
+ rec_max_size += UT_BITS_IN_BYTES(
+ unsigned(new_index->n_nullable));
} else {
/* For each column, include a 2-byte offset and a
"null" flag. The 1-byte format is only used in short
records that do not contain externally stored columns.
Such records could never exceed the page limit, even
when using the 2-byte format. */
- rec_max_size += 2 * new_index->n_fields;
+ rec_max_size += 2 * unsigned(new_index->n_fields);
}
/* Compute the maximum possible record size. */
@@ -2418,7 +2419,7 @@ dict_index_add_to_cache(
? dict_index_build_internal_fts(index)
: dict_index_build_internal_non_clust(index);
new_index->n_core_null_bytes = UT_BITS_IN_BYTES(
- new_index->n_nullable);
+ unsigned(new_index->n_nullable));
}
/* Set the n_fields value in new_index to the actual defined
@@ -2780,7 +2781,7 @@ dict_index_add_col(
dict_mem_index_add_field(index, col_name, prefix_len);
- field = dict_index_get_nth_field(index, index->n_def - 1);
+ field = dict_index_get_nth_field(index, unsigned(index->n_def) - 1);
field->col = col;
field->fixed_len = static_cast<unsigned int>(
@@ -2969,7 +2970,8 @@ dict_index_build_internal_clust(
/* Create a new index object with certainly enough fields */
new_index = dict_mem_index_create(index->table, index->name,
index->type,
- index->n_fields + table->n_cols);
+ unsigned(index->n_fields
+ + table->n_cols));
/* Copy other relevant data from the old index struct to the new
struct: it inherits the values */
@@ -2988,7 +2990,7 @@ dict_index_build_internal_clust(
new_index->n_uniq = new_index->n_def;
} else {
/* Also the row id is needed to identify the entry */
- new_index->n_uniq = 1 + new_index->n_def;
+ new_index->n_uniq = 1 + unsigned(new_index->n_def);
}
new_index->trx_id_offset = 0;
@@ -3095,7 +3097,7 @@ dict_index_build_internal_clust(
new_index->n_core_null_bytes = table->supports_instant()
? dict_index_t::NO_CORE_NULL_BYTES
- : UT_BITS_IN_BYTES(new_index->n_nullable);
+ : UT_BITS_IN_BYTES(unsigned(new_index->n_nullable));
new_index->cached = TRUE;
return(new_index);
@@ -3134,7 +3136,7 @@ dict_index_build_internal_non_clust(
/* Create a new index */
new_index = dict_mem_index_create(
index->table, index->name, index->type,
- index->n_fields + 1 + clust_index->n_uniq);
+ ulint(index->n_fields + 1 + clust_index->n_uniq));
/* Copy other relevant data from the old index
struct to the new struct: it inherits the values */
@@ -3790,7 +3792,7 @@ dict_scan_id(
ptr++;
}
- len = ptr - s;
+ len = ulint(ptr - s);
}
if (heap == NULL) {
@@ -3811,7 +3813,7 @@ dict_scan_id(
}
}
*d++ = 0;
- len = d - str;
+ len = ulint(d - str);
ut_ad(*s == quote);
ut_ad(s + 1 == ptr);
} else {
@@ -4030,7 +4032,7 @@ dict_scan_table_name(
for (s = scan_name; *s; s++) {
if (*s == '.') {
database_name = scan_name;
- database_name_len = s - scan_name;
+ database_name_len = ulint(s - scan_name);
scan_name = ++s;
break;/* to do: multiple dots? */
}
@@ -7004,7 +7006,7 @@ dict_index_zip_pad_update(
/* Use atomics even though we have the mutex.
This is to ensure that we are able to read
info->pad atomically. */
- my_atomic_addlint(&info->pad, -ZIP_PAD_INCR);
+ my_atomic_addlint(&info->pad, ulint(-ZIP_PAD_INCR));
info->n_rounds = 0;
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index b45720a3313..bae4bb7d49c 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -1138,7 +1138,7 @@ dict_sys_tables_type_valid(ulint type, bool not_redundant)
if (!not_redundant) {
/* SYS_TABLES.TYPE must be 1 or 1|DICT_TF_MASK_NO_ROLLBACK
for ROW_FORMAT=REDUNDANT. */
- return !(type & ~(1 | DICT_TF_MASK_NO_ROLLBACK));
+ return !(type & ~(1U | DICT_TF_MASK_NO_ROLLBACK));
}
if (type >= 1U << DICT_TF_POS_UNUSED) {
@@ -2032,7 +2032,7 @@ dict_load_field_low(
ulint len;
unsigned pos_and_prefix_len;
unsigned prefix_len;
- ibool first_field;
+ bool first_field;
ulint position;
/* Either index or sys_field is supplied, not both */
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;
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index 88460978ade..06b8c81ad57 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1042,7 +1042,7 @@ dict_stats_analyze_index_level(
offsets[0] and the REC_OFFS_HEADER_SIZE bytes), and n_fields + 1,
so that this will never be less than the size calculated in
rec_get_offsets_func(). */
- i = (REC_OFFS_HEADER_SIZE + 1 + 1) + index->n_fields;
+ i = (REC_OFFS_HEADER_SIZE + 1 + 1) + unsigned(index->n_fields);
heap = mem_heap_create((2 * sizeof *rec_offsets) * i);
rec_offsets = static_cast<ulint*>(
@@ -2332,7 +2332,7 @@ dict_stats_save_index_stat(
pars_info_add_str_literal(pinfo, "table_name", table_utf8);
pars_info_add_str_literal(pinfo, "index_name", index->name);
UNIV_MEM_ASSERT_RW_ABORT(&last_update, 4);
- pars_info_add_int4_literal(pinfo, "last_update", (lint)last_update);
+ pars_info_add_int4_literal(pinfo, "last_update", uint32(last_update));
UNIV_MEM_ASSERT_RW_ABORT(stat_name, strlen(stat_name));
pars_info_add_str_literal(pinfo, "stat_name", stat_name);
UNIV_MEM_ASSERT_RW_ABORT(&stat_value, 8);
@@ -2464,7 +2464,7 @@ dict_stats_save(
pars_info_add_str_literal(pinfo, "database_name", db_utf8);
pars_info_add_str_literal(pinfo, "table_name", table_utf8);
- pars_info_add_int4_literal(pinfo, "last_update", (lint)now);
+ pars_info_add_int4_literal(pinfo, "last_update", uint32(now));
pars_info_add_ull_literal(pinfo, "n_rows", table->stat_n_rows);
pars_info_add_ull_literal(pinfo, "clustered_index_size",
table->stat_clustered_index_size);
@@ -2910,7 +2910,7 @@ dict_stats_fetch_index_stats_step(
/* extract 12 from "n_diff_pfx12..." into n_pfx
note that stat_name does not have a terminating '\0' */
- n_pfx = (num_ptr[0] - '0') * 10 + (num_ptr[1] - '0');
+ n_pfx = ulong(num_ptr[0] - '0') * 10 + ulong(num_ptr[1] - '0');
ulint n_uniq = index->n_uniq;
diff --git a/storage/innobase/eval/eval0eval.cc b/storage/innobase/eval/eval0eval.cc
index fa0b265b3db..6cc63b3a004 100644
--- a/storage/innobase/eval/eval0eval.cc
+++ b/storage/innobase/eval/eval0eval.cc
@@ -585,7 +585,7 @@ eval_instr(
/* We have already matched j characters */
if (j == len2) {
- int_val = i + 1;
+ int_val = lint(i) + 1;
goto match_found;
}
@@ -781,7 +781,7 @@ eval_predefined(
}
/* allocate the string */
- data = eval_node_ensure_val_buf(func_node, int_len + 1);
+ data = eval_node_ensure_val_buf(func_node, ulint(int_len) + 1);
/* add terminating NUL character */
data[int_len] = 0;
@@ -804,7 +804,7 @@ eval_predefined(
}
}
- dfield_set_len(que_node_get_val(func_node), int_len);
+ dfield_set_len(que_node_get_val(func_node), ulint(int_len));
return;
@@ -833,12 +833,11 @@ eval_func(
{
que_node_t* arg;
ulint fclass;
- ulint func;
ut_ad(que_node_get_type(func_node) == QUE_NODE_FUNC);
fclass = func_node->fclass;
- func = func_node->func;
+ const int func = func_node->func;
arg = func_node->args;
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 48045728c86..216fa9081e5 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1068,7 +1068,7 @@ fil_space_extend_must_retry(
space->size += file_size - node->size;
node->size = file_size;
const ulint pages_in_MiB = node->size
- & ~((1 << (20 - UNIV_PAGE_SIZE_SHIFT)) - 1);
+ & ~ulint((1U << (20U - srv_page_size_shift)) - 1);
fil_node_complete_io(node,IORequestRead);
@@ -1199,7 +1199,8 @@ fil_mutex_enter_and_prepare_for_io(
}
}
- if (ulint size = ulint(UNIV_UNLIKELY(space->recv_size))) {
+ ulint size = space->recv_size;
+ if (UNIV_UNLIKELY(size != 0)) {
ut_ad(node);
bool success;
if (fil_space_extend_must_retry(space, node, size,
@@ -2130,12 +2131,13 @@ fil_create_directory_for_tablename(
len = strlen(fil_path_to_mysql_datadir);
namend = strchr(name, '/');
ut_a(namend);
- path = static_cast<char*>(ut_malloc_nokey(len + (namend - name) + 2));
+ path = static_cast<char*>(
+ ut_malloc_nokey(len + ulint(namend - name) + 2));
memcpy(path, fil_path_to_mysql_datadir, len);
path[len] = '/';
- memcpy(path + len + 1, name, namend - name);
- path[len + (namend - name) + 1] = 0;
+ memcpy(path + len + 1, name, ulint(namend - name));
+ path[len + ulint(namend - name) + 1] = 0;
os_normalize_path(path);
@@ -2339,9 +2341,9 @@ fil_op_replay_rename(
ut_a(namend != NULL);
char* dir = static_cast<char*>(
- ut_malloc_nokey(namend - new_name + 1));
+ ut_malloc_nokey(ulint(namend - new_name) + 1));
- memcpy(dir, new_name, namend - new_name);
+ memcpy(dir, new_name, ulint(namend - new_name));
dir[namend - new_name] = '\0';
bool success = os_file_create_directory(dir, false);
@@ -2350,7 +2352,7 @@ fil_op_replay_rename(
ulint dirlen = 0;
if (const char* dirend = strrchr(dir, OS_PATH_SEPARATOR)) {
- dirlen = dirend - dir + 1;
+ dirlen = ulint(dirend - dir) + 1;
}
ut_free(dir);
@@ -2369,7 +2371,7 @@ fil_op_replay_rename(
strlen(new_name + dirlen)
- 4 /* remove ".ibd" */);
- ut_ad(new_table[namend - new_name - dirlen]
+ ut_ad(new_table[ulint(namend - new_name) - dirlen]
== OS_PATH_SEPARATOR);
#if OS_PATH_SEPARATOR != '/'
new_table[namend - new_name - dirlen] = '/';
@@ -3806,7 +3808,7 @@ fil_path_to_space_name(
while (const char* t = static_cast<const char*>(
memchr(tablename, OS_PATH_SEPARATOR,
- end - tablename))) {
+ ulint(end - tablename)))) {
dbname = tablename;
tablename = t + 1;
}
@@ -3818,7 +3820,7 @@ fil_path_to_space_name(
ut_ad(end - tablename > 4);
ut_ad(memcmp(end - 4, DOT_IBD, 4) == 0);
- char* name = mem_strdupl(dbname, end - dbname - 4);
+ char* name = mem_strdupl(dbname, ulint(end - dbname) - 4);
ut_ad(name[tablename - dbname - 1] == OS_PATH_SEPARATOR);
#if OS_PATH_SEPARATOR != '/'
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 30195b3021f..c4052a87518 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -155,7 +155,7 @@ fil_compress_page(
/* If no compression level was provided to this table, use system
default level */
if (comp_level == 0) {
- comp_level = page_zip_level;
+ comp_level = int(page_zip_level);
}
DBUG_LOG("compress", "Preparing for space "
diff --git a/storage/innobase/fts/fts0config.cc b/storage/innobase/fts/fts0config.cc
index 7ad7459ea6a..6b6042dee66 100644
--- a/storage/innobase/fts/fts0config.cc
+++ b/storage/innobase/fts/fts0config.cc
@@ -422,7 +422,7 @@ fts_config_set_ulint(
ut_a(FTS_MAX_INT_LEN < FTS_MAX_CONFIG_VALUE_LEN);
- value.f_len = snprintf(
+ value.f_len = (ulint) snprintf(
(char*) value.f_str, FTS_MAX_INT_LEN, ULINTPF, int_value);
error = fts_config_set_value(trx, fts_table, name, &value);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index c06de6a9add..ca75531acab 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -2005,7 +2005,7 @@ fts_create_one_index_table(
? DATA_VARCHAR : DATA_VARMYSQL,
field->col->prtype,
FTS_MAX_WORD_LEN_IN_CHAR
- * field->col->mbmaxlen);
+ * unsigned(field->col->mbmaxlen));
dict_mem_table_add_col(new_table, heap, "first_doc_id", DATA_INT,
DATA_NOT_NULL | DATA_UNSIGNED,
@@ -2810,7 +2810,7 @@ fts_update_sync_doc_id(
info = pars_info_create();
- id_len = snprintf(
+ id_len = (ulint) snprintf(
(char*) id, sizeof(id), FTS_DOC_ID_FORMAT, doc_id + 1);
pars_info_bind_varchar_literal(info, "doc_id", id, id_len);
@@ -4737,9 +4737,9 @@ fts_tokenize_add_word_for_parser(
ut_ad(result_doc != NULL);
str.f_str = (byte*)(word);
- str.f_len = word_len;
+ str.f_len = ulint(word_len);
str.f_n_char = fts_get_token_size(
- const_cast<CHARSET_INFO*>(param->cs), word, word_len);
+ const_cast<CHARSET_INFO*>(param->cs), word, str.f_len);
/* JAN: TODO: MySQL 5.7 FTS
ut_ad(boolean_info->position >= 0);
@@ -5942,7 +5942,7 @@ fts_is_aux_table_name(
if (ptr != NULL) {
/* We will start the match after the '/' */
++ptr;
- len = end - ptr;
+ len = ulint(end - ptr);
}
/* All auxiliary tables are prefixed with "FTS_" and the name
@@ -5969,7 +5969,7 @@ fts_is_aux_table_name(
/* Skip the underscore. */
++ptr;
ut_a(end > ptr);
- len = end - ptr;
+ len = ulint(end - ptr);
/* First search the common table suffix array. */
for (i = 0; fts_common_tables[i] != NULL; ++i) {
@@ -6000,7 +6000,7 @@ fts_is_aux_table_name(
/* Skip the underscore. */
++ptr;
ut_a(end > ptr);
- len = end - ptr;
+ len = ulint(end - ptr);
/* Search the FT index specific array. */
for (i = 0; i < FTS_NUM_AUX_INDEX; ++i) {
diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc
index 2d8944f0290..bd838726e71 100644
--- a/storage/innobase/fts/fts0opt.cc
+++ b/storage/innobase/fts/fts0opt.cc
@@ -635,9 +635,9 @@ fts_zip_read_word(
ptr[len] = 0;
zip->zp->next_out = ptr;
- zip->zp->avail_out = len;
+ zip->zp->avail_out = uInt(len);
- word->f_len = len;
+ word->f_len = ulint(len);
len = 0;
}
break;
@@ -690,15 +690,15 @@ fts_fetch_index_words(
/* Skip the duplicate words. */
if (zip->word.f_len == static_cast<ulint>(len)
- && !memcmp(zip->word.f_str, data, len)) {
+ && !memcmp(zip->word.f_str, data, zip->word.f_len)) {
return(TRUE);
}
ut_a(len <= FTS_MAX_WORD_LEN);
- memcpy(zip->word.f_str, data, len);
- zip->word.f_len = len;
+ zip->word.f_len = ulint(len);
+ memcpy(zip->word.f_str, data, zip->word.f_len);
ut_a(zip->zp->avail_in == 0);
ut_a(zip->zp->next_in == NULL);
@@ -727,7 +727,7 @@ fts_fetch_index_words(
case Z_OK:
if (zip->zp->avail_in == 0) {
zip->zp->next_in = static_cast<byte*>(data);
- zip->zp->avail_in = len;
+ zip->zp->avail_in = uInt(len);
ut_a(len <= FTS_MAX_WORD_LEN);
len = 0;
}
@@ -1158,7 +1158,7 @@ fts_optimize_encode_node(
++src;
/* Number of encoded pos bytes to copy. */
- pos_enc_len = src - enc->src_ilist_ptr;
+ pos_enc_len = ulint(src - enc->src_ilist_ptr);
/* Total number of bytes required for copy. */
enc_len += pos_enc_len;
@@ -1230,7 +1230,7 @@ fts_optimize_node(
enc->src_ilist_ptr = src_node->ilist;
}
- copied = enc->src_ilist_ptr - src_node->ilist;
+ copied = ulint(enc->src_ilist_ptr - src_node->ilist);
/* While there is data in the source node and space to copy
into in the destination node. */
@@ -1251,7 +1251,7 @@ test_again:
fts_update_t* update;
update = (fts_update_t*) ib_vector_get(
- del_vec, *del_pos);
+ del_vec, ulint(*del_pos));
del_doc_id = update->doc_id;
}
@@ -1295,7 +1295,7 @@ test_again:
}
/* Bytes copied so for from source. */
- copied = enc->src_ilist_ptr - src_node->ilist;
+ copied = ulint(enc->src_ilist_ptr - src_node->ilist);
}
if (copied >= src_node->ilist_size) {
@@ -1402,7 +1402,7 @@ fts_optimize_word(
ut_a(enc.src_ilist_ptr != NULL);
/* Determine the numer of bytes copied to dst_node. */
- copied = enc.src_ilist_ptr - src_node->ilist;
+ copied = ulint(enc.src_ilist_ptr - src_node->ilist);
/* Can't copy more than whats in the vlc array. */
ut_a(copied <= src_node->ilist_size);
diff --git a/storage/innobase/fts/fts0plugin.cc b/storage/innobase/fts/fts0plugin.cc
index b7a05deeb34..1040439cb17 100644
--- a/storage/innobase/fts/fts0plugin.cc
+++ b/storage/innobase/fts/fts0plugin.cc
@@ -134,7 +134,7 @@ fts_query_add_word_for_parser(
case FT_TOKEN_WORD:
term_node = fts_ast_create_node_term_for_parser(
- state, word, word_len);
+ state, word, ulint(word_len));
if (info->trunc) {
fts_ast_term_set_wildcard(term_node);
@@ -251,7 +251,7 @@ fts_parse_query_internal(
int ret = param->mysql_add_word(
param,
reinterpret_cast<char*>(w.pos),
- w.len, &info);
+ int(w.len), &info);
if (ret) {
return(ret);
}
diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc
index 598573c2192..ff4b7acb476 100644
--- a/storage/innobase/fts/fts0que.cc
+++ b/storage/innobase/fts/fts0que.cc
@@ -1772,8 +1772,8 @@ fts_query_match_phrase_add_word_for_parser(
}
match.f_str = (uchar *)(word);
- match.f_len = word_len;
- match.f_n_char = fts_get_token_size(phrase->charset, word, word_len);
+ match.f_len = ulint(word_len);
+ match.f_n_char= fts_get_token_size(phrase->charset, word, match.f_len);
if (match.f_len > 0) {
/* Get next token to match. */
@@ -1905,7 +1905,7 @@ fts_query_match_phrase(
&phrase_param,
phrase->parser,
ptr,
- (end - ptr))) {
+ ulint(end - ptr))) {
break;
}
} else {
@@ -3296,7 +3296,7 @@ fts_query_filter_doc_ids(
++ptr;
/* Bytes decoded so far */
- decoded = ptr - (byte*) data;
+ decoded = ulint(ptr - (byte*) data);
/* We simply collect the matching documents and the
positions here and match later. */
@@ -4105,7 +4105,7 @@ fts_query(
<< diff_time / 1000 << " secs: " << diff_time % 1000
<< " millisec: row(s) "
<< ((*result)->rankings_by_id
- ? rbt_size((*result)->rankings_by_id)
+ ? lint(rbt_size((*result)->rankings_by_id))
: -1);
/* Log memory consumption & result size */
diff --git a/storage/innobase/fts/fts0sql.cc b/storage/innobase/fts/fts0sql.cc
index ae2186c2d30..54b0595f36f 100644
--- a/storage/innobase/fts/fts0sql.cc
+++ b/storage/innobase/fts/fts0sql.cc
@@ -116,7 +116,8 @@ fts_get_table_name_prefix(
prefix_name_len = dbname_len + 4 + len + 1;
- prefix_name = static_cast<char*>(ut_malloc_nokey(prefix_name_len));
+ prefix_name = static_cast<char*>(
+ ut_malloc_nokey(unsigned(prefix_name_len)));
len = sprintf(prefix_name, "%.*sFTS_%s",
dbname_len, fts_table->parent, table_id);
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index ee0817947fc..24e08dfbaf4 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -71,7 +71,7 @@ rtr_page_split_initialize_nodes(
page = buf_block_get_frame(block);
n_uniq = dict_index_get_n_unique_in_tree(cursor->index);
- n_recs = page_get_n_recs(page) + 1;
+ n_recs = ulint(page_get_n_recs(page)) + 1;
/*We reserve 2 MBRs memory space for temp result of split
algrithm. And plus the new mbr that need to insert, we
@@ -1065,7 +1065,7 @@ func_start:
*heap, cursor, offsets, tuple, &buf_pos);
/* Divide all mbrs to two groups. */
- n_recs = page_get_n_recs(page) + 1;
+ n_recs = ulint(page_get_n_recs(page)) + 1;
end_split_node = rtr_split_node_array + n_recs;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2940184ff91..3fbe9868bff 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -188,13 +188,13 @@ static const long AUTOINC_NEW_STYLE_LOCKING = 1;
static const long AUTOINC_NO_LOCKING = 2;
static long innobase_log_buffer_size;
-static long innobase_open_files=0;
+static ulong innobase_open_files;
static long innobase_autoinc_lock_mode;
static ulong innobase_commit_concurrency = 0;
static ulong innobase_read_io_threads;
static ulong innobase_write_io_threads;
-static long long innobase_buffer_pool_size;
+static ulonglong innobase_buffer_pool_size;
/** Percentage of the buffer pool to reserve for 'old' blocks.
Connected to buf_LRU_old_ratio. */
@@ -1815,19 +1815,6 @@ thd_lock_wait_timeout(
return(THDVAR(thd, lock_wait_timeout));
}
-/******************************************************************//**
-Set the time waited for the lock for the current query. */
-void
-thd_set_lock_wait_time(
-/*===================*/
- THD* thd, /*!< in/out: thread handle */
- ulint value) /*!< in: time waited for the lock */
-{
- if (thd) {
- thd_storage_lock_wait(thd, value);
- }
-}
-
/** Get the value of innodb_tmpdir.
@param[in] thd thread handle, or NULL to query
the global innodb_tmpdir.
@@ -1890,7 +1877,7 @@ Converts an InnoDB error code to a MySQL error code and also tells to MySQL
about a possible transaction rollback inside InnoDB caused by a lock wait
timeout or a deadlock.
@return MySQL error code */
-int
+static int
convert_error_code_to_mysql(
/*========================*/
dberr_t error, /*!< in: InnoDB error code */
@@ -2110,17 +2097,6 @@ innobase_mysql_print_thd(
}
/******************************************************************//**
-Get the error message format string.
-@return the format string or 0 if not found. */
-const char*
-innobase_get_err_msg(
-/*=================*/
- int error_code) /*!< in: MySQL error code */
-{
- return(my_get_err_msg(error_code));
-}
-
-/******************************************************************//**
Get the variable length bounds of the given character set. */
void
innobase_get_cset_width(
@@ -3198,12 +3174,12 @@ innobase_invalidate_query_cache(
char db_name[NAME_CHAR_LEN * MY_CS_MBMAXLEN + 1];
const char *key_ptr;
size_t tabname_len;
- size_t dbname_len;
// Extract the database name.
key_ptr= strchr(full_name, '/');
DBUG_ASSERT(key_ptr != NULL); // Database name should be present
- memcpy(db_name, full_name, (dbname_len= (key_ptr - full_name)));
+ size_t dbname_len= size_t(key_ptr - full_name);
+ memcpy(db_name, full_name, dbname_len);
db_name[dbname_len]= '\0';
/* Construct the key("db-name\0table$name\0") for the query cache using
@@ -3272,9 +3248,9 @@ innobase_quote_identifier(
if (q == EOF) {
quoted_identifier.append(id);
} else {
- quoted_identifier += (unsigned char)q;
+ quoted_identifier += char(q);
quoted_identifier.append(id);
- quoted_identifier += (unsigned char)q;
+ quoted_identifier += char(q);
}
return (quoted_identifier);
@@ -3342,12 +3318,13 @@ innobase_convert_name(
}
/* Print the database name and table name separately. */
- s = innobase_convert_identifier(s, bufend - s, id, slash - id, thd);
+ s = innobase_convert_identifier(s, ulint(bufend - s),
+ id, ulint(slash - id), thd);
if (s < bufend) {
*s++ = '.';
- s = innobase_convert_identifier(s, bufend - s,
+ s = innobase_convert_identifier(s, ulint(bufend - s),
slash + 1, idlen
- - (slash - id) - 1,
+ - ulint(slash - id) - 1,
thd);
}
@@ -3376,8 +3353,8 @@ innobase_format_name(
/**********************************************************************//**
Determines if the currently running transaction has been interrupted.
-@return TRUE if interrupted */
-ibool
+@return true if interrupted */
+bool
trx_is_interrupted(
/*===============*/
const trx_t* trx) /*!< in: transaction */
@@ -3413,7 +3390,7 @@ ha_innobase::reset_template(void)
}
);
- m_prebuilt->keep_other_fields_on_keyread = 0;
+ m_prebuilt->keep_other_fields_on_keyread = false;
m_prebuilt->read_just_key = 0;
m_prebuilt->in_fts_query = 0;
@@ -4001,7 +3978,7 @@ innobase_change_buffering_inited_ok:
srv_log_buffer_size = (ulint) innobase_log_buffer_size;
- srv_buf_pool_size = (ulint) innobase_buffer_pool_size;
+ srv_buf_pool_size = ulint(innobase_buffer_pool_size);
srv_n_read_io_threads = (ulint) innobase_read_io_threads;
srv_n_write_io_threads = (ulint) innobase_write_io_threads;
@@ -4041,16 +4018,16 @@ innobase_change_buffering_inited_ok:
}
}
- if (innobase_open_files > (long) open_files_limit) {
+ if (innobase_open_files > open_files_limit) {
ib::warn() << "innodb_open_files " << innobase_open_files
<< " should not be greater"
<< "than the open_files_limit " << open_files_limit;
- if (innobase_open_files > (long) tc_size) {
+ if (innobase_open_files > tc_size) {
innobase_open_files = tc_size;
}
}
- srv_max_n_open_files = (ulint) innobase_open_files;
+ srv_max_n_open_files = innobase_open_files;
srv_innodb_status = (ibool) innobase_create_status_file;
srv_print_verbose_log = mysqld_embedded ? 0 : 1;
@@ -4129,7 +4106,7 @@ innobase_change_buffering_inited_ok:
err = innobase_start_or_create_for_mysql();
- innobase_buffer_pool_size = static_cast<long long>(srv_buf_pool_size);
+ innobase_buffer_pool_size = srv_buf_pool_size;
if (err != DB_SUCCESS) {
innodb_shutdown();
@@ -4389,11 +4366,8 @@ innobase_commit_ordered_2(
If the binary log is not enabled, or the transaction
is not written to the binary log, the file name will
be a NULL pointer. */
- ulonglong pos;
-
- thd_binlog_pos(thd, &trx->mysql_log_file_name, &pos);
-
- trx->mysql_log_offset = static_cast<int64_t>(pos);
+ thd_binlog_pos(thd, &trx->mysql_log_file_name,
+ &trx->mysql_log_offset);
/* Don't do write + flush right now. For group commit
to work we want to do the flush later. */
@@ -4811,7 +4785,7 @@ innobase_rollback_to_savepoint(
char name[64];
- longlong2str((ulint) savepoint, name, 36);
+ longlong2str(longlong(savepoint), name, 36);
int64_t mysql_binlog_cache_pos;
@@ -4880,7 +4854,7 @@ innobase_release_savepoint(
/* TODO: use provided savepoint data area to store savepoint data */
- longlong2str((ulint) savepoint, name, 36);
+ longlong2str(longlong(savepoint), name, 36);
error = trx_release_savepoint_for_mysql(trx, name);
@@ -4919,7 +4893,7 @@ innobase_savepoint(
/* TODO: use provided savepoint data area to store savepoint data */
char name[64];
- longlong2str((ulint) savepoint,name,36);
+ longlong2str(longlong(savepoint), name, 36);
dberr_t error = trx_savepoint_for_mysql(trx, name, 0);
@@ -5075,9 +5049,7 @@ ha_innobase::table_flags() const
/* Need to use tx_isolation here since table flags is (also)
called before prebuilt is inited. */
- ulong const tx_isolation = thd_tx_isolation(thd);
-
- if (tx_isolation <= ISO_READ_COMMITTED) {
+ if (thd_tx_isolation(thd) <= ISO_READ_COMMITTED) {
return(flags);
}
@@ -5648,7 +5620,7 @@ innobase_build_v_templ(
const dict_add_v_col_t* add_v,
bool locked)
{
- ulint ncol = ib_table->n_cols - DATA_N_SYS_COLS;
+ ulint ncol = unsigned(ib_table->n_cols) - DATA_N_SYS_COLS;
ulint n_v_col = ib_table->n_v_cols;
bool marker[REC_MAX_N_FIELDS];
@@ -6506,7 +6478,7 @@ ha_innobase::close()
#ifdef WITH_WSREP
UNIV_INTERN
-int
+ulint
wsrep_innobase_mysql_sort(
/*======================*/
/* out: str contains sort string */
@@ -6520,7 +6492,7 @@ wsrep_innobase_mysql_sort(
{
CHARSET_INFO* charset;
enum_field_types mysql_tp;
- int ret_length = str_length;
+ ulint ret_length = str_length;
DBUG_ASSERT(str_length != UNIV_SQL_NULL);
@@ -6757,7 +6729,7 @@ innobase_mysql_fts_get_token(
for (;;) {
if (doc >= end) {
- return(doc - start);
+ return ulint(doc - start);
}
int ctype;
@@ -6799,7 +6771,7 @@ innobase_mysql_fts_get_token(
token->f_len = (uint) (doc - token->f_str) - mwc;
token->f_n_char = length;
- return(doc - start);
+ return ulint(doc - start);
}
/** Converts a MySQL type to an InnoDB type. Note that this function returns
@@ -10302,7 +10274,7 @@ wsrep_append_foreign_key(
}
ut_a(idx);
- key[0] = (char)i;
+ key[0] = byte(i);
rcode = wsrep_rec_get_foreign_key(
&key[1], &len, rec, index, idx,
@@ -10769,7 +10741,7 @@ innodb_base_col_setup(
const Field* field,
dict_v_col_t* v_col)
{
- int n = 0;
+ ulint n = 0;
prepare_vcol_for_base_setup(table, field, v_col);
@@ -11443,8 +11415,8 @@ create_table_info_t::create_options_are_invalid()
smaller than UNIV_PAGE_SIZE_MAX, the maximum
KBS is also smaller. */
kbs_max = ut_min(
- 1 << (UNIV_PAGE_SSIZE_MAX - 1),
- 1 << (PAGE_ZIP_SSIZE_MAX - 1));
+ 1U << (UNIV_PAGE_SSIZE_MAX - 1),
+ 1U << (PAGE_ZIP_SSIZE_MAX - 1));
if (m_create_info->key_block_size > kbs_max) {
push_warning_printf(
m_thd, Sql_condition::WARN_LEVEL_WARN,
@@ -13557,16 +13529,6 @@ ha_innobase::read_time(
return(ranges + (double) rows / (double) total_rows * time_for_scan);
}
-/******************************************************************//**
-Return the size of the InnoDB memory buffer. */
-
-longlong
-ha_innobase::get_memory_buffer_size() const
-/*=======================================*/
-{
- return(innobase_buffer_pool_size);
-}
-
/** Update the system variable with the given value of the InnoDB
buffer pool size.
@param[in] buf_pool_size given value of buffer pool size.*/
@@ -13586,7 +13548,7 @@ match. In this case, we have to take into account if we generated a
default clustered index for the table
@return the key number used inside MySQL */
static
-int
+unsigned
innobase_get_mysql_key_number_for_index(
/*====================================*/
INNOBASE_SHARE* share, /*!< in: share structure for index
@@ -13612,8 +13574,7 @@ innobase_get_mysql_key_number_for_index(
i++;
}
- if (dict_index_is_clust(index)
- && dict_index_is_auto_gen_clust(index)) {
+ if (dict_index_is_auto_gen_clust(index)) {
ut_a(i > 0);
i--;
}
@@ -13667,13 +13628,13 @@ innobase_get_mysql_key_number_for_index(
" index.",
index->name());
}
- return(-1);
+ return(~0U);
}
}
ut_error;
- return(-1);
+ return(~0U);
}
/*********************************************************************//**
@@ -14115,7 +14076,7 @@ ha_innobase::info_low(
errkey = (unsigned int) (
(m_prebuilt->trx->error_key_num
== ULINT_UNDEFINED)
- ? ~0
+ ? ~0U
: m_prebuilt->trx->error_key_num);
}
}
@@ -14301,17 +14262,15 @@ ha_innobase::optimize(
This works OK otherwise, but MySQL locks the entire table during
calls to OPTIMIZE, which is undesirable. */
- /* TODO: Defragment is disabled for now */
if (srv_defragment) {
- int err;
-
- err = defragment_table(m_prebuilt->table->name.m_name, NULL, false);
+ int err= defragment_table(
+ m_prebuilt->table->name.m_name, NULL, false);
if (err == 0) {
return (HA_ADMIN_OK);
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- err,
+ uint(err),
"InnoDB: Cannot defragment table %s: returned error code %d\n",
m_prebuilt->table->name, err);
@@ -15685,7 +15644,7 @@ innodb_show_status(
bytes of text. */
char* str;
- ssize_t flen;
+ size_t flen;
mutex_enter(&srv_monitor_file_mutex);
rewind(srv_monitor_file);
@@ -15695,11 +15654,12 @@ innodb_show_status(
os_file_set_eof(srv_monitor_file);
- if ((flen = ftell(srv_monitor_file)) < 0) {
+ flen = size_t(ftell(srv_monitor_file));
+ if (ssize_t(flen) < 0) {
flen = 0;
}
- ssize_t usable_len;
+ size_t usable_len;
if (flen > MAX_STATUS_SIZE) {
usable_len = MAX_STATUS_SIZE;
@@ -15712,7 +15672,7 @@ innodb_show_status(
read the contents of the temporary file */
if (!(str = (char*) my_malloc(//PSI_INSTRUMENT_ME,
- usable_len + 1, MYF(0)))) {
+ usable_len + 1, MYF(0)))) {
mutex_exit(&srv_monitor_file_mutex);
DBUG_RETURN(1);
}
@@ -15722,19 +15682,18 @@ innodb_show_status(
if (flen < MAX_STATUS_SIZE) {
/* Display the entire output. */
flen = fread(str, 1, flen, srv_monitor_file);
- } else if (trx_list_end < (ulint) flen
+ } else if (trx_list_end < flen
&& trx_list_start < trx_list_end
- && trx_list_start + (flen - trx_list_end)
+ && trx_list_start + flen - trx_list_end
< MAX_STATUS_SIZE - sizeof truncated_msg - 1) {
/* Omit the beginning of the list of active transactions. */
- ssize_t len = fread(str, 1, trx_list_start, srv_monitor_file);
+ size_t len = fread(str, 1, trx_list_start, srv_monitor_file);
memcpy(str + len, truncated_msg, sizeof truncated_msg - 1);
len += sizeof truncated_msg - 1;
usable_len = (MAX_STATUS_SIZE - 1) - len;
- fseek(srv_monitor_file,
- static_cast<long>(flen - usable_len), SEEK_SET);
+ fseek(srv_monitor_file, long(flen - usable_len), SEEK_SET);
len += fread(str + len, 1, usable_len, srv_monitor_file);
flen = len;
} else {
@@ -16287,7 +16246,7 @@ ha_innobase::store_lock(
DBUG_ASSERT(EQ_CURRENT_THD(thd));
const bool in_lock_tables = thd_in_lock_tables(thd);
- const uint sql_command = thd_sql_command(thd);
+ const int sql_command = thd_sql_command(thd);
if (srv_read_only_mode
&& (sql_command == SQLCOM_UPDATE
@@ -16944,8 +16903,7 @@ innobase_get_at_most_n_mbchars(
characters, and we can store in the column prefix index the
whole string. */
- char_length = my_charpos(charset, str,
- str + data_len, (int) n_chars);
+ char_length= my_charpos(charset, str, str + data_len, n_chars);
if (char_length > data_len) {
char_length = data_len;
}
@@ -18438,13 +18396,8 @@ innodb_enable_monitor_at_startup(
for (char* option = my_strtok_r(str, sep, &last);
option;
option = my_strtok_r(NULL, sep, &last)) {
- ulint ret;
char* option_name;
-
- ret = innodb_monitor_valid_byname(&option_name, option);
-
- /* The name is validated if ret == 0 */
- if (!ret) {
+ if (!innodb_monitor_valid_byname(&option_name, option)) {
innodb_monitor_update(NULL, NULL, &option,
MONITOR_TURN_ON, FALSE);
} else {
@@ -19640,13 +19593,13 @@ BUF_POOL_SIZE_THRESHOLD (srv/srv0start.cc), then srv_buf_pool_instances_default
can be removed and 8 used instead. The problem with the current setup is that
with 128MiB default buffer pool size and 8 instances by default we would emit
a warning when no options are specified. */
-static MYSQL_SYSVAR_LONGLONG(buffer_pool_size, innobase_buffer_pool_size,
+static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size,
PLUGIN_VAR_RQCMDARG,
"The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
innodb_buffer_pool_size_validate,
innodb_buffer_pool_size_update,
- static_cast<longlong>(srv_buf_pool_def_size),
- static_cast<longlong>(srv_buf_pool_min_size),
+ srv_buf_pool_def_size,
+ srv_buf_pool_min_size,
LLONG_MAX, 1024*1024L);
static MYSQL_SYSVAR_ULONG(buffer_pool_chunk_size, srv_buf_pool_chunk_unit,
@@ -19819,7 +19772,7 @@ static MYSQL_SYSVAR_BOOL(deadlock_detect, innobase_deadlock_detect,
" and we rely on innodb_lock_wait_timeout in case of deadlock.",
NULL, NULL, TRUE);
-static MYSQL_SYSVAR_LONG(fill_factor, innobase_fill_factor,
+static MYSQL_SYSVAR_UINT(fill_factor, innobase_fill_factor,
PLUGIN_VAR_RQCMDARG,
"Percentage of B-tree page filled during bulk insert",
NULL, NULL, 100, 10, 100, 0);
@@ -19947,10 +19900,10 @@ static MYSQL_SYSVAR_UINT(old_blocks_time, buf_LRU_old_threshold_ms,
" The timeout is disabled if 0.",
NULL, NULL, 1000, 0, UINT_MAX32, 0);
-static MYSQL_SYSVAR_LONG(open_files, innobase_open_files,
+static MYSQL_SYSVAR_ULONG(open_files, innobase_open_files,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"How many files at the maximum InnoDB keeps open at the same time.",
- NULL, NULL, 0L, 0L, LONG_MAX, 0);
+ NULL, NULL, 0, 0, LONG_MAX, 0);
static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
PLUGIN_VAR_RQCMDARG,
@@ -20939,7 +20892,7 @@ innobase_rename_vc_templ(
if (is_part != NULL) {
*is_part = '\0';
- tbnamelen = is_part - tbname;
+ tbnamelen = ulint(is_part - tbname);
}
dbnamelen = filename_to_tablename(dbname, t_dbname,
@@ -21220,7 +21173,7 @@ ib_senderrf(
{
va_list args;
char* str = NULL;
- const char* format = innobase_get_err_msg(code);
+ const char* format = my_get_err_msg(code);
/* If the caller wants to push a message to the client then
the caller must pass a valid session handle. */
@@ -21443,8 +21396,6 @@ innodb_buffer_pool_size_validate(
struct st_mysql_value* value)
{
longlong intbuf;
-
-
value->val_int(value, &intbuf);
if (!srv_was_started) {
@@ -21490,12 +21441,11 @@ innodb_buffer_pool_size_validate(
return(1);
}
- ulint requested_buf_pool_size
- = buf_pool_size_align(static_cast<ulint>(intbuf));
+ ulint requested_buf_pool_size = buf_pool_size_align(ulint(intbuf));
- *static_cast<longlong*>(save) = requested_buf_pool_size;
+ *static_cast<ulonglong*>(save) = requested_buf_pool_size;
- if (srv_buf_pool_size == static_cast<ulint>(intbuf)) {
+ if (srv_buf_pool_size == ulint(intbuf)) {
buf_pool_mutex_exit_all();
/* nothing to do */
return(0);
@@ -21543,7 +21493,7 @@ innodb_compression_algorithm_validate(
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
- long compression_algorithm;
+ ulong compression_algorithm;
DBUG_ENTER("innobase_compression_algorithm_validate");
if (check_sysvar_enum(thd, var, save, value)) {
@@ -21665,7 +21615,7 @@ UNIV_INTERN
void
ib_push_warning(
trx_t* trx, /*!< in: trx */
- ulint error, /*!< in: error code to push as warning */
+ dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...)
{
@@ -21679,9 +21629,9 @@ ib_push_warning(
buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME));
vsprintf(buf,format, args);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- convert_error_code_to_mysql((dberr_t)error, 0, thd),
- buf);
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ uint(convert_error_code_to_mysql(error, 0, thd)), buf);
my_free(buf);
va_end(args);
}
@@ -21693,7 +21643,7 @@ UNIV_INTERN
void
ib_push_warning(
void* ithd, /*!< in: thd */
- ulint error, /*!< in: error code to push as warning */
+ dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...)
{
@@ -21711,9 +21661,9 @@ ib_push_warning(
buf = (char *)my_malloc(MAX_BUF_SIZE, MYF(MY_WME));
vsprintf(buf,format, args);
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- convert_error_code_to_mysql((dberr_t)error, 0, thd),
- buf);
+ push_warning_printf(
+ thd, Sql_condition::WARN_LEVEL_WARN,
+ uint(convert_error_code_to_mysql(error, 0, thd)), buf);
my_free(buf);
va_end(args);
}
diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h
index ae4da973b4f..d46e7248b7d 100644
--- a/storage/innobase/handler/ha_innodb.h
+++ b/storage/innobase/handler/ha_innodb.h
@@ -132,8 +132,6 @@ public:
double read_time(uint index, uint ranges, ha_rows rows);
- longlong get_memory_buffer_size() const;
-
int delete_all_rows();
int write_row(uchar * buf);
@@ -913,19 +911,6 @@ innodb_base_col_setup_for_stored(
create_table_info_t::normalize_table_name_low(norm_name, name, FALSE)
#endif /* _WIN32 */
-/** Converts an InnoDB error code to a MySQL error code.
-Also tells to MySQL about a possible transaction rollback inside InnoDB caused
-by a lock wait timeout or a deadlock.
-@param[in] error InnoDB error code.
-@param[in] flags InnoDB table flags or 0.
-@param[in] thd MySQL thread or NULL.
-@return MySQL error code */
-int
-convert_error_code_to_mysql(
- dberr_t error,
- ulint flags,
- THD* thd);
-
/** Converts a search mode flag understood by MySQL to a flag understood
by InnoDB.
@param[in] find_flag MySQL search mode flag.
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 2f83dbc84dd..c10202d6ae0 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -689,8 +689,8 @@ instant_alter_column_possible(
static bool is_non_const_value(Field* field)
{
return field->default_value
- && field->default_value->flags & ~(VCOL_SESSION_FUNC
- | VCOL_TIME_FUNC);
+ && field->default_value->flags
+ & uint(~(VCOL_SESSION_FUNC | VCOL_TIME_FUNC));
}
/** Set default value for the field.
@@ -762,7 +762,7 @@ ha_innobase::check_if_supported_inplace_alter(
if (high_level_read_only) {
ha_alter_info->unsupported_reason =
- innobase_get_err_msg(ER_READ_ONLY_MODE);
+ my_get_err_msg(ER_READ_ONLY_MODE);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -773,7 +773,7 @@ ha_innobase::check_if_supported_inplace_alter(
return an error too. This is how we effectively
deny adding too many columns to a table. */
ha_alter_info->unsupported_reason =
- innobase_get_err_msg(ER_TOO_MANY_FIELDS);
+ my_get_err_msg(ER_TOO_MANY_FIELDS);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -786,7 +786,7 @@ ha_innobase::check_if_supported_inplace_alter(
if (ha_alter_info->handler_flags
& ALTER_STORED_COLUMN_TYPE) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_COLUMN_TYPE);
}
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
@@ -796,7 +796,7 @@ ha_innobase::check_if_supported_inplace_alter(
check_foreigns is turned off */
if ((ha_alter_info->handler_flags & ALTER_ADD_FOREIGN_KEY)
&& m_prebuilt->trx->check_foreigns) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FK_CHECK);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -820,7 +820,7 @@ ha_innobase::check_if_supported_inplace_alter(
if ((ha_alter_info->handler_flags
& ALTER_COLUMN_NOT_NULLABLE)
&& !thd_is_strict_mode(m_user_thd)) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -830,7 +830,7 @@ ha_innobase::check_if_supported_inplace_alter(
if ((ha_alter_info->handler_flags
& (ALTER_ADD_PK_INDEX | ALTER_DROP_PK_INDEX))
== ALTER_DROP_PK_INDEX) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOPK);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -847,7 +847,7 @@ ha_innobase::check_if_supported_inplace_alter(
if (UNIV_UNLIKELY(my_primary_key >= MAX_KEY)
&& !dict_index_is_auto_gen_clust(
dict_table_get_first_index(m_prebuilt->table))) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_PRIMARY_CANT_HAVE_NULL);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -892,7 +892,7 @@ ha_innobase::check_if_supported_inplace_alter(
use "Copy" method. */
if (m_prebuilt->table->dict_frm_mismatch) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_NO_SUCH_INDEX);
ib_push_frm_error(m_user_thd, m_prebuilt->table, altered_table,
n_indexes, true);
@@ -1009,7 +1009,7 @@ ha_innobase::check_if_supported_inplace_alter(
system_charset_info,
key_part->field->field_name.str,
FTS_DOC_ID_COL_NAME)) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_HIDDEN_FTS);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -1024,7 +1024,7 @@ ha_innobase::check_if_supported_inplace_alter(
column values during online ALTER. */
DBUG_ASSERT(key_part->field == altered_table
-> found_next_number_field);
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_AUTOINC);
online = false;
}
@@ -1063,7 +1063,7 @@ ha_innobase::check_if_supported_inplace_alter(
system_charset_info,
ha_alter_info->index_drop_buffer[i]->name.str,
FTS_DOC_ID_INDEX_NAME)) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -1083,7 +1083,7 @@ ha_innobase::check_if_supported_inplace_alter(
system_charset_info,
(*fp)->field_name.str,
FTS_DOC_ID_COL_NAME)) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_CHANGE_FTS);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
@@ -1162,7 +1162,7 @@ ha_innobase::check_if_supported_inplace_alter(
}
ha_alter_info->unsupported_reason
- = innobase_get_err_msg(
+ = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_NOT_NULL);
} else if (!is_non_const_value(*af)) {
@@ -1214,14 +1214,14 @@ next_column:
refuse to rebuild the table natively altogether. */
if (m_prebuilt->table->fts) {
cannot_create_many_fulltext_index:
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_INNODB_FT_LIMIT);
DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED);
}
if (innobase_spatial_exist(altered_table)) {
ha_alter_info->unsupported_reason =
- innobase_get_err_msg(
+ my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
} else if (!innobase_fulltext_exist(altered_table)) {
/* MDEV-14341 FIXME: Remove this limitation. */
@@ -1229,7 +1229,7 @@ cannot_create_many_fulltext_index:
"online rebuild with indexed virtual columns";
} else {
ha_alter_info->unsupported_reason =
- innobase_get_err_msg(
+ my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
}
}
@@ -1261,12 +1261,12 @@ cannot_create_many_fulltext_index:
goto cannot_create_many_fulltext_index;
}
add_fulltext = true;
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_FTS);
online = false;
}
if (online && (key->flags & HA_SPATIAL)) {
- ha_alter_info->unsupported_reason = innobase_get_err_msg(
+ ha_alter_info->unsupported_reason = my_get_err_msg(
ER_ALTER_OPERATION_NOT_SUPPORTED_REASON_GIS);
online = false;
}
@@ -2797,7 +2797,7 @@ innobase_create_key_defs(
index->ind_type = DICT_CLUSTERED;
index->name = innobase_index_reserve_name;
index->rebuild = true;
- index->key_number = ~0;
+ index->key_number = ~0U;
primary_key_number = ULINT_UNDEFINED;
goto created_clustered;
} else {
@@ -3248,7 +3248,7 @@ innobase_build_col_map(
ulint* col_map = static_cast<ulint*>(
mem_heap_alloc(
- heap, (old_table->n_cols + old_table->n_v_cols)
+ heap, unsigned(old_table->n_cols + old_table->n_v_cols)
* sizeof *col_map));
List_iterator_fast<Create_field> cf_it(
@@ -3591,10 +3591,11 @@ innobase_pk_order_preserved(
const bool old_pk_column = old_field < old_n_uniq;
if (old_pk_column) {
- new_field_order = old_field;
+ new_field_order = lint(old_field);
} else if (innobase_pk_col_is_existing(new_col_no, col_map,
old_n_cols)) {
- new_field_order = old_n_uniq + existing_field_count++;
+ new_field_order = lint(old_n_uniq
+ + existing_field_count++);
} else {
/* Skip newly added column. */
continue;
@@ -4168,11 +4169,11 @@ innobase_add_virtual_try(
}
- ulint n_col = user_table->n_cols - DATA_N_SYS_COLS;
- ulint n_v_col = user_table->n_v_cols
+ ulint n_col = unsigned(user_table->n_cols) - DATA_N_SYS_COLS;
+ ulint n_v_col = unsigned(user_table->n_v_cols)
+ ctx->num_to_add_vcol - ctx->num_to_drop_vcol;
ulint new_n = dict_table_encode_n_col(n_col, n_v_col)
- + ((user_table->flags & DICT_TF_COMPACT) << 31);
+ + (unsigned(user_table->flags & DICT_TF_COMPACT) << 31);
return innodb_update_n_cols(user_table, new_n, trx);
}
@@ -4291,14 +4292,15 @@ innobase_add_instant_try(
}
if (innodb_update_n_cols(user_table, dict_table_encode_n_col(
- user_table->n_cols - DATA_N_SYS_COLS,
+ unsigned(user_table->n_cols)
+ - DATA_N_SYS_COLS,
user_table->n_v_cols)
| (user_table->flags & DICT_TF_COMPACT) << 31,
trx)) {
return true;
}
- unsigned i = user_table->n_cols - DATA_N_SYS_COLS;
+ unsigned i = unsigned(user_table->n_cols) - DATA_N_SYS_COLS;
byte trx_id[DATA_TRX_ID_LEN], roll_ptr[DATA_ROLL_PTR_LEN];
dfield_set_data(dtuple_get_nth_field(row, i++), field_ref_zero,
DATA_ROW_ID_LEN);
@@ -4537,11 +4539,11 @@ innobase_drop_one_virtual_sys_columns(
for (ulint i = v_col->v_pos + 1; i < table->n_v_cols; i++) {
dict_v_col_t* t_col = dict_table_get_nth_v_col(table, i);
ulint old_p = dict_create_v_col_pos(
- t_col->v_pos - n_prev_dropped,
- t_col->m_col.ind - n_prev_dropped);
+ t_col->v_pos - n_prev_dropped,
+ t_col->m_col.ind - n_prev_dropped);
ulint new_p = dict_create_v_col_pos(
- t_col->v_pos - 1 - n_prev_dropped,
- t_col->m_col.ind - 1 - n_prev_dropped);
+ t_col->v_pos - 1 - n_prev_dropped,
+ ulint(t_col->m_col.ind) - 1 - n_prev_dropped);
error = innobase_update_v_pos_sys_columns(
table, old_p, new_p, trx);
@@ -4637,10 +4639,11 @@ innobase_drop_virtual_try(
}
- ulint n_col = user_table->n_cols - DATA_N_SYS_COLS;
- ulint n_v_col = user_table->n_v_cols - ctx->num_to_drop_vcol;
+ ulint n_col = unsigned(user_table->n_cols) - DATA_N_SYS_COLS;
+ ulint n_v_col = unsigned(user_table->n_v_cols)
+ - ctx->num_to_drop_vcol;
ulint new_n = dict_table_encode_n_col(n_col, n_v_col)
- + ((user_table->flags & DICT_TF_COMPACT) << 31);
+ | ((user_table->flags & DICT_TF_COMPACT) << 31);
return innodb_update_n_cols(user_table, new_n, trx);
}
@@ -5236,7 +5239,7 @@ new_clustered_failed:
goto not_instant_add_column;
}
- for (uint i = ctx->old_table->n_cols - DATA_N_SYS_COLS;
+ for (uint i = uint(ctx->old_table->n_cols) - DATA_N_SYS_COLS;
i--; ) {
if (ctx->col_map[i] != i) {
goto not_instant_add_column;
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 7939f6afa08..e761d1f126a 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -331,7 +331,7 @@ field_store_ulint(
if (n != ULINT_UNDEFINED) {
- ret = field->store(n, true);
+ ret = field->store(longlong(n), true);
field->set_notnull();
} else {
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 5fca4a34bd3..179ff442271 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -1625,7 +1625,8 @@ ibuf_build_entry_from_ibuf_rec_func(
ibuf_dummy_index_add_col(index, dfield_get_type(field), len);
}
- 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));
/* Prevent an ut_ad() failure in page_zip_write_rec() by
adding system columns to the dummy table pointed to by the
@@ -1915,7 +1916,7 @@ ibuf_entry_build(
field = dtuple_get_nth_field(tuple, IBUF_REC_FIELD_METADATA);
- dfield_set_data(field, type_info, ti - type_info);
+ dfield_set_data(field, type_info, ulint(ti - type_info));
/* Set all the types in the new tuple binary */
@@ -1980,11 +1981,8 @@ ibuf_search_tuple_build(
/*********************************************************************//**
Checks if there are enough pages in the free list of the ibuf tree that we
dare to start a pessimistic insert to the insert buffer.
-@return TRUE if enough free pages in list */
-UNIV_INLINE
-ibool
-ibuf_data_enough_free_for_insert(void)
-/*==================================*/
+@return whether enough free pages in list */
+static inline bool ibuf_data_enough_free_for_insert()
{
ut_ad(mutex_own(&ibuf_mutex));
@@ -2880,7 +2878,7 @@ ibuf_get_volume_buffered_count_func(
types = rec_get_nth_field_old(rec, IBUF_REC_FIELD_METADATA, &len);
- switch (UNIV_EXPECT(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
+ switch (UNIV_EXPECT(int(len % DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE),
IBUF_REC_INFO_SIZE)) {
default:
ut_error;
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index a4f93280ff1..12b91ce7c10 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2014, 2017, MariaDB Corporation.
+Copyright (c) 2014, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -153,23 +153,23 @@ free the pages of externally stored fields. */
record is in spatial index */
#define BTR_RTREE_DELETE_MARK 524288U
-#define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode) \
- ((latch_mode) & btr_latch_mode(~(BTR_INSERT \
- | BTR_DELETE_MARK \
- | BTR_RTREE_UNDO_INS \
- | BTR_RTREE_DELETE_MARK \
- | BTR_DELETE \
- | BTR_ESTIMATE \
- | BTR_IGNORE_SEC_UNIQUE \
- | BTR_ALREADY_S_LATCHED \
- | BTR_LATCH_FOR_INSERT \
- | BTR_LATCH_FOR_DELETE \
- | BTR_MODIFY_EXTERNAL)))
-
-#define BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode) \
- ((latch_mode) & btr_latch_mode(~(BTR_LATCH_FOR_INSERT \
- | BTR_LATCH_FOR_DELETE \
- | BTR_MODIFY_EXTERNAL)))
+#define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode) \
+ ((latch_mode) & ulint(~(BTR_INSERT \
+ | BTR_DELETE_MARK \
+ | BTR_RTREE_UNDO_INS \
+ | BTR_RTREE_DELETE_MARK \
+ | BTR_DELETE \
+ | BTR_ESTIMATE \
+ | BTR_IGNORE_SEC_UNIQUE \
+ | BTR_ALREADY_S_LATCHED \
+ | BTR_LATCH_FOR_INSERT \
+ | BTR_LATCH_FOR_DELETE \
+ | BTR_MODIFY_EXTERNAL)))
+
+#define BTR_LATCH_MODE_WITHOUT_INTENTION(latch_mode) \
+ ((latch_mode) & ulint(~(BTR_LATCH_FOR_INSERT \
+ | BTR_LATCH_FOR_DELETE \
+ | BTR_MODIFY_EXTERNAL)))
/**************************************************************//**
Report that an index page is corrupted. */
diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h
index 0f0051131a6..6a7b532f277 100644
--- a/storage/innobase/include/btr0bulk.h
+++ b/storage/innobase/include/btr0bulk.h
@@ -33,7 +33,7 @@ Created 03/11/2014 Shaohua Wang
#include <vector>
/** Innodb B-tree index fill factor for bulk load. */
-extern long innobase_fill_factor;
+extern uint innobase_fill_factor;
/*
The proper function call sequence of PageBulk is as below:
@@ -294,7 +294,8 @@ public:
mem_heap_free(m_heap);
UT_DELETE(m_page_bulks);
ut_d(my_atomic_addlint(
- &m_index->table->space->redo_skipped_count, -1));
+ &m_index->table->space->redo_skipped_count,
+ ulint(-1)));
}
/** Initialization
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index 8d8fe0bc236..151ef558477 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -982,11 +982,11 @@ We store locally a long enough prefix of each column so that we can determine
the ordering parts of each index record without looking into the externally
stored part. */
/*-------------------------------------- @{ */
-#define BTR_EXTERN_SPACE_ID 0 /*!< space id where stored */
-#define BTR_EXTERN_PAGE_NO 4 /*!< page no where stored */
-#define BTR_EXTERN_OFFSET 8 /*!< offset of BLOB header
+#define BTR_EXTERN_SPACE_ID 0U /*!< space id where stored */
+#define BTR_EXTERN_PAGE_NO 4U /*!< page no where stored */
+#define BTR_EXTERN_OFFSET 8U /*!< offset of BLOB header
on that page */
-#define BTR_EXTERN_LEN 12 /*!< 8 bytes containing the
+#define BTR_EXTERN_LEN 12U /*!< 8 bytes containing the
length of the externally
stored part of the BLOB.
The 2 highest bits are
diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h
index f56ac2e5e70..1b52cc6e647 100644
--- a/storage/innobase/include/buf0buddy.h
+++ b/storage/innobase/include/buf0buddy.h
@@ -49,8 +49,8 @@ buf_buddy_alloc(
ulint size, /*!< in: compressed page size
(between UNIV_ZIP_SIZE_MIN and
UNIV_PAGE_SIZE) */
- ibool* lru) /*!< in: pointer to a variable
- that will be assigned TRUE if
+ bool* lru) /*!< in: pointer to a variable
+ that will be assigned true if
storage was allocated from the
LRU list and buf_pool->mutex was
temporarily released */
diff --git a/storage/innobase/include/buf0buddy.ic b/storage/innobase/include/buf0buddy.ic
index 2b6d76df009..14c305b31bd 100644
--- a/storage/innobase/include/buf0buddy.ic
+++ b/storage/innobase/include/buf0buddy.ic
@@ -42,8 +42,8 @@ buf_buddy_alloc_low(
buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */
ulint i, /*!< in: index of buf_pool->zip_free[],
or BUF_BUDDY_SIZES */
- ibool* lru) /*!< in: pointer to a variable that
- will be assigned TRUE if storage was
+ bool* lru) /*!< in: pointer to a variable that
+ will be assigned true if storage was
allocated from the LRU list and
buf_pool->mutex was temporarily
released */
@@ -97,7 +97,7 @@ buf_buddy_alloc(
ulint size, /*!< in: compressed page size
(between UNIV_ZIP_SIZE_MIN and
UNIV_PAGE_SIZE) */
- ibool* lru) /*!< in: pointer to a variable
+ bool* lru) /*!< in: pointer to a variable
that will be assigned TRUE if
storage was allocated from the
LRU list and buf_pool->mutex was
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 1bfce325106..18f2c15bb58 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -955,7 +955,7 @@ ulint
buf_block_fix(
buf_page_t* bpage)
{
- return(my_atomic_add32((int32*) &bpage->buf_fix_count, 1) + 1);
+ return uint32(my_atomic_add32((int32*) &bpage->buf_fix_count, 1) + 1);
}
/** Increments the bufferfix count.
@@ -1003,9 +1003,10 @@ ulint
buf_block_unfix(
buf_page_t* bpage)
{
- ulint count = my_atomic_add32((int32*) &bpage->buf_fix_count, -1) - 1;
- ut_ad(count + 1 != 0);
- return(count);
+ uint32 count = uint32(my_atomic_add32((int32*) &bpage->buf_fix_count,
+ -1));
+ ut_ad(count != 0);
+ return count - 1;
}
/** Decrements the bufferfix count.
diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h
index 2eaa9042e9c..b999106fee0 100644
--- a/storage/innobase/include/data0type.h
+++ b/storage/innobase/include/data0type.h
@@ -365,9 +365,9 @@ dtype_form_prtype(ulint old_prtype, ulint charset_coll)
Determines if a MySQL string type is a subset of UTF-8. This function
may return false negatives, in case further character-set collation
codes are introduced in MySQL later.
-@return TRUE if a subset of UTF-8 */
+@return whether a subset of UTF-8 */
UNIV_INLINE
-ibool
+bool
dtype_is_utf8(
/*==========*/
ulint prtype);/*!< in: precise data type */
diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic
index 59f8c75fd65..8898642a152 100644
--- a/storage/innobase/include/data0type.ic
+++ b/storage/innobase/include/data0type.ic
@@ -43,9 +43,9 @@ dtype_get_charset_coll(
Determines if a MySQL string type is a subset of UTF-8. This function
may return false negatives, in case further character-set collation
codes are introduced in MySQL later.
-@return TRUE if a subset of UTF-8 */
+@return whether a subset of UTF-8 */
UNIV_INLINE
-ibool
+bool
dtype_is_utf8(
/*==========*/
ulint prtype) /*!< in: precise data type */
@@ -58,10 +58,10 @@ dtype_is_utf8(
case 33: /* utf8_general_ci */
case 83: /* utf8_bin */
case 254: /* utf8_general_cs */
- return(TRUE);
+ return true;
}
- return(FALSE);
+ return false;
}
/*********************************************************************//**
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index b0e78e77f2c..2fe12a517b3 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -311,7 +311,7 @@ dict_index_is_spatial(
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- return(index->type & DICT_SPATIAL);
+ return ulint(UNIV_EXPECT(index->type & DICT_SPATIAL, 0));
}
/** Check whether the index contains a virtual column
@@ -372,7 +372,7 @@ dict_table_get_n_user_cols(
/* n_cols counts stored columns only. A table may contain
virtual columns and no user-specified stored columns at all. */
ut_ad(table->n_cols >= DATA_N_SYS_COLS);
- return(table->n_cols - DATA_N_SYS_COLS);
+ return unsigned(table->n_cols) - DATA_N_SYS_COLS;
}
/********************************************************************//**
@@ -519,13 +519,8 @@ dict_table_get_sys_col(
ulint sys) /*!< in: DATA_ROW_ID, ... */
{
dict_col_t* col;
-
- ut_ad(table);
- ut_ad(sys < DATA_N_SYS_COLS);
- ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
-
- col = dict_table_get_nth_col(table, table->n_cols - DATA_N_SYS_COLS
- + sys);
+ col = dict_table_get_nth_col(table,
+ dict_table_get_sys_col_no(table, sys));
ut_ad(col->mtype == DATA_SYS);
ut_ad(col->prtype == (sys | DATA_NOT_NULL));
@@ -547,7 +542,7 @@ dict_table_get_sys_col_no(
ut_ad(sys < DATA_N_SYS_COLS);
ut_ad(table->magic_n == DICT_TABLE_MAGIC_N);
- return(table->n_cols - DATA_N_SYS_COLS + sys);
+ return unsigned(table->n_cols) + (sys - DATA_N_SYS_COLS);
}
/********************************************************************//**
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index c39ed96eb9c..163671f854d 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -109,7 +109,7 @@ are described in fsp0fsp.h. */
/** dict_table_t::flags bit 0 is equal to 0 if the row format = Redundant */
#define DICT_TF_REDUNDANT 0 /*!< Redundant row format. */
/** dict_table_t::flags bit 0 is equal to 1 if the row format = Compact */
-#define DICT_TF_COMPACT 1 /*!< Compact row format. */
+#define DICT_TF_COMPACT 1U /*!< Compact row format. */
/** This bitmask is used in SYS_TABLES.N_COLS to set and test whether
the Compact page format is used, i.e ROW_FORMAT != REDUNDANT */
@@ -1093,7 +1093,7 @@ struct dict_index_t{
fields[i].col->remove_instant();
}
n_core_fields = n_fields;
- n_core_null_bytes = UT_BITS_IN_BYTES(n_nullable);
+ n_core_null_bytes = UT_BITS_IN_BYTES(unsigned(n_nullable));
}
/** Check if record in clustered index is historical row.
@@ -1453,7 +1453,7 @@ struct dict_table_t {
/** @return whether the table supports transactions */
bool no_rollback() const
{
- return !(~flags & DICT_TF_MASK_NO_ROLLBACK);
+ return !(~unsigned(flags) & DICT_TF_MASK_NO_ROLLBACK);
}
/** @return whether this is a temporary table */
bool is_temporary() const
@@ -1514,7 +1514,7 @@ struct dict_table_t {
void inc_fk_checks()
{
#ifdef UNIV_DEBUG
- lint fk_checks=
+ lint fk_checks= (lint)
#endif
my_atomic_addlint(&n_foreign_key_checks_running, 1);
ut_ad(fk_checks >= 0);
@@ -1522,9 +1522,9 @@ struct dict_table_t {
void dec_fk_checks()
{
#ifdef UNIV_DEBUG
- lint fk_checks=
+ lint fk_checks= (lint)
#endif
- my_atomic_addlint(&n_foreign_key_checks_running, -1);
+ my_atomic_addlint(&n_foreign_key_checks_running, ulint(-1));
ut_ad(fk_checks > 0);
}
diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h
index 6bb2771716b..f2fcae69bd5 100644
--- a/storage/innobase/include/dict0types.h
+++ b/storage/innobase/include/dict0types.h
@@ -115,7 +115,7 @@ struct table_name_t
}
/** @return the length of the schema name, in bytes */
- size_t dblen() const { return dbend() - m_name; }
+ size_t dblen() const { return size_t(dbend() - m_name); }
/** Determine the filename-safe encoded table name.
@return the filename-safe encoded table name */
diff --git a/storage/innobase/include/fts0tokenize.h b/storage/innobase/include/fts0tokenize.h
index 15726aea1de..909d2ce07ba 100644
--- a/storage/innobase/include/fts0tokenize.h
+++ b/storage/innobase/include/fts0tokenize.h
@@ -144,7 +144,7 @@ fts_get_word(
}
}
- info->prev = *doc;
+ info->prev = char(*doc);
info->yesno = (FTB_YES == ' ') ? 1 : (info->quot != 0);
info->weight_adjust = info->wasign = 0;
}
diff --git a/storage/innobase/include/fts0types.ic b/storage/innobase/include/fts0types.ic
index a8712751412..487e7c33b63 100644
--- a/storage/innobase/include/fts0types.ic
+++ b/storage/innobase/include/fts0types.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -172,7 +172,6 @@ fts_select_index_by_hash(
const byte* str,
ulint len)
{
- int char_len;
ulong nr1 = 1;
ulong nr2 = 4;
@@ -187,9 +186,9 @@ fts_select_index_by_hash(
char_len = my_mbcharlen_ptr(cs, reinterpret_cast<const char*>(str),
reinterpret_cast<const char*>(str + len));
*/
- char_len = cs->cset->charlen(cs, str, str+len);
+ size_t char_len = size_t(cs->cset->charlen(cs, str, str + len));
- ut_ad(static_cast<ulint>(char_len) <= len);
+ ut_ad(char_len <= len);
/* Get collation hash code */
cs->coll->hash_sort(cs, str, char_len, &nr1, &nr2);
diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h
index 86defe9b166..82ea9b2a8e5 100644
--- a/storage/innobase/include/ha_prototypes.h
+++ b/storage/innobase/include/ha_prototypes.h
@@ -240,7 +240,7 @@ wsrep_innobase_kill_one_trx(void * const thd_ptr,
const trx_t * const bf_trx,
trx_t *victim_trx,
ibool signal);
-int wsrep_innobase_mysql_sort(int mysql_type, uint charset_number,
+ulint wsrep_innobase_mysql_sort(int mysql_type, uint charset_number,
unsigned char* str, unsigned int str_length,
unsigned int buf_length);
#endif /* WITH_WSREP */
@@ -309,14 +309,6 @@ thd_lock_wait_timeout(
/*==================*/
THD* thd); /*!< in: thread handle, or NULL to query
the global innodb_lock_wait_timeout */
-/******************************************************************//**
-Add up the time waited for the lock for the current query. */
-void
-thd_set_lock_wait_time(
-/*===================*/
- THD* thd, /*!< in/out: thread handle */
- ulint value); /*!< in: time waited for the lock */
-
/** Get status of innodb_tmpdir.
@param[in] thd thread handle, or NULL to query
the global innodb_tmpdir.
@@ -453,14 +445,6 @@ const char*
server_get_hostname();
/*=================*/
-/******************************************************************//**
-Get the error message format string.
-@return the format string or 0 if not found. */
-const char*
-innobase_get_err_msg(
-/*=================*/
- int error_code); /*!< in: MySQL error code */
-
/*********************************************************************//**
Compute the next autoinc value.
@@ -533,7 +517,7 @@ UNIV_INTERN
void
ib_push_warning(
trx_t* trx, /*!< in: trx */
- ulint error, /*!< in: error code to push as warning */
+ dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...);
@@ -543,7 +527,7 @@ UNIV_INTERN
void
ib_push_warning(
void* ithd, /*!< in: thd */
- ulint error, /*!< in: error code to push as warning */
+ dberr_t error, /*!< in: error code to push as warning */
const char *format,/*!< in: warning message */
...);
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index dbad7cb6950..9479a61583a 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -277,7 +277,8 @@ mem_heap_free_heap_top(
ut_ad(block);
/* Set the free field of block */
- mem_block_set_free(block, old_top - (byte*) block);
+ mem_block_set_free(block,
+ ulint(old_top - reinterpret_cast<byte*>(block)));
ut_ad(mem_block_get_start(block) <= mem_block_get_free(block));
UNIV_MEM_FREE(old_top, (byte*) block + block->len - old_top);
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index dee08605e58..88ed91ba306 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -158,9 +158,9 @@ Otherwise written as 0. @see PAGE_ROOT_AUTO_INC */
/*-----------------------------*/
/* Heap numbers */
-#define PAGE_HEAP_NO_INFIMUM 0 /* page infimum */
-#define PAGE_HEAP_NO_SUPREMUM 1 /* page supremum */
-#define PAGE_HEAP_NO_USER_LOW 2 /* first user record in
+#define PAGE_HEAP_NO_INFIMUM 0U /* page infimum */
+#define PAGE_HEAP_NO_SUPREMUM 1U /* page supremum */
+#define PAGE_HEAP_NO_USER_LOW 2U /* first user record in
creation (insertion) order,
not necessarily collation order;
this record may have been deleted */
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index da0cd8511af..579304495bb 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -396,7 +396,8 @@ page_get_middle_rec(
/*================*/
page_t* page) /*!< in: page */
{
- ulint middle = (page_get_n_recs(page) + PAGE_HEAP_NO_USER_LOW) / 2;
+ ulint middle = (ulint(page_get_n_recs(page))
+ + PAGE_HEAP_NO_USER_LOW) / 2;
return(page_rec_get_nth(page, middle));
}
@@ -1043,7 +1044,7 @@ page_mem_free(
page_zip_dir_delete(page_zip, rec, index, offsets, free);
} else {
page_header_set_field(page, page_zip, PAGE_N_RECS,
- page_get_n_recs(page) - 1);
+ ulint(page_get_n_recs(page)) - 1);
}
}
diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h
index 30a996df0a6..7b8b7efe617 100644
--- a/storage/innobase/include/page0size.h
+++ b/storage/innobase/include/page0size.h
@@ -30,7 +30,7 @@ Created Nov 14, 2013 Vasil Dimov
#include "univ.i"
#include "fsp0types.h"
-#define FIELD_REF_SIZE 20
+#define FIELD_REF_SIZE 20U
/** A BLOB field reference full of zero, for use in assertions and
tests.Initially, BLOB field references are set to zero, in
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index b471e2cf64e..fc6c78c9296 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -242,9 +242,9 @@ page_zip_get_trailer_len(
ut_ad(!page_zip->n_blobs);
}
- return((page_dir_get_n_heap(page_zip->data) - 2)
- * uncompressed_size
- + page_zip->n_blobs * BTR_EXTERN_FIELD_REF_SIZE);
+ return (ulint(page_dir_get_n_heap(page_zip->data)) - 2)
+ * uncompressed_size
+ + ulint(page_zip->n_blobs) * BTR_EXTERN_FIELD_REF_SIZE;
}
/**********************************************************************//**
diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h
index 37498c1c638..487ba8c147f 100644
--- a/storage/innobase/include/pars0pars.h
+++ b/storage/innobase/include/pars0pars.h
@@ -539,7 +539,7 @@ pars_info_add_int4_literal(
/*=======================*/
pars_info_t* info, /*!< in: info struct */
const char* name, /*!< in: name */
- lint val); /*!< in: value */
+ ulint val); /*!< in: value */
/****************************************************************//**
Equivalent to:
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index da82361875c..9c4151a28a5 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -738,9 +738,7 @@ rec_offs_any_flag(const ulint* offsets, ulint flag)
/** Determine if the offsets are for a record containing off-page columns.
@param[in] offsets rec_get_offsets()
@return nonzero if any off-page columns exist */
-inline
-ulint
-rec_offs_any_extern(const ulint* offsets)
+inline bool rec_offs_any_extern(const ulint* offsets)
{
return rec_offs_any_flag(offsets, REC_OFFS_EXTERNAL);
}
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index bc9006a66e8..81b88fb3fa3 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -632,7 +632,8 @@ rec_get_info_and_status_bits(
# error "REC_NEW_STATUS_MASK and REC_INFO_BITS_MASK overlap"
#endif
if (comp) {
- bits = rec_get_info_bits(rec, TRUE) | rec_get_status(rec);
+ bits = rec_get_info_bits(rec, TRUE)
+ | ulint(rec_get_status(rec));
} else {
bits = rec_get_info_bits(rec, FALSE);
ut_ad(!(bits & ~(REC_INFO_BITS_MASK >> REC_INFO_BITS_SHIFT)));
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 61a363d6de8..7c0b5d3ece9 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -792,7 +792,7 @@ struct row_prebuilt_t {
allocated mem buf start, because
there is a 4 byte magic number at the
start and at the end */
- ibool keep_other_fields_on_keyread; /*!< when using fetch
+ bool keep_other_fields_on_keyread; /*!< when using fetch
cache with HA_EXTRA_KEYREAD, don't
overwrite other fields in mysql row
row buffer.*/
diff --git a/storage/innobase/include/row0upd.h b/storage/innobase/include/row0upd.h
index e10f0906a8c..5e01e513a50 100644
--- a/storage/innobase/include/row0upd.h
+++ b/storage/innobase/include/row0upd.h
@@ -522,8 +522,8 @@ struct upd_node_t{
ibool searched_update;
/* TRUE if searched update, FALSE if
positioned */
- ibool in_mysql_interface;
- /* TRUE if the update node was created
+ bool in_mysql_interface;
+ /* whether the update node was created
for the MySQL interface */
dict_foreign_t* foreign;/* NULL or pointer to a foreign key
constraint if this update node is used in
diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h
index b91f7c1103b..069ab5cf93a 100644
--- a/storage/innobase/include/srv0mon.h
+++ b/storage/innobase/include/srv0mon.h
@@ -2,7 +2,7 @@
Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2017, MariaDB Corporation.
+Copyright (c) 2013, 2018, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -503,18 +503,18 @@ extern ulint monitor_set_tbl[(NUM_MONITOR + NUM_BITS_ULINT - 1) /
/** Macros to turn on/off the control bit in monitor_set_tbl for a monitor
counter option. */
-#define MONITOR_ON(monitor) \
- (monitor_set_tbl[monitor / NUM_BITS_ULINT] |= \
- ((ulint)1 << (monitor % NUM_BITS_ULINT)))
+#define MONITOR_ON(monitor) \
+ (monitor_set_tbl[unsigned(monitor) / NUM_BITS_ULINT] |= \
+ (ulint(1) << (unsigned(monitor) % NUM_BITS_ULINT)))
-#define MONITOR_OFF(monitor) \
- (monitor_set_tbl[monitor / NUM_BITS_ULINT] &= \
- ~((ulint)1 << (monitor % NUM_BITS_ULINT)))
+#define MONITOR_OFF(monitor) \
+ (monitor_set_tbl[unsigned(monitor) / NUM_BITS_ULINT] &= \
+ ~(ulint(1) << (unsigned(monitor) % NUM_BITS_ULINT)))
/** Check whether the requested monitor is turned on/off */
-#define MONITOR_IS_ON(monitor) \
- (monitor_set_tbl[monitor / NUM_BITS_ULINT] & \
- ((ulint)1 << (monitor % NUM_BITS_ULINT)))
+#define MONITOR_IS_ON(monitor) \
+ (monitor_set_tbl[unsigned(monitor) / NUM_BITS_ULINT] & \
+ (ulint(1) << (unsigned(monitor) % NUM_BITS_ULINT)))
/** The actual monitor counter array that records each monintor counter
value */
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index 8a1a3741b47..5c7a73b490d 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -116,10 +116,10 @@ rw_lock_get_reader_count(
if (lock_word > X_LOCK_HALF_DECR) {
/* s-locked, no x-waiter */
- return(X_LOCK_DECR - lock_word);
+ return ulint(X_LOCK_DECR - lock_word);
} else if (lock_word > 0) {
/* s-locked, with sx-locks only */
- return(X_LOCK_HALF_DECR - lock_word);
+ return ulint(X_LOCK_HALF_DECR - lock_word);
} else if (lock_word == 0) {
/* x-locked */
return(0);
@@ -161,12 +161,12 @@ rw_lock_get_x_lock_count(
/* no s-lock, no sx-lock, 2 or more x-locks.
First 2 x-locks are set with -X_LOCK_DECR,
all other recursive x-locks are set with -1 */
- return(2 - (lock_copy + X_LOCK_DECR));
+ return ulint(2 - X_LOCK_DECR - lock_copy);
} else {
/* no s-lock, 1 or more sx-lock, 2 or more x-locks.
First 2 x-locks are set with -(X_LOCK_DECR + X_LOCK_HALF_DECR),
all other recursive x-locks are set with -1 */
- return(2 - (lock_copy + X_LOCK_DECR + X_LOCK_HALF_DECR));
+ return ulint(2 - X_LOCK_DECR - X_LOCK_HALF_DECR - lock_copy);
}
}
diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h
index a2ed29760fe..ad8ad59a535 100644
--- a/storage/innobase/include/trx0sys.h
+++ b/storage/innobase/include/trx0sys.h
@@ -704,9 +704,10 @@ public:
because it may change even before this method returns.
*/
- int32_t size()
+ uint32_t size()
{
- return my_atomic_load32_explicit(&hash.count, MY_MEMORY_ORDER_RELAXED);
+ return uint32_t(my_atomic_load32_explicit(&hash.count,
+ MY_MEMORY_ORDER_RELAXED));
}
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index a0fbf4c6512..76d4e9caba0 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -355,8 +355,8 @@ trx_state_eq(
/**********************************************************************//**
Determines if the currently running transaction has been interrupted.
-@return TRUE if interrupted */
-ibool
+@return true if interrupted */
+bool
trx_is_interrupted(
/*===============*/
const trx_t* trx); /*!< in: transaction */
@@ -940,7 +940,7 @@ public:
contains a pointer to the latest file
name; this is NULL if binlog is not
used */
- int64_t mysql_log_offset;
+ ulonglong mysql_log_offset;
/*!< if MySQL binlog is used, this
field contains the end offset of the
binlog entry */
diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h
index 5b5afe7cd80..6367b53dbe6 100644
--- a/storage/innobase/include/ut0pool.h
+++ b/storage/innobase/include/ut0pool.h
@@ -115,7 +115,7 @@ struct Pool {
} else if (m_last < m_end) {
/* Initialise the remaining elements. */
- init(m_end - m_last);
+ init(size_t(m_end - m_last));
ut_ad(!m_pqueue.empty());
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 838e0587890..8be8be611b8 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1975,7 +1975,7 @@ lock_rec_lock(
trx_mutex_enter(trx);
if (lock_rec_get_next_on_page(lock) ||
lock->trx != trx ||
- lock->type_mode != (mode | LOCK_REC) ||
+ lock->type_mode != (ulint(mode) | LOCK_REC) ||
lock_rec_get_n_bits(lock) <= heap_no)
{
/* Do nothing if the trx already has a strong enough lock on rec */
@@ -2470,7 +2470,8 @@ lock_rec_inherit_to_gap(
&& lock_get_mode(lock) ==
(lock->trx->duplicates ? LOCK_S : LOCK_X))) {
lock_rec_add_to_queue(
- LOCK_REC | LOCK_GAP | lock_get_mode(lock),
+ LOCK_REC | LOCK_GAP
+ | ulint(lock_get_mode(lock)),
heir_block, heir_heap_no, lock->index,
lock->trx, FALSE);
}
@@ -2506,7 +2507,8 @@ lock_rec_inherit_to_gap_if_gap_lock(
|| !lock_rec_get_rec_not_gap(lock))) {
lock_rec_add_to_queue(
- LOCK_REC | LOCK_GAP | lock_get_mode(lock),
+ LOCK_REC | LOCK_GAP
+ | ulint(lock_get_mode(lock)),
block, heir_heap_no, lock->index,
lock->trx, FALSE);
}
@@ -3770,7 +3772,7 @@ lock_table_enqueue_waiting(
#endif /* WITH_WSREP */
/* Enqueue the lock request that will wait to be granted */
- lock = lock_table_create(table, mode | LOCK_WAIT, trx
+ lock = lock_table_create(table, ulint(mode) | LOCK_WAIT, trx
#ifdef WITH_WSREP
, c_lock
#endif
@@ -3929,13 +3931,14 @@ lock_table(
mode: this trx may have to wait */
if (wait_for != NULL) {
- err = lock_table_enqueue_waiting(mode | flags, table, thr
+ err = lock_table_enqueue_waiting(ulint(mode) | flags, table,
+ thr
#ifdef WITH_WSREP
, wait_for
#endif
);
} else {
- lock_table_create(table, mode | flags, trx);
+ lock_table_create(table, ulint(mode) | flags, trx);
ut_a(!flags || mode == LOCK_S || mode == LOCK_X);
@@ -5820,7 +5823,7 @@ lock_sec_rec_read_check_and_lock(
index, offsets);
}
- err = lock_rec_lock(FALSE, mode | gap_mode,
+ err = lock_rec_lock(FALSE, ulint(mode) | gap_mode,
block, heap_no, index, thr);
ut_ad(lock_rec_queue_validate(FALSE, block, rec, index, offsets));
@@ -5884,7 +5887,8 @@ lock_clust_rec_read_check_and_lock(
index, offsets);
}
- err = lock_rec_lock(FALSE, mode | gap_mode, block, heap_no, index, thr);
+ err = lock_rec_lock(FALSE, ulint(mode) | gap_mode,
+ block, heap_no, index, thr);
ut_ad(lock_rec_queue_validate(FALSE, block, rec, index, offsets));
diff --git a/storage/innobase/lock/lock0prdt.cc b/storage/innobase/lock/lock0prdt.cc
index cf88ebbeaa1..8f70049e714 100644
--- a/storage/innobase/lock/lock0prdt.cc
+++ b/storage/innobase/lock/lock0prdt.cc
@@ -838,7 +838,7 @@ lock_prdt_lock(
lock_mutex_enter();
- const ulint prdt_mode = mode | type_mode;
+ const ulint prdt_mode = ulint(mode) | type_mode;
lock_t* lock = lock_rec_get_first_on_page(hash, block);
if (lock == NULL) {
@@ -846,7 +846,7 @@ lock_prdt_lock(
#ifdef WITH_WSREP
NULL, NULL, /* FIXME: replicate SPATIAL INDEX locks */
#endif
- mode | type_mode, block, PRDT_HEAPNO,
+ ulint(mode) | type_mode, block, PRDT_HEAPNO,
index, trx, FALSE);
status = LOCK_REC_SUCCESS_CREATED;
@@ -878,7 +878,7 @@ lock_prdt_lock(
NULL, /* FIXME: replicate
SPATIAL INDEX locks */
#endif
- mode | type_mode,
+ ulint(mode) | type_mode,
block, PRDT_HEAPNO,
index, thr, prdt);
} else {
diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc
index 6ce9e843a43..ca35c072c00 100644
--- a/storage/innobase/lock/lock0wait.cc
+++ b/storage/innobase/lock/lock0wait.cc
@@ -290,7 +290,7 @@ lock_wait_suspend_thread(
if (ut_usectime(&sec, &ms) == -1) {
start_time = -1;
} else {
- start_time = static_cast<int64_t>(sec) * 1000000 + ms;
+ start_time = int64_t(sec) * 1000000 + int64_t(ms);
}
}
@@ -378,31 +378,27 @@ lock_wait_suspend_thread(
lock_wait_table_release_slot(slot);
if (thr->lock_state == QUE_THR_LOCK_ROW) {
- ulint diff_time;
-
- if (ut_usectime(&sec, &ms) == -1) {
+ int64_t diff_time;
+ if (start_time == -1 || ut_usectime(&sec, &ms) == -1) {
finish_time = -1;
+ diff_time = 0;
} else {
- finish_time = static_cast<int64_t>(sec) * 1000000 + ms;
+ finish_time = int64_t(sec) * 1000000 + int64_t(ms);
+ diff_time = std::max<int64_t>(
+ 0, finish_time - start_time);
+ srv_stats.n_lock_wait_time.add(diff_time);
+
+ /* Only update the variable if we successfully
+ retrieved the start and finish times. See Bug#36819. */
+ if (ulint(diff_time) > lock_sys.n_lock_max_wait_time) {
+ lock_sys.n_lock_max_wait_time
+ = ulint(diff_time);
+ }
+ /* Record the lock wait time for this thread */
+ thd_storage_lock_wait(trx->mysql_thd, diff_time);
}
- diff_time = (finish_time > start_time) ?
- (ulint) (finish_time - start_time) : 0;
-
srv_stats.n_lock_wait_current_count.dec();
- srv_stats.n_lock_wait_time.add(diff_time);
-
- /* Only update the variable if we successfully
- retrieved the start and finish times. See Bug#36819. */
- if (diff_time > lock_sys.n_lock_max_wait_time
- && start_time != -1
- && finish_time != -1) {
-
- lock_sys.n_lock_max_wait_time = diff_time;
- }
-
- /* Record the lock wait time for this thread */
- thd_set_lock_wait_time(trx->mysql_thd, diff_time);
DBUG_EXECUTE_IF("lock_instrument_slow_query_log",
os_thread_sleep(1000););
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 6027eb22f39..b62a526ddff 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -522,7 +522,7 @@ DECLARE_THREAD(recv_writer_thread)(
/* Wait till we get a signal to clean the LRU list.
Bounded by max wait time of 100ms. */
- ib_uint64_t sig_count = os_event_reset(buf_flush_event);
+ int64_t sig_count = os_event_reset(buf_flush_event);
os_event_wait_time_low(buf_flush_event, 100000, sig_count);
mutex_enter(&recv_sys->writer_mutex);
@@ -1563,13 +1563,13 @@ recv_add_to_hash_table(
ut_ad(type != MLOG_INDEX_LOAD);
ut_ad(type != MLOG_TRUNCATE);
- len = rec_end - body;
+ len = ulint(rec_end - body);
recv = static_cast<recv_t*>(
mem_heap_alloc(recv_sys->heap, sizeof(recv_t)));
recv->type = type;
- recv->len = rec_end - body;
+ recv->len = ulint(rec_end - body);
recv->start_lsn = start_lsn;
recv->end_lsn = end_lsn;
@@ -1604,7 +1604,7 @@ recv_add_to_hash_table(
while (rec_end > body) {
- len = rec_end - body;
+ len = ulint(rec_end - body);
if (len > RECV_DATA_BLOCK_SIZE) {
len = RECV_DATA_BLOCK_SIZE;
@@ -2167,7 +2167,7 @@ recv_parse_log_rec(
end_ptr));
}
- return(new_ptr - ptr);
+ return ulint(new_ptr - ptr);
}
/*******************************************************//**
@@ -2226,7 +2226,7 @@ recv_report_corrupt_log(
const ulint before
= std::min(recv_previous_parsed_rec_offset, limit);
const ulint after
- = std::min(recv_sys->len - (ptr - recv_sys->buf), limit);
+ = std::min(recv_sys->len - ulint(ptr - recv_sys->buf), limit);
ib::info() << "Hex dump starting " << before << " bytes before and"
" ending " << after << " bytes after the corrupted record:";
@@ -2234,7 +2234,7 @@ recv_report_corrupt_log(
ut_print_buf(stderr,
recv_sys->buf
+ recv_previous_parsed_rec_offset - before,
- ptr - recv_sys->buf + before + after
+ ulint(ptr - recv_sys->buf) + before + after
- recv_previous_parsed_rec_offset);
putc('\n', stderr);
diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc
index f101d624e88..3a5e09601e4 100644
--- a/storage/innobase/mem/mem0mem.cc
+++ b/storage/innobase/mem/mem0mem.cc
@@ -126,7 +126,7 @@ mem_heap_printf_low(
val = va_arg(ap, unsigned long);
- plen = sprintf(tmp, "%lu", val);
+ plen = size_t(sprintf(tmp, "%lu", val));
len += plen;
if (buf) {
diff --git a/storage/innobase/mtr/mtr0log.cc b/storage/innobase/mtr/mtr0log.cc
index 30d11a0c053..bd583b5efe3 100644
--- a/storage/innobase/mtr/mtr0log.cc
+++ b/storage/innobase/mtr/mtr0log.cc
@@ -504,8 +504,8 @@ mlog_open_and_write_index(
}
if (log_ptr + 2 > log_end) {
mlog_close(mtr, log_ptr);
- ut_a(total > (ulint) (log_ptr - log_start));
- total -= log_ptr - log_start;
+ ut_a(total > ulint(log_ptr - log_start));
+ total -= ulint(log_ptr - log_start);
alloc = std::min(
total,
ulint(mtr_buf_t::MAX_DATA_SIZE));
@@ -631,7 +631,7 @@ mlog_parse_index(
ind->get_n_nullable(n_core_fields));
} else {
ind->n_core_null_bytes = UT_BITS_IN_BYTES(
- ind->n_nullable);
+ unsigned(ind->n_nullable));
ind->n_core_fields = ind->n_fields;
}
}
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 36ee1401ee1..2f0f510253e 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1031,7 +1031,7 @@ AIOHandler::post_io_processing(Slot* slot)
ut_ad(slot->is_reserved);
/* Total bytes read so far */
- ulint n_bytes = (slot->ptr - slot->buf) + slot->n_bytes;
+ ulint n_bytes = ulint(slot->ptr - slot->buf) + slot->n_bytes;
return(n_bytes == slot->original_len ? DB_SUCCESS : DB_FAIL);
}
@@ -1327,7 +1327,7 @@ os_file_make_new_pathname(
/* Find the offset of the last slash. We will strip off the
old basename.ibd which starts after that slash. */
last_slash = strrchr((char*) old_path, OS_PATH_SEPARATOR);
- dir_len = last_slash ? last_slash - old_path : strlen(old_path);
+ dir_len = last_slash ? ulint(last_slash - old_path) : strlen(old_path);
/* allocate a new path and move the old directory path to it. */
new_path_len = dir_len + strlen(base_name) + sizeof "/.ibd";
@@ -1474,7 +1474,7 @@ os_file_get_parent_dir(
/* Non-trivial directory component */
- return(mem_strdupl(path, last_slash - path));
+ return(mem_strdupl(path, ulint(last_slash - path)));
}
#ifdef UNIV_ENABLE_UNIT_TEST_GET_PARENT_DIR
@@ -3288,7 +3288,7 @@ os_file_get_size(
/* st_blocks is in 512 byte sized blocks */
file_size.m_alloc_size = s.st_blocks * 512;
} else {
- file_size.m_total_size = ~0;
+ file_size.m_total_size = ~0U;
file_size.m_alloc_size = (os_offset_t) errno;
}
@@ -4847,7 +4847,7 @@ os_file_io(
os_offset_t offset,
dberr_t* err)
{
- ulint original_n = n;
+ ssize_t original_n = ssize_t(n);
IORequest type = in_type;
ssize_t bytes_returned = 0;
@@ -4862,7 +4862,7 @@ os_file_io(
break;
- } else if ((ulint) n_bytes + bytes_returned == n) {
+ } else if (n_bytes + bytes_returned == ssize_t(n)) {
bytes_returned += n_bytes;
@@ -4881,9 +4881,9 @@ os_file_io(
/* Handle partial read/write. */
- ut_ad((ulint) n_bytes + bytes_returned < n);
+ ut_ad(ulint(n_bytes + bytes_returned) < n);
- bytes_returned += (ulint) n_bytes;
+ bytes_returned += n_bytes;
if (!type.is_partial_io_warning_disabled()) {
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index 3986c4f4c44..2ee6305b8f2 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -187,7 +187,7 @@ os_thread_exit(bool detach)
pfs_delete_thread();
#endif
- my_atomic_addlint(&os_thread_count, -1);
+ my_atomic_addlint(&os_thread_count, ulint(-1));
#ifdef _WIN32
ExitThread(0);
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index 0316f33d8af..2e78aa59c53 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -413,7 +413,7 @@ page_cur_search_with_match(
owned by the upper limit directory slot. */
low = 0;
- up = page_dir_get_n_slots(page) - 1;
+ up = ulint(page_dir_get_n_slots(page)) - 1;
/* Perform binary search until the lower and upper limit directory
slots come to the distance 1 of each other */
@@ -659,7 +659,7 @@ page_cur_search_with_match_bytes(
owned by the upper limit directory slot. */
low = 0;
- up = page_dir_get_n_slots(page) - 1;
+ up = ulint(page_dir_get_n_slots(page)) - 1;
/* Perform binary search until the lower and upper limit directory
slots come to the distance 1 of each other */
@@ -1240,9 +1240,9 @@ page_direction_increment(
if (page_zip) {
page_zip_write_header(page_zip, ptr, 1, NULL);
}
- page_header_set_field(page, page_zip, PAGE_N_DIRECTION,
- page_header_get_field(page, PAGE_N_DIRECTION)
- + 1);
+ page_header_set_field(
+ page, page_zip, PAGE_N_DIRECTION,
+ 1U + page_header_get_field(page, PAGE_N_DIRECTION));
}
/***********************************************************//**
@@ -1391,7 +1391,7 @@ use_heap:
}
page_header_set_field(page, NULL, PAGE_N_RECS,
- 1 + page_get_n_recs(page));
+ 1U + page_get_n_recs(page));
/* 5. Set the n_owned field in the inserted record to zero,
and set the heap_no field */
@@ -1743,14 +1743,13 @@ too_small:
/* On compressed pages, do not relocate records from
the free list. If extra_size would grow, use the heap. */
- extra_size_diff
- = rec_offs_extra_size(offsets)
- - rec_offs_extra_size(foffsets);
+ extra_size_diff = lint(rec_offs_extra_size(offsets)
+ - rec_offs_extra_size(foffsets));
if (UNIV_UNLIKELY(extra_size_diff < 0)) {
/* Add an offset to the extra_size. */
if (rec_offs_size(foffsets)
- < rec_size - extra_size_diff) {
+ < rec_size - ulint(extra_size_diff)) {
goto too_small;
}
@@ -1853,7 +1852,7 @@ use_heap:
}
page_header_set_field(page, page_zip, PAGE_N_RECS,
- 1 + page_get_n_recs(page));
+ 1U + page_get_n_recs(page));
/* 5. Set the n_owned field in the inserted record to zero,
and set the heap_no field */
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index 6ec32ee4d5b..e3f2c967918 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -92,7 +92,7 @@ page_dir_find_owner_slot(
const page_t* page = page_align(rec);
const page_dir_slot_t* first_slot = page_dir_get_nth_slot(page, 0);
const page_dir_slot_t* slot = page_dir_get_nth_slot(
- page, page_dir_get_n_slots(page) - 1);
+ page, ulint(page_dir_get_n_slots(page)) - 1);
const rec_t* r = rec;
if (page_is_comp(page)) {
@@ -109,7 +109,7 @@ page_dir_find_owner_slot(
}
}
- uint16 rec_offs_bytes = mach_encode_2(r - page);
+ uint16 rec_offs_bytes = mach_encode_2(ulint(r - page));
while (UNIV_LIKELY(*(uint16*) slot != rec_offs_bytes)) {
@@ -1157,7 +1157,8 @@ delete_all:
is_leaf,
ULINT_UNDEFINED, &heap);
s = rec_offs_size(offsets);
- ut_ad(rec2 - page + s - rec_offs_extra_size(offsets)
+ ut_ad(ulint(rec2 - page) + s
+ - rec_offs_extra_size(offsets)
< UNIV_PAGE_SIZE);
ut_ad(size + s < UNIV_PAGE_SIZE);
size += s;
@@ -1693,7 +1694,7 @@ page_rec_get_n_recs_before(
slot = page_dir_get_nth_slot(page, i);
slot_rec = page_dir_slot_get_rec(slot);
- n += rec_get_n_owned_new(slot_rec);
+ n += lint(rec_get_n_owned_new(slot_rec));
if (rec == slot_rec) {
@@ -1711,7 +1712,7 @@ page_rec_get_n_recs_before(
slot = page_dir_get_nth_slot(page, i);
slot_rec = page_dir_slot_get_rec(slot);
- n += rec_get_n_owned_old(slot_rec);
+ n += lint(rec_get_n_owned_old(slot_rec));
if (rec == slot_rec) {
@@ -2056,7 +2057,7 @@ page_simple_validate_old(
goto func_exit;
}
- if (UNIV_UNLIKELY(rec_get_n_owned_old(rec))) {
+ if (UNIV_UNLIKELY(rec_get_n_owned_old(rec) != 0)) {
/* This is a record pointed to by a dir slot */
if (UNIV_UNLIKELY(rec_get_n_owned_old(rec)
!= own_count)) {
@@ -2247,7 +2248,7 @@ page_simple_validate_new(
goto func_exit;
}
- if (UNIV_UNLIKELY(rec_get_n_owned_new(rec))) {
+ if (UNIV_UNLIKELY(rec_get_n_owned_new(rec) != 0)) {
/* This is a record pointed to by a dir slot */
if (UNIV_UNLIKELY(rec_get_n_owned_new(rec)
!= own_count)) {
@@ -2568,7 +2569,7 @@ page_validate(
rec_own_count = rec_get_n_owned_old(rec);
}
- if (UNIV_UNLIKELY(rec_own_count)) {
+ if (UNIV_UNLIKELY(rec_own_count != 0)) {
/* This is a record pointed to by a dir slot */
if (UNIV_UNLIKELY(rec_own_count != own_count)) {
ib::error() << "Wrong owned count "
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index 9b6856ff2c5..1da423f46d8 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -156,7 +156,7 @@ page_zip_empty_size(
ulint n_fields, /*!< in: number of columns in the index */
ulint zip_size) /*!< in: compressed page size in bytes */
{
- lint size = zip_size
+ ulint size = zip_size
/* subtract the page header and the longest
uncompressed data needed for one record */
- (PAGE_DATA
@@ -166,7 +166,7 @@ page_zip_empty_size(
- REC_N_NEW_EXTRA_BYTES/* omitted bytes */)
/* subtract the space for page_zip_fields_encode() */
- compressBound(static_cast<uLong>(2 * (n_fields + 1)));
- return(size > 0 ? (ulint) size : 0);
+ return(lint(size) > 0 ? size : 0);
}
/** Check whether a tuple is too big for compressed table
@@ -230,7 +230,8 @@ page_zip_dir_elems(
const page_zip_des_t* page_zip) /*!< in: compressed page */
{
/* Exclude the page infimum and supremum from the record count. */
- return(page_dir_get_n_heap(page_zip->data) - PAGE_HEAP_NO_USER_LOW);
+ return ulint(page_dir_get_n_heap(page_zip->data))
+ - PAGE_HEAP_NO_USER_LOW;
}
/*************************************************************//**
@@ -289,7 +290,7 @@ page_zip_dir_user_size(
const page_zip_des_t* page_zip) /*!< in: compressed page */
{
ulint size = PAGE_ZIP_DIR_SLOT_SIZE
- * page_get_n_recs(page_zip->data);
+ * ulint(page_get_n_recs(page_zip->data));
ut_ad(size <= page_zip_dir_size(page_zip));
return(size);
}
@@ -397,7 +398,7 @@ page_zip_compress_write_log(
}
/* Read the number of user records. */
- trailer_size = page_dir_get_n_heap(page_zip->data)
+ trailer_size = ulint(page_dir_get_n_heap(page_zip->data))
- PAGE_HEAP_NO_USER_LOW;
/* Multiply by uncompressed of size stored per record */
if (!page_is_leaf(page)) {
@@ -419,7 +420,7 @@ page_zip_compress_write_log(
log_ptr = mlog_write_initial_log_record_fast((page_t*) page,
MLOG_ZIP_PAGE_COMPRESS,
log_ptr, mtr);
- mach_write_to_2(log_ptr, page_zip->m_end - FIL_PAGE_TYPE);
+ mach_write_to_2(log_ptr, ulint(page_zip->m_end - FIL_PAGE_TYPE));
log_ptr += 2;
mach_write_to_2(log_ptr, trailer_size);
log_ptr += 2;
@@ -431,7 +432,7 @@ page_zip_compress_write_log(
/* Write most of the page header, the compressed stream and
the modification log. */
mlog_catenate_string(mtr, page_zip->data + FIL_PAGE_TYPE,
- page_zip->m_end - FIL_PAGE_TYPE);
+ ulint(page_zip->m_end - FIL_PAGE_TYPE));
/* Write the uncompressed trailer of the compressed page. */
mlog_catenate_string(mtr, page_zip->data + page_zip_get_size(page_zip)
- trailer_size, trailer_size);
@@ -614,7 +615,7 @@ page_zip_fields_encode(
}
buf = page_zip_fixed_field_encode(
- buf, field->fixed_len << 1);
+ buf, ulint(field->fixed_len) << 1);
col++;
}
}
@@ -702,7 +703,7 @@ page_zip_dir_encode(
#if PAGE_ZIP_DIR_SLOT_MASK < UNIV_ZIP_SIZE_MAX - 1
# error PAGE_ZIP_DIR_SLOT_MASK < UNIV_ZIP_SIZE_MAX - 1
#endif
- if (UNIV_UNLIKELY(rec_get_n_owned_new(rec))) {
+ if (UNIV_UNLIKELY(rec_get_n_owned_new(rec) != 0)) {
offs |= PAGE_ZIP_DIR_SLOT_OWNED;
}
@@ -725,7 +726,7 @@ page_zip_dir_encode(
recs[heap_no - PAGE_HEAP_NO_USER_LOW] = rec;
}
- ut_a(rec_get_status(rec) == status);
+ ut_a(ulint(rec_get_status(rec)) == status);
}
offs = page_header_get_field(page, PAGE_FREE);
@@ -740,7 +741,7 @@ page_zip_dir_encode(
ut_a(heap_no < n_heap);
ut_a(!rec[-REC_N_NEW_EXTRA_BYTES]); /* info_bits and n_owned */
- ut_a(rec_get_status(rec) == status);
+ ut_a(ulint(rec_get_status(rec)) == status);
mach_write_to_2(buf - PAGE_ZIP_DIR_SLOT_SIZE * ++i, offs);
@@ -809,7 +810,7 @@ page_zip_set_alloc(
#ifdef PAGE_ZIP_COMPRESS_DBG
/** Set this variable in a debugger to enable
excessive logging in page_zip_compress(). */
-static ibool page_zip_compress_dbg;
+static bool page_zip_compress_dbg;
/** Set this variable in a debugger to enable
binary logging of the data passed to deflate().
When this variable is nonzero, it will act
@@ -1327,7 +1328,7 @@ page_zip_compress(
}
/* The dense directory excludes the infimum and supremum records. */
- n_dense = page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW;
+ n_dense = ulint(page_dir_get_n_heap(page)) - PAGE_HEAP_NO_USER_LOW;
#ifdef PAGE_ZIP_COMPRESS_DBG
if (UNIV_UNLIKELY(page_zip_compress_dbg)) {
ib::info() << "compress "
@@ -1775,7 +1776,8 @@ page_zip_fields_decode(
/* ROW_FORMAT=COMPRESSED does not support instant ADD COLUMN */
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));
ut_ad(b == end);
@@ -1852,7 +1854,7 @@ page_zip_dir_decode(
mach_write_to_2(slot, PAGE_NEW_SUPREMUM);
{
const page_dir_slot_t* last_slot = page_dir_get_nth_slot(
- page, page_dir_get_n_slots(page) - 1);
+ page, page_dir_get_n_slots(page) - 1U);
if (UNIV_UNLIKELY(slot != last_slot)) {
page_zip_fail(("page_zip_dir_decode 3: %p != %p\n",
@@ -1935,7 +1937,7 @@ page_zip_set_extra_bytes(
page[PAGE_NEW_SUPREMUM - REC_N_NEW_EXTRA_BYTES] = (byte) n_owned;
/* The dense directory excludes the infimum and supremum records. */
- n = page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW;
+ n = ulint(page_dir_get_n_heap(page)) - PAGE_HEAP_NO_USER_LOW;
if (i >= n) {
if (UNIV_LIKELY(i == n)) {
@@ -2021,8 +2023,8 @@ page_zip_apply_log_ext(
return(NULL);
}
- memcpy(next_out, data, dst - next_out);
- data += dst - next_out;
+ memcpy(next_out, data, ulint(dst - next_out));
+ data += ulint(dst - next_out);
next_out = dst + (DATA_TRX_ID_LEN
+ DATA_ROLL_PTR_LEN);
} else if (rec_offs_nth_extern(offsets, i)) {
@@ -2031,7 +2033,7 @@ page_zip_apply_log_ext(
ut_ad(len
>= BTR_EXTERN_FIELD_REF_SIZE);
- len += dst - next_out
+ len += ulint(dst - next_out)
- BTR_EXTERN_FIELD_REF_SIZE;
if (UNIV_UNLIKELY(data + len >= end)) {
@@ -2051,7 +2053,7 @@ page_zip_apply_log_ext(
}
/* Copy the last bytes of the record. */
- len = rec_get_end(rec, offsets) - next_out;
+ len = ulint(rec_get_end(rec, offsets) - next_out);
if (UNIV_UNLIKELY(data + len >= end)) {
page_zip_fail(("page_zip_apply_log_ext:"
" last %p+%lu >= %p\n",
@@ -2251,7 +2253,7 @@ page_zip_apply_log(
/* Copy any bytes following DB_TRX_ID, DB_ROLL_PTR. */
b = rec + l + (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
- len = rec_get_end(rec, offsets) - b;
+ len = ulint(rec_get_end(rec, offsets) - b);
if (UNIV_UNLIKELY(data + len >= end)) {
page_zip_fail(("page_zip_apply_log:"
" clust %p+%lu >= %p\n",
@@ -2422,9 +2424,10 @@ zlib_done:
/* Clear the unused heap space on the uncompressed page. */
memset(d_stream->next_out, 0,
- page_dir_get_nth_slot(page,
- page_dir_get_n_slots(page) - 1)
- - d_stream->next_out);
+ ulint(page_dir_get_nth_slot(page,
+ page_dir_get_n_slots(page)
+ - 1U)
+ - d_stream->next_out));
}
#ifdef UNIV_DEBUG
@@ -2576,9 +2579,10 @@ zlib_done:
/* Clear the unused heap space on the uncompressed page. */
memset(d_stream->next_out, 0,
- page_dir_get_nth_slot(page,
- page_dir_get_n_slots(page) - 1)
- - d_stream->next_out);
+ ulint(page_dir_get_nth_slot(page,
+ page_dir_get_n_slots(page)
+ - 1U)
+ - d_stream->next_out));
}
ut_d(page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in));
@@ -2905,9 +2909,10 @@ zlib_done:
/* Clear the unused heap space on the uncompressed page. */
memset(d_stream->next_out, 0,
- page_dir_get_nth_slot(page,
- page_dir_get_n_slots(page) - 1)
- - d_stream->next_out);
+ ulint(page_dir_get_nth_slot(page,
+ page_dir_get_n_slots(page)
+ - 1U)
+ - d_stream->next_out));
}
ut_d(page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in));
@@ -2951,7 +2956,7 @@ zlib_done:
ulint len;
byte* dst;
rec_t* rec = recs[slot];
- ibool exists = !page_zip_dir_find_free(
+ bool exists = !page_zip_dir_find_free(
page_zip, page_offset(rec));
offsets = rec_get_offsets(rec, index, offsets, true,
ULINT_UNDEFINED, &heap);
@@ -3313,7 +3318,7 @@ page_zip_hexdump_func(
#define page_zip_hexdump(buf, size) page_zip_hexdump_func(#buf, buf, size)
/** Flag: make page_zip_validate() compare page headers only */
-ibool page_zip_validate_header_only = FALSE;
+bool page_zip_validate_header_only;
/**********************************************************************//**
Check that the compressed and decompressed pages match.
@@ -3605,7 +3610,7 @@ page_zip_write_rec_ext(
memmove(ext_end - n_ext
* BTR_EXTERN_FIELD_REF_SIZE,
ext_end,
- externs - ext_end);
+ ulint(externs - ext_end));
}
ut_a(blob_no + n_ext <= page_zip->n_blobs);
@@ -3631,7 +3636,7 @@ page_zip_write_rec_ext(
/* Log the preceding fields. */
ASSERT_ZERO(data, src - start);
- memcpy(data, start, src - start);
+ memcpy(data, start, ulint(src - start));
data += src - start;
start = src + (DATA_TRX_ID_LEN
+ DATA_ROLL_PTR_LEN);
@@ -3651,7 +3656,7 @@ page_zip_write_rec_ext(
src += len - BTR_EXTERN_FIELD_REF_SIZE;
ASSERT_ZERO(data, src - start);
- memcpy(data, start, src - start);
+ memcpy(data, start, ulint(src - start));
data += src - start;
start = src + BTR_EXTERN_FIELD_REF_SIZE;
@@ -3663,7 +3668,7 @@ page_zip_write_rec_ext(
}
/* Log the last bytes of the record. */
- len = rec_offs_data_size(offsets) - (start - rec);
+ len = rec_offs_data_size(offsets) - ulint(start - rec);
ASSERT_ZERO(data, len);
memcpy(data, start, len);
@@ -3794,7 +3799,7 @@ page_zip_write_rec(
/* Log the preceding fields. */
ASSERT_ZERO(data, src - rec);
- memcpy(data, rec, src - rec);
+ memcpy(data, rec, ulint(src - rec));
data += src - rec;
/* Store trx_id and roll_ptr. */
@@ -3808,7 +3813,7 @@ page_zip_write_rec(
/* Log the last bytes of the record. */
len = rec_offs_data_size(offsets)
- - (src - rec);
+ - ulint(src - rec);
ASSERT_ZERO(data, len);
memcpy(data, src, len);
@@ -3996,7 +4001,7 @@ page_zip_write_blob_ptr(
(byte*) field, MLOG_ZIP_WRITE_BLOB_PTR, log_ptr, mtr);
mach_write_to_2(log_ptr, page_offset(field));
log_ptr += 2;
- mach_write_to_2(log_ptr, externs - page_zip->data);
+ mach_write_to_2(log_ptr, ulint(externs - page_zip->data));
log_ptr += 2;
memcpy(log_ptr, externs, BTR_EXTERN_FIELD_REF_SIZE);
log_ptr += BTR_EXTERN_FIELD_REF_SIZE;
@@ -4059,7 +4064,7 @@ corrupt:
storage_end = page_zip_dir_start(page_zip);
- heap_no = 1 + (storage_end - storage) / REC_NODE_PTR_SIZE;
+ heap_no = 1 + ulint(storage_end - storage) / REC_NODE_PTR_SIZE;
if (UNIV_UNLIKELY((storage_end - storage) % REC_NODE_PTR_SIZE)
|| UNIV_UNLIKELY(heap_no < PAGE_HEAP_NO_USER_LOW)
@@ -4134,7 +4139,7 @@ page_zip_write_node_ptr(
field, MLOG_ZIP_WRITE_NODE_PTR, log_ptr, mtr);
mach_write_to_2(log_ptr, page_offset(field));
log_ptr += 2;
- mach_write_to_2(log_ptr, storage - page_zip->data);
+ mach_write_to_2(log_ptr, ulint(storage - page_zip->data));
log_ptr += 2;
memcpy(log_ptr, field, REC_NODE_PTR_SIZE);
log_ptr += REC_NODE_PTR_SIZE;
@@ -4222,7 +4227,7 @@ page_zip_write_trx_id_and_roll_ptr(
(byte*) field, MLOG_ZIP_WRITE_TRX_ID, log_ptr, mtr);
mach_write_to_2(log_ptr, page_offset(field));
log_ptr += 2;
- mach_write_to_2(log_ptr, storage - page_zip->data);
+ mach_write_to_2(log_ptr, ulint(storage - page_zip->data));
log_ptr += 2;
memcpy(log_ptr, field, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
log_ptr += DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN;
@@ -4466,7 +4471,7 @@ page_zip_dir_insert(
/* Read the old n_dense (n_heap may have been incremented). */
n_dense = page_dir_get_n_heap(page_zip->data)
- - (PAGE_HEAP_NO_USER_LOW + 1);
+ - (PAGE_HEAP_NO_USER_LOW + 1U);
if (UNIV_LIKELY_NULL(free_rec)) {
/* The record was allocated from the free list.
@@ -4493,7 +4498,7 @@ page_zip_dir_insert(
/* Shift the dense directory to allocate place for rec. */
memmove(slot_free - PAGE_ZIP_DIR_SLOT_SIZE, slot_free,
- slot_rec - slot_free);
+ ulint(slot_rec - slot_free));
/* Write the entry for the inserted record.
The "owned" and "deleted" flags must be zero. */
@@ -4551,7 +4556,7 @@ page_zip_dir_delete(
if (UNIV_LIKELY(slot_rec > slot_free)) {
memmove(slot_free + PAGE_ZIP_DIR_SLOT_SIZE,
slot_free,
- slot_rec - slot_free);
+ ulint(slot_rec - slot_free));
}
/* Write the entry for the deleted record.
@@ -4564,7 +4569,7 @@ page_zip_dir_delete(
}
n_ext = rec_offs_n_extern(offsets);
- if (UNIV_UNLIKELY(n_ext)) {
+ if (UNIV_UNLIKELY(n_ext != 0)) {
/* Shift and zero fill the array of BLOB pointers. */
ulint blob_no;
byte* externs;
@@ -4584,7 +4589,7 @@ page_zip_dir_delete(
page_zip->n_blobs -= static_cast<unsigned>(n_ext);
/* Shift and zero fill the array. */
memmove(ext_end + n_ext * BTR_EXTERN_FIELD_REF_SIZE, ext_end,
- (page_zip->n_blobs - blob_no)
+ ulint(page_zip->n_blobs - blob_no)
* BTR_EXTERN_FIELD_REF_SIZE);
memset(ext_end, 0, n_ext * BTR_EXTERN_FIELD_REF_SIZE);
}
@@ -4615,7 +4620,7 @@ page_zip_dir_add_slot(
/* Read the old n_dense (n_heap has already been incremented). */
n_dense = page_dir_get_n_heap(page_zip->data)
- - (PAGE_HEAP_NO_USER_LOW + 1);
+ - (PAGE_HEAP_NO_USER_LOW + 1U);
dir = page_zip->data + page_zip_get_size(page_zip)
- PAGE_ZIP_DIR_SLOT_SIZE * n_dense;
@@ -4635,7 +4640,7 @@ page_zip_dir_add_slot(
ASSERT_ZERO(externs - PAGE_ZIP_CLUST_LEAF_SLOT_SIZE,
PAGE_ZIP_CLUST_LEAF_SLOT_SIZE);
memmove(externs - PAGE_ZIP_CLUST_LEAF_SLOT_SIZE,
- externs, stored - externs);
+ externs, ulint(stored - externs));
} else {
stored = dir
- page_zip->n_blobs * BTR_EXTERN_FIELD_REF_SIZE;
@@ -4645,7 +4650,7 @@ page_zip_dir_add_slot(
/* Move the uncompressed area backwards to make space
for one directory slot. */
- memmove(stored - PAGE_ZIP_DIR_SLOT_SIZE, stored, dir - stored);
+ memmove(stored - PAGE_ZIP_DIR_SLOT_SIZE, stored, ulint(dir - stored));
}
/***********************************************************//**
diff --git a/storage/innobase/pars/pars0opt.cc b/storage/innobase/pars/pars0opt.cc
index bbc8eec0774..0d60dc7bade 100644
--- a/storage/innobase/pars/pars0opt.cc
+++ b/storage/innobase/pars/pars0opt.cc
@@ -206,7 +206,7 @@ opt_look_for_col_in_comparison_before(
if (opt_check_exp_determined_before(exp, sel_node,
nth_table)) {
- *op = search_cond->func;
+ *op = ulint(search_cond->func);
return(exp);
}
@@ -225,7 +225,8 @@ opt_look_for_col_in_comparison_before(
if (opt_check_exp_determined_before(exp, sel_node,
nth_table)) {
- *op = opt_invert_cmp_op(search_cond->func);
+ *op = ulint(opt_invert_cmp_op(
+ search_cond->func));
return(exp);
}
diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc
index fbe55d1df03..8a30e611eb4 100644
--- a/storage/innobase/pars/pars0pars.cc
+++ b/storage/innobase/pars/pars0pars.cc
@@ -1832,7 +1832,7 @@ pars_column_def(
ulint len2;
if (len) {
- len2 = eval_node_get_int_val(len);
+ len2 = ulint(eval_node_get_int_val(len));
} else {
len2 = 0;
}
@@ -2074,9 +2074,8 @@ pars_get_lex_chars(
{
int len;
- len = static_cast<int>(
- pars_sym_tab_global->string_len
- - pars_sym_tab_global->next_char_pos);
+ len = int(pars_sym_tab_global->string_len)
+ - pars_sym_tab_global->next_char_pos;
if (len == 0) {
return(0);
}
@@ -2085,8 +2084,8 @@ pars_get_lex_chars(
len = max_size;
}
- ut_memcpy(buf, pars_sym_tab_global->sql_string
- + pars_sym_tab_global->next_char_pos, len);
+ memcpy(buf, pars_sym_tab_global->sql_string
+ + pars_sym_tab_global->next_char_pos, ulint(len));
pars_sym_tab_global->next_char_pos += len;
@@ -2345,7 +2344,7 @@ pars_info_add_int4_literal(
/*=======================*/
pars_info_t* info, /*!< in: info struct */
const char* name, /*!< in: name */
- lint val) /*!< in: value */
+ ulint val) /*!< in: value */
{
byte* buf = static_cast<byte*>(mem_heap_alloc(info->heap, 4));
diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc
index bf045a779ce..947b281e4b9 100644
--- a/storage/innobase/que/que0que.cc
+++ b/storage/innobase/que/que0que.cc
@@ -484,7 +484,7 @@ que_graph_free_recursive(
if (upd->in_mysql_interface) {
btr_pcur_free_for_mysql(upd->pcur);
- upd->in_mysql_interface = FALSE;
+ upd->in_mysql_interface = false;
}
que_graph_free_recursive(upd->cascade_node);
diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc
index bfb9e95a5f8..410292c3790 100644
--- a/storage/innobase/rem/rem0cmp.cc
+++ b/storage/innobase/rem/rem0cmp.cc
@@ -308,7 +308,7 @@ cmp_gis_field(
return(cmp_geometry_field(DATA_GEOMETRY, DATA_GIS_MBR,
a, a_length, b, b_length));
} else {
- return(rtree_key_cmp(mode, a, a_length, b, b_length));
+ return rtree_key_cmp(mode, a, int(a_length), b, int(b_length));
}
}
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index 3c7292ef1ca..7f9b3845bb4 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -347,7 +347,7 @@ ordinary:
/* fall through */
case REC_LEAF_TEMP_COLUMNS_ADDED:
ut_ad(index->is_instant());
- n_fields = index->n_core_fields + 1
+ n_fields = unsigned(index->n_core_fields) + 1
+ rec_get_n_add_field(nulls);
ut_ad(n_fields <= index->n_fields);
const ulint n_nullable = index->get_n_nullable(n_fields);
@@ -448,7 +448,7 @@ resolved:
} while (++i < rec_offs_n_fields(offsets));
*rec_offs_base(offsets)
- = (rec - (lens + 1)) | REC_OFFS_COMPACT | any;
+ = ulint(rec - (lens + 1)) | REC_OFFS_COMPACT | any;
}
#ifdef UNIV_DEBUG
@@ -594,7 +594,7 @@ rec_init_offsets(
const byte* lens;
dict_field_t* field;
ulint null_mask;
- ulint status = rec_get_status(rec);
+ rec_comp_status_t status = rec_get_status(rec);
ulint n_node_ptr_field = ULINT_UNDEFINED;
switch (UNIV_EXPECT(status, REC_STATUS_ORDINARY)) {
@@ -710,7 +710,7 @@ resolved:
} while (++i < rec_offs_n_fields(offsets));
*rec_offs_base(offsets)
- = (rec - (lens + 1)) | REC_OFFS_COMPACT;
+ = ulint(rec - (lens + 1)) | REC_OFFS_COMPACT;
} else {
/* Old-style record: determine extra size and end offsets */
offs = REC_N_OLD_EXTRA_BYTES;
@@ -910,7 +910,7 @@ rec_get_offsets_reverse(
ut_ad(dict_table_is_comp(index->table));
ut_ad(!index->is_instant());
- if (UNIV_UNLIKELY(node_ptr)) {
+ if (UNIV_UNLIKELY(node_ptr != 0)) {
n_node_ptr_field =
dict_index_get_n_unique_in_tree_nonleaf(index);
n = n_node_ptr_field + 1;
@@ -996,7 +996,7 @@ resolved:
} while (++i < rec_offs_n_fields(offsets));
ut_ad(lens >= extra);
- *rec_offs_base(offsets) = (lens - extra + REC_N_NEW_EXTRA_BYTES)
+ *rec_offs_base(offsets) = (ulint(lens - extra) + REC_N_NEW_EXTRA_BYTES)
| REC_OFFS_COMPACT | any_ext;
}
@@ -1484,7 +1484,8 @@ rec_convert_dtuple_to_rec_comp(
lens = nulls - (index->is_instant()
? UT_BITS_IN_BYTES(index->get_n_nullable(
n_fields))
- : UT_BITS_IN_BYTES(index->n_nullable));
+ : UT_BITS_IN_BYTES(
+ unsigned(index->n_nullable)));
break;
case REC_STATUS_NODE_PTR:
ut_ad(!temp);
@@ -1505,7 +1506,7 @@ rec_convert_dtuple_to_rec_comp(
end = rec;
/* clear the SQL-null flags */
- memset(lens + 1, 0, nulls - lens);
+ memset(lens + 1, 0, ulint(nulls - lens));
/* Store the data and the offsets */
@@ -1883,7 +1884,7 @@ rec_copy_prefix_to_buf(
an instant ADD COLUMN operation. */
ut_ad(index->is_instant() || page_rec_is_default_row(rec));
nulls = &rec[-REC_N_NEW_EXTRA_BYTES];
- const ulint n_rec = index->n_core_fields + 1
+ const ulint n_rec = ulint(index->n_core_fields) + 1
+ rec_get_n_add_field(nulls);
const uint n_nullable = index->get_n_nullable(n_rec);
lens = --nulls - UT_BITS_IN_BYTES(n_nullable);
@@ -1946,7 +1947,7 @@ rec_copy_prefix_to_buf(
UNIV_PREFETCH_R(rec + prefix_len);
- prefix_len += rec - (lens + 1);
+ prefix_len += ulint(rec - (lens + 1));
if ((*buf == NULL) || (*buf_size < prefix_len)) {
ut_free(*buf);
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index bd246435a86..3ca93ba34b9 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -108,7 +108,7 @@ row_merge_create_fts_sort_index(
? DATA_VARCHAR : DATA_VARMYSQL;
field->col->mbminlen = idx_field->col->mbminlen;
field->col->mbmaxlen = idx_field->col->mbmaxlen;
- field->col->len = HA_FT_MAXCHARLEN * field->col->mbmaxlen;
+ field->col->len = HA_FT_MAXCHARLEN * unsigned(field->col->mbmaxlen);
field->fixed_len = 0;
@@ -415,9 +415,9 @@ row_merge_fts_doc_add_word_for_parser(
ut_ad(t_ctx);
str.f_str = (byte*)(word);
- str.f_len = word_len;
+ str.f_len = ulint(word_len);
str.f_n_char = fts_get_token_size(
- (CHARSET_INFO*)param->cs, word, word_len);
+ (CHARSET_INFO*)param->cs, word, ulint(word_len));
/* JAN: TODO: MySQL 5.7 FTS
ut_ad(boolean_info->position >= 0);
@@ -1135,7 +1135,7 @@ row_fts_start_parallel_merge(
/*=========================*/
fts_psort_t* merge_info) /*!< in: parallel sort info */
{
- int i = 0;
+ ulint i = 0;
/* Kick off merge/insert threads */
for (i = 0; i < FTS_NUM_AUX_INDEX; i++) {
@@ -1375,10 +1375,10 @@ row_fts_insert_tuple(
Propagate a newly added record up one level in the selection tree
@return parent where this value propagated to */
static
-int
+ulint
row_fts_sel_tree_propagate(
/*=======================*/
- int propogated, /*<! in: tree node propagated */
+ ulint propogated, /*<! in: tree node propagated */
int* sel_tree, /*<! in: selection tree */
const mrec_t** mrec, /*<! in: sort record */
ulint** offsets, /*<! in: record offsets */
@@ -1417,7 +1417,7 @@ row_fts_sel_tree_propagate(
sel_tree[parent] = selected;
- return(static_cast<int>(parent));
+ return parent;
}
/*********************************************************************//**
@@ -1437,8 +1437,8 @@ row_fts_sel_tree_update(
ulint i;
for (i = 1; i <= height; i++) {
- propagated = static_cast<ulint>(row_fts_sel_tree_propagate(
- static_cast<int>(propagated), sel_tree, mrec, offsets, index));
+ propagated = row_fts_sel_tree_propagate(
+ propagated, sel_tree, mrec, offsets, index);
}
return(sel_tree[0]);
@@ -1518,7 +1518,7 @@ row_fts_build_sel_tree(
{
ulint treelevel = 1;
ulint num = 2;
- int i = 0;
+ ulint i = 0;
ulint start;
/* No need to build selection tree if we only have two merge threads */
@@ -1533,13 +1533,13 @@ row_fts_build_sel_tree(
start = (ulint(1) << treelevel) - 1;
- for (i = 0; i < (int) fts_sort_pll_degree; i++) {
- sel_tree[i + start] = i;
+ for (i = 0; i < fts_sort_pll_degree; i++) {
+ sel_tree[i + start] = int(i);
}
- for (i = static_cast<int>(treelevel) - 1; i >= 0; i--) {
+ for (i = treelevel; --i; ) {
row_fts_build_sel_tree_level(
- sel_tree, static_cast<ulint>(i), mrec, offsets, index);
+ sel_tree, i, mrec, offsets, index);
}
return(treelevel);
@@ -1579,7 +1579,7 @@ row_fts_merge_insert(
ulint height;
ulint start;
fts_psort_insert_t ins_ctx;
- ulint count_diag = 0;
+ uint64_t count_diag = 0;
fts_table_t fts_table;
char aux_table_name[MAX_FULL_NAME_LEN];
dict_table_t* aux_table;
@@ -1645,7 +1645,7 @@ row_fts_merge_insert(
buf[i] = static_cast<mrec_buf_t*>(
mem_heap_alloc(heap, sizeof *buf[i]));
- count_diag += (int) psort_info[i].merge_file[id]->n_rec;
+ count_diag += psort_info[i].merge_file[id]->n_rec;
}
if (fts_enable_diag_print) {
@@ -1737,7 +1737,7 @@ row_fts_merge_insert(
height = row_fts_build_sel_tree(sel_tree, (const mrec_t **) mrec,
offsets, index);
- start = (1 << height) - 1;
+ start = (1U << height) - 1;
/* Fetch sorted records from sort buffer and insert them into
corresponding FTS index auxiliary tables */
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 88bd7dbe2a6..312d730d350 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -1560,7 +1560,7 @@ PageConverter::adjust_cluster_index_blob_column(
return(DB_CORRUPTION);
}
- field += BTR_EXTERN_SPACE_ID - BTR_EXTERN_FIELD_REF_SIZE + len;
+ field += len - (BTR_EXTERN_FIELD_REF_SIZE - BTR_EXTERN_SPACE_ID);
mach_write_to_4(field, get_space_id());
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index c247c66bd96..fe70648b480 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -359,7 +359,8 @@ row_ins_clust_index_entry_by_modify(
cursor->index, entry, rec, NULL, true,
thr_get_trx(thr), heap, mysql_table);
if (mode != BTR_MODIFY_TREE) {
- ut_ad((mode & ~BTR_ALREADY_S_LATCHED) == BTR_MODIFY_LEAF);
+ ut_ad((mode & ulint(~BTR_ALREADY_S_LATCHED))
+ == BTR_MODIFY_LEAF);
/* Try optimistic updating of the record, keeping changes
within the page */
@@ -2638,7 +2639,7 @@ row_ins_clust_index_entry_low(
}
#endif /* UNIV_DEBUG */
- if (UNIV_UNLIKELY(entry->info_bits)) {
+ if (UNIV_UNLIKELY(entry->info_bits != 0)) {
ut_ad(entry->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(flags == BTR_NO_LOCKING_FLAG);
ut_ad(index->is_instant());
@@ -2739,7 +2740,7 @@ do_insert:
rec_t* insert_rec;
if (mode != BTR_MODIFY_TREE) {
- ut_ad((mode & ~BTR_ALREADY_S_LATCHED)
+ ut_ad((mode & ulint(~BTR_ALREADY_S_LATCHED))
== BTR_MODIFY_LEAF);
err = btr_cur_optimistic_insert(
flags, cursor, &offsets, &offsets_heap,
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 9364f37890a..a04de8c0e70 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -655,8 +655,9 @@ row_log_table_delete(
fields of the record. */
heap = mem_heap_create(
DATA_TRX_ID_LEN
- + DTUPLE_EST_ALLOC(new_index->n_uniq + 2));
- old_pk = tuple = dtuple_create(heap, new_index->n_uniq + 2);
+ + DTUPLE_EST_ALLOC(unsigned(new_index->n_uniq) + 2));
+ old_pk = tuple = dtuple_create(
+ heap, unsigned(new_index->n_uniq) + 2);
dict_index_copy_types(tuple, new_index, tuple->n_fields);
dtuple_set_n_fields_cmp(tuple, new_index->n_uniq);
@@ -1282,7 +1283,7 @@ row_log_table_get_pk(
if (!offsets) {
size += (1 + REC_OFFS_HEADER_SIZE
- + index->n_fields)
+ + unsigned(index->n_fields))
* sizeof *offsets;
}
@@ -2464,7 +2465,7 @@ row_log_table_apply_op(
if (next_mrec > mrec_end) {
return(NULL);
} else {
- log->head.total += next_mrec - mrec_start;
+ log->head.total += ulint(next_mrec - mrec_start);
*error = row_log_table_apply_insert(
thr, mrec, offsets, offsets_heap,
heap, dup);
@@ -2489,7 +2490,8 @@ row_log_table_apply_op(
/* The ROW_T_DELETE record was converted by
rec_convert_dtuple_to_temp() using new_index. */
ut_ad(!new_index->is_instant());
- rec_offs_set_n_fields(offsets, new_index->n_uniq + 2);
+ rec_offs_set_n_fields(offsets,
+ unsigned(new_index->n_uniq) + 2);
rec_init_offsets_temp(mrec, new_index, offsets);
next_mrec = mrec + rec_offs_data_size(offsets) + ext_size;
@@ -2497,7 +2499,7 @@ row_log_table_apply_op(
return(NULL);
}
- log->head.total += next_mrec - mrec_start;
+ log->head.total += ulint(next_mrec - mrec_start);
/* If there are external fields, retrieve those logged
prefix info and reconstruct the row_ext_t */
@@ -2603,7 +2605,8 @@ row_log_table_apply_op(
/* The old_pk prefix was converted by
rec_convert_dtuple_to_temp() using new_index. */
ut_ad(!new_index->is_instant());
- rec_offs_set_n_fields(offsets, new_index->n_uniq + 2);
+ rec_offs_set_n_fields(offsets,
+ unsigned(new_index->n_uniq) + 2);
rec_init_offsets_temp(mrec, new_index, offsets);
next_mrec = mrec + rec_offs_data_size(offsets);
@@ -2613,7 +2616,8 @@ row_log_table_apply_op(
/* Copy the PRIMARY KEY fields and
DB_TRX_ID, DB_ROLL_PTR from mrec to old_pk. */
- old_pk = dtuple_create(heap, new_index->n_uniq + 2);
+ old_pk = dtuple_create(
+ heap, unsigned(new_index->n_uniq) + 2);
dict_index_copy_types(old_pk, new_index,
old_pk->n_fields);
@@ -2670,7 +2674,7 @@ row_log_table_apply_op(
}
ut_ad(next_mrec <= mrec_end);
- log->head.total += next_mrec - mrec_start;
+ log->head.total += ulint(next_mrec - mrec_start);
dtuple_set_n_fields_cmp(old_pk, new_index->n_uniq);
*error = row_log_table_apply_update(
@@ -2939,7 +2943,7 @@ all_done:
ut_ad(mrec_end < (&index->online_log->head.buf)[1]);
memcpy((mrec_t*) mrec_end, next_mrec,
- (&index->online_log->head.buf)[1] - mrec_end);
+ ulint((&index->online_log->head.buf)[1] - mrec_end));
mrec = row_log_table_apply_op(
thr, new_trx_id_col,
dup, &error, offsets_heap, heap,
@@ -2956,7 +2960,7 @@ all_done:
it should proceed beyond the old end of the buffer. */
ut_a(mrec > mrec_end);
- index->online_log->head.bytes = mrec - mrec_end;
+ index->online_log->head.bytes = ulint(mrec - mrec_end);
next_mrec += index->online_log->head.bytes;
}
@@ -3064,7 +3068,8 @@ process_next_block:
goto next_block;
} else if (next_mrec != NULL) {
ut_ad(next_mrec < next_mrec_end);
- index->online_log->head.bytes += next_mrec - mrec;
+ index->online_log->head.bytes
+ += ulint(next_mrec - mrec);
} else if (has_index_lock) {
/* When mrec is within tail.block, it should
be a complete record, because we are holding
@@ -3076,8 +3081,8 @@ process_next_block:
goto unexpected_eof;
} else {
memcpy(index->online_log->head.buf, mrec,
- mrec_end - mrec);
- mrec_end += index->online_log->head.buf - mrec;
+ ulint(mrec_end - mrec));
+ mrec_end += ulint(index->online_log->head.buf - mrec);
mrec = index->online_log->head.buf;
goto process_next_block;
}
@@ -3798,7 +3803,7 @@ all_done:
ut_ad(mrec_end < (&index->online_log->head.buf)[1]);
memcpy((mrec_t*) mrec_end, next_mrec,
- (&index->online_log->head.buf)[1] - mrec_end);
+ ulint((&index->online_log->head.buf)[1] - mrec_end));
mrec = row_log_apply_op(
index, dup, &error, offsets_heap, heap,
has_index_lock, index->online_log->head.buf,
@@ -3814,7 +3819,7 @@ all_done:
it should proceed beyond the old end of the buffer. */
ut_a(mrec > mrec_end);
- index->online_log->head.bytes = mrec - mrec_end;
+ index->online_log->head.bytes = ulint(mrec - mrec_end);
next_mrec += index->online_log->head.bytes;
}
@@ -3912,7 +3917,8 @@ process_next_block:
goto next_block;
} else if (next_mrec != NULL) {
ut_ad(next_mrec < next_mrec_end);
- index->online_log->head.bytes += next_mrec - mrec;
+ index->online_log->head.bytes
+ += ulint(next_mrec - mrec);
} else if (has_index_lock) {
/* When mrec is within tail.block, it should
be a complete record, because we are holding
@@ -3924,8 +3930,8 @@ process_next_block:
goto unexpected_eof;
} else {
memcpy(index->online_log->head.buf, mrec,
- mrec_end - mrec);
- mrec_end += index->online_log->head.buf - mrec;
+ ulint(mrec_end - mrec));
+ mrec_end += ulint(index->online_log->head.buf - mrec);
mrec = index->online_log->head.buf;
goto process_next_block;
}
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 669bbd59a0e..c38100a54da 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -559,7 +559,7 @@ row_merge_buf_add(
mem_heap_alloc(buf->heap, n_fields * sizeof *entry->fields));
data_size = 0;
- extra_size = UT_BITS_IN_BYTES(index->n_nullable);
+ extra_size = UT_BITS_IN_BYTES(unsigned(index->n_nullable));
ifield = dict_index_get_nth_field(index, 0);
@@ -1232,7 +1232,7 @@ err_exit:
to the auxiliary buffer and handle this as a special
case. */
- avail_size = &block[srv_sort_buf_size] - b;
+ avail_size = ulint(&block[srv_sort_buf_size] - b);
ut_ad(avail_size < sizeof *buf);
memcpy(*buf, b, avail_size);
@@ -1287,7 +1287,7 @@ err_exit:
/* The record spans two blocks. Copy it to buf. */
b -= extra_size + data_size;
- avail_size = &block[srv_sort_buf_size] - b;
+ avail_size = ulint(&block[srv_sort_buf_size] - b);
memcpy(*buf, b, avail_size);
*mrec = *buf + extra_size;
@@ -1403,7 +1403,7 @@ row_merge_write_rec(
if (UNIV_UNLIKELY(b + size >= &block[srv_sort_buf_size])) {
/* The record spans two blocks.
Copy it to the temporary buffer first. */
- avail_size = &block[srv_sort_buf_size] - b;
+ avail_size = ulint(&block[srv_sort_buf_size] - b);
row_merge_write_rec_low(buf[0],
extra_size, size, fd, *foffs,
@@ -1467,7 +1467,7 @@ row_merge_write_eof(
#ifdef UNIV_DEBUG_VALGRIND
/* The rest of the block is uninitialized. Initialize it
to avoid bogus warnings. */
- memset(b, 0xff, &block[srv_sort_buf_size] - b);
+ memset(b, 0xff, ulint(&block[srv_sort_buf_size] - b));
#endif /* UNIV_DEBUG_VALGRIND */
if (!row_merge_write(fd, (*foffs)++, block, crypt_block, space)) {
@@ -1842,7 +1842,7 @@ row_merge_read_clustered_index(
clust_index = dict_table_get_first_index(old_table);
const ulint old_trx_id_col = DATA_TRX_ID - DATA_N_SYS_COLS
- + old_table->n_cols;
+ + ulint(old_table->n_cols);
ut_ad(old_table->cols[old_trx_id_col].mtype == DATA_SYS);
ut_ad(old_table->cols[old_trx_id_col].prtype
== (DATA_TRX_ID | DATA_NOT_NULL));
@@ -4364,7 +4364,7 @@ row_merge_rename_tables_dict(
pars_info_add_str_literal(info, "tmp_name", tmp_name);
pars_info_add_str_literal(info, "tmp_path", tmp_path);
pars_info_add_int4_literal(info, "old_space",
- lint(old_table->space_id));
+ old_table->space_id);
err = que_eval_sql(info,
"PROCEDURE RENAME_OLD_SPACE () IS\n"
@@ -4395,7 +4395,7 @@ row_merge_rename_tables_dict(
old_table->name.m_name);
pars_info_add_str_literal(info, "old_path", old_path);
pars_info_add_int4_literal(info, "new_space",
- lint(new_table->space_id));
+ new_table->space_id);
err = que_eval_sql(info,
"PROCEDURE RENAME_NEW_SPACE () IS\n"
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index f508a464006..46637b9159a 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -477,7 +477,7 @@ row_mysql_store_col_in_innobase_format(
case 4:
/* space=0x00000020 */
/* Trim "half-chars", just in case. */
- col_len &= ~3;
+ col_len &= ~3U;
while (col_len >= 4
&& ptr[col_len - 4] == 0x00
@@ -490,7 +490,7 @@ row_mysql_store_col_in_innobase_format(
case 2:
/* space=0x0020 */
/* Trim "half-chars", just in case. */
- col_len &= ~1;
+ col_len &= ~1U;
while (col_len >= 2 && ptr[col_len - 2] == 0x00
&& ptr[col_len - 1] == 0x20) {
@@ -1621,7 +1621,7 @@ row_create_update_node_for_mysql(
node = upd_node_create(heap);
- node->in_mysql_interface = TRUE;
+ node->in_mysql_interface = true;
node->is_delete = NO_DELETE;
node->searched_update = FALSE;
node->select = NULL;
@@ -2581,7 +2581,7 @@ row_create_index_for_mysql(
if (index) {
ut_ad(!index->is_instant());
index->n_core_null_bytes = UT_BITS_IN_BYTES(
- index->n_nullable);
+ unsigned(index->n_nullable));
err = dict_create_index_tree_in_mem(index, trx);
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 13e01f5ebf9..35d99d81180 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -806,10 +806,10 @@ skip_secondaries:
can calculate from node->roll_ptr the file
address of the new_val data */
- internal_offset
- = ((const byte*)
- dfield_get_data(&ufield->new_val))
- - undo_rec;
+ internal_offset = ulint(
+ static_cast<const byte*>
+ (dfield_get_data(&ufield->new_val))
+ - undo_rec);
ut_a(internal_offset < UNIV_PAGE_SIZE);
diff --git a/storage/innobase/row/row0quiesce.cc b/storage/innobase/row/row0quiesce.cc
index dc0cb5f5424..f7dad05a780 100644
--- a/storage/innobase/row/row0quiesce.cc
+++ b/storage/innobase/row/row0quiesce.cc
@@ -243,7 +243,7 @@ row_quiesce_write_table(
This field is also redundant, because the lengths
are a property of the character set encoding, which
in turn is encodedin prtype above. */
- mach_write_to_4(ptr, col->mbmaxlen * 5 + col->mbminlen);
+ mach_write_to_4(ptr, ulint(col->mbmaxlen * 5 + col->mbminlen));
ptr += sizeof(ib_uint32_t);
mach_write_to_4(ptr, col->ind);
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc
index 2664f8a3d9e..30b0a7a360c 100644
--- a/storage/innobase/row/row0row.cc
+++ b/storage/innobase/row/row0row.cc
@@ -1014,7 +1014,7 @@ row_search_on_row_ref(
index = dict_table_get_first_index(table);
- if (UNIV_UNLIKELY(ref->info_bits)) {
+ if (UNIV_UNLIKELY(ref->info_bits != 0)) {
ut_ad(ref->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(ref->n_fields <= index->n_uniq);
btr_pcur_open_at_index_side(true, index, mode, pcur, true, 0,
@@ -1186,7 +1186,7 @@ row_raw_format_int(
value = mach_read_int_type(
(const byte*) data, data_len, unsigned_type);
- ret = snprintf(
+ ret = (ulint) snprintf(
buf, buf_size,
unsigned_type ? "%llu" : "%lld", (longlong) value)+1;
} else {
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 09cff2a977e..bf88876d8fb 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -506,8 +506,8 @@ row_sel_fetch_columns(
if (field_no != ULINT_UNDEFINED) {
- if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets,
- field_no))) {
+ if (UNIV_UNLIKELY(rec_offs_nth_extern(
+ offsets, field_no) != 0)) {
/* Copy an externally stored field to the
temporary heap, if possible. */
@@ -2577,8 +2577,8 @@ row_sel_convert_mysql_key_to_innobase(
even though the actual value only takes data
len bytes from the start. */
- data_len = key_ptr[data_offset]
- + 256 * key_ptr[data_offset + 1];
+ data_len = ulint(key_ptr[data_offset])
+ | ulint(key_ptr[data_offset + 1]) << 8;
data_field_len = data_offset + 2
+ field->prefix_len;
@@ -2817,7 +2817,8 @@ row_sel_field_store_in_mysql_format_func(
}
}
- row_mysql_pad_col(templ->mbminlen, pad, field_end - pad);
+ row_mysql_pad_col(templ->mbminlen, pad,
+ ulint(field_end - pad));
break;
case DATA_BLOB:
@@ -2943,7 +2944,7 @@ row_sel_store_mysql_field_func(
|| field_no == templ->icp_rec_field_no);
ut_ad(rec_offs_validate(rec, index, offsets));
- if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no))) {
+ if (UNIV_UNLIKELY(rec_offs_nth_extern(offsets, field_no) != 0)) {
mem_heap_t* heap;
/* Copy an externally stored field to a temporary heap */
@@ -3504,10 +3505,10 @@ err_exit:
Restores cursor position after it has been stored. We have to take into
account that the record cursor was positioned on may have been deleted.
Then we may have to move the cursor one step up or down.
-@return TRUE if we may need to process the record the cursor is now
+@return true if we may need to process the record the cursor is now
positioned on (i.e. we should not go to the next record yet) */
static
-ibool
+bool
sel_restore_position_for_mysql(
/*===========================*/
ibool* same_user_rec, /*!< out: TRUE if we were able to restore
@@ -3553,12 +3554,12 @@ next:
btr_pcur_move_to_next(pcur, mtr);
}
- return(TRUE);
+ return true;
}
return(!success);
case BTR_PCUR_AFTER_LAST_IN_TREE:
case BTR_PCUR_BEFORE_FIRST_IN_TREE:
- return(TRUE);
+ return true;
case BTR_PCUR_AFTER:
/* positioned to record after pcur->old_rec. */
pcur->pos_state = BTR_PCUR_IS_POSITIONED;
@@ -3568,7 +3569,7 @@ prev:
pcur->btr_cur.index)) {
btr_pcur_move_to_prev(pcur, mtr);
}
- return(TRUE);
+ return true;
case BTR_PCUR_BEFORE:
/* For non optimistic restoration:
The position is now set to the record before pcur->old_rec.
@@ -3590,19 +3591,19 @@ prev:
HANDLER READ idx PREV; */
goto prev;
}
- return(TRUE);
+ return true;
case BTR_PCUR_IS_POSITIONED:
if (moves_up && btr_pcur_is_on_user_rec(pcur)) {
goto next;
}
- return(TRUE);
+ return true;
case BTR_PCUR_WAS_POSITIONED:
case BTR_PCUR_NOT_POSITIONED:
break;
}
}
ut_ad(0);
- return(TRUE);
+ return true;
}
/********************************************************************//**
@@ -4551,7 +4552,7 @@ wait_table_again:
goto next_rec;
}
- ibool need_to_process = sel_restore_position_for_mysql(
+ bool need_to_process = sel_restore_position_for_mysql(
&same_user_rec, BTR_SEARCH_LEAF,
pcur, moves_up, &mtr);
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index 4818c334517..e35d4e2b60f 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -2615,7 +2615,7 @@ truncate_t::update_root_page_no(
pars_info_add_ull_literal(
info, "index_id",
- (mark_index_corrupted ? -1 : it->m_id));
+ (mark_index_corrupted ? IB_ID_MAX : it->m_id));
err = que_eval_sql(
info,
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index 0e7acecd77e..cbcb4eb8d1d 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -433,7 +433,7 @@ row_undo_ins_parse_undo_rec(
ut_ad(dict_table_is_file_per_table(table)
== !is_system_tablespace(table->space->id));
size_t len = mach_read_from_2(node->undo_rec)
- + node->undo_rec - ptr - 2;
+ + size_t(node->undo_rec - ptr) - 2;
ptr[len] = 0;
const char* name = reinterpret_cast<char*>(ptr);
if (strcmp(table->name.m_name, name)) {
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 58541b8388b..3a626e0d010 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -124,7 +124,8 @@ row_undo_mod_clust_low(
}
if (mode != BTR_MODIFY_TREE) {
- ut_ad((mode & ~BTR_ALREADY_S_LATCHED) == BTR_MODIFY_LEAF);
+ ut_ad((mode & ulint(~BTR_ALREADY_S_LATCHED))
+ == BTR_MODIFY_LEAF);
err = btr_cur_optimistic_update(
BTR_NO_LOCKING_FLAG | BTR_NO_UNDO_LOG_FLAG
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index cfcba2fc220..aead23deae4 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -866,8 +866,8 @@ row_upd_index_write_log(
/* If this is a virtual column, mark it using special
field_no */
ulint field_no = upd_fld_is_virtual_col(upd_field)
- ? REC_MAX_N_FIELDS + upd_field->field_no
- : upd_field->field_no;
+ ? REC_MAX_N_FIELDS + unsigned(upd_field->field_no)
+ : unsigned(upd_field->field_no);
log_ptr += mach_write_compressed(log_ptr, field_no);
log_ptr += mach_write_compressed(log_ptr, len);
@@ -1326,7 +1326,7 @@ row_upd_index_replace_new_col_val(
/* Copy the locally stored prefix. */
memcpy(buf, data,
- uf->orig_len - BTR_EXTERN_FIELD_REF_SIZE);
+ unsigned(uf->orig_len) - BTR_EXTERN_FIELD_REF_SIZE);
/* Copy the BLOB pointer. */
memcpy(buf + uf->orig_len - BTR_EXTERN_FIELD_REF_SIZE,
diff --git a/storage/innobase/srv/srv0conc.cc b/storage/innobase/srv/srv0conc.cc
index a1ffa8986a8..93008489c4e 100644
--- a/storage/innobase/srv/srv0conc.cc
+++ b/storage/innobase/srv/srv0conc.cc
@@ -136,12 +136,9 @@ srv_conc_enter_innodb_with_atomics(
#endif /* WITH_WSREP */
if (srv_thread_concurrency == 0) {
-
if (notified_mysql) {
-
- (void) my_atomic_addlint(
- &srv_conc.n_waiting, -1);
-
+ my_atomic_addlint(&srv_conc.n_waiting,
+ ulint(-1));
thd_wait_end(trx->mysql_thd);
}
@@ -160,10 +157,8 @@ srv_conc_enter_innodb_with_atomics(
srv_enter_innodb_with_tickets(trx);
if (notified_mysql) {
-
- (void) my_atomic_addlint(
- &srv_conc.n_waiting, -1);
-
+ my_atomic_addlint(&srv_conc.n_waiting,
+ ulint(-1));
thd_wait_end(trx->mysql_thd);
}
@@ -185,13 +180,11 @@ srv_conc_enter_innodb_with_atomics(
/* Since there were no free seats, we relinquish
the overbooked ticket. */
- (void) my_atomic_addlint(
- &srv_conc.n_active, -1);
+ my_atomic_addlint(&srv_conc.n_active, ulint(-1));
}
if (!notified_mysql) {
- (void) my_atomic_addlint(
- &srv_conc.n_waiting, 1);
+ my_atomic_addlint(&srv_conc.n_waiting, 1);
thd_wait_begin(trx->mysql_thd, THD_WAIT_USER_LOCK);
@@ -235,7 +228,7 @@ srv_conc_exit_innodb_with_atomics(
trx->n_tickets_to_enter_innodb = 0;
trx->declared_to_be_inside_innodb = FALSE;
- (void) my_atomic_addlint(&srv_conc.n_active, -1);
+ my_atomic_addlint(&srv_conc.n_active, ulint(-1));
}
/*********************************************************************//**
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index 569e476969f..18c8d6a1d95 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -1485,8 +1485,8 @@ srv_mon_set_module_control(
mon_option_t set_option) /*!< in: Turn on/off reset the
counter */
{
- ulint ix;
- ulint start_id;
+ lint ix;
+ lint start_id;
ibool set_current_module = FALSE;
ut_a(module_id <= NUM_MONITOR);
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index c7fac33bd79..931a58925ab 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -860,7 +860,8 @@ srv_suspend_thread_low(
ut_a(!slot->suspended);
slot->suspended = TRUE;
- if ((lint)my_atomic_addlint(&srv_sys.n_threads_active[type], -1) < 0) {
+ if (lint(my_atomic_addlint(&srv_sys.n_threads_active[type], ulint(-1)))
+ < 0) {
ut_error;
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 49337c684ab..f58e8bdf895 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1203,7 +1203,7 @@ srv_start_state_set(
srv_start_state_t state) /*!< in: indicate current state of
thread startup */
{
- srv_start_state |= state;
+ srv_start_state |= ulint(state);
}
/****************************************************************//**
@@ -1215,7 +1215,7 @@ srv_start_state_is_set(
/*===================*/
srv_start_state_t state) /*!< in: state to check for */
{
- return(srv_start_state & state);
+ return(srv_start_state & ulint(state));
}
/**
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index b56a5c73a8d..d8c6753ff22 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -1080,13 +1080,11 @@ sync_array_print_long_waits(
}
if (noticed) {
- ibool old_val;
-
fprintf(stderr,
"InnoDB: ###### Starts InnoDB Monitor"
" for 30 secs to print diagnostic info:\n");
- old_val = srv_print_innodb_monitor;
+ my_bool old_val = srv_print_innodb_monitor;
/* If some crucial semaphore is reserved, then also the InnoDB
Monitor can hang, and we do not get diagnostics. Since in
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index ea12c0bf580..6574bf529e2 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -191,10 +191,10 @@ struct LatchDebug {
latch that the thread is trying
to acquire
@return true if passes, else crash with error message. */
- bool basic_check(
+ inline bool basic_check(
const Latches* latches,
latch_level_t requested_level,
- ulint level) const
+ lint level) const
UNIV_NOTHROW;
/** Adds a latch and its level in the thread level array. Allocates
@@ -606,11 +606,11 @@ LatchDebug::less(
The level of the latch that the thread is
trying to acquire
@return true if passes, else crash with error message. */
-bool
+inline bool
LatchDebug::basic_check(
const Latches* latches,
latch_level_t requested_level,
- ulint in_level) const
+ lint in_level) const
UNIV_NOTHROW
{
latch_level_t level = latch_level_t(in_level);
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index c3a0ed2284b..528b15f4e79 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -302,8 +302,8 @@ rw_lock_s_lock_spin(
{
ulint i = 0; /* spin round count */
sync_array_t* sync_arr;
- ulint spin_count = 0;
- uint64_t count_os_wait = 0;
+ lint spin_count = 0;
+ int64_t count_os_wait = 0;
/* We reuse the thread id to index into the counter, cache
it here for efficiency. */
@@ -430,9 +430,9 @@ rw_lock_x_lock_wait_func(
unsigned line) /*!< in: line where requested */
{
ulint i = 0;
- ulint n_spins = 0;
+ lint n_spins = 0;
sync_array_t* sync_arr;
- uint64_t count_os_wait = 0;
+ int64_t count_os_wait = 0;
ut_ad(my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) <= threshold);
@@ -682,8 +682,8 @@ rw_lock_x_lock_func(
{
ulint i = 0;
sync_array_t* sync_arr;
- ulint spin_count = 0;
- uint64_t count_os_wait = 0;
+ lint spin_count = 0;
+ int64_t count_os_wait = 0;
ut_ad(rw_lock_validate(lock));
ut_ad(!rw_lock_own(lock, RW_LOCK_S));
@@ -714,7 +714,7 @@ lock_loop:
}
HMT_medium();
- spin_count += i;
+ spin_count += lint(i);
if (i >= srv_n_spin_wait_rounds) {
@@ -780,9 +780,9 @@ rw_lock_sx_lock_func(
{
ulint i = 0;
sync_array_t* sync_arr;
- ulint spin_count = 0;
- uint64_t count_os_wait = 0;
- ulint spin_wait_count = 0;
+ lint spin_count = 0;
+ int64_t count_os_wait = 0;
+ lint spin_wait_count = 0;
ut_ad(rw_lock_validate(lock));
ut_ad(!rw_lock_own(lock, RW_LOCK_S));
@@ -814,7 +814,7 @@ lock_loop:
i++;
}
- spin_count += i;
+ spin_count += lint(i);
if (i >= srv_n_spin_wait_rounds) {
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 0abef1cb6ee..5ab538c4ab4 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -1296,7 +1296,7 @@ trx_purge_get_next_rec(
} else {
page = page_align(rec2);
- purge_sys.offset = rec2 - page;
+ purge_sys.offset = ulint(rec2 - page);
purge_sys.page_no = page_get_page_no(page);
purge_sys.tail.undo_no = trx_undo_rec_get_undo_no(rec2);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index add63821865..bd314bbf9b0 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -150,7 +150,7 @@ static ulint trx_undo_left(const buf_block_t* undo_block, const byte* ptr)
{
/* The 10 is a safety margin, in case we have some small
calculation error below */
- return srv_page_size - (ptr - undo_block->frame)
+ return srv_page_size - ulint(ptr - undo_block->frame)
- (10 + FIL_PAGE_DATA_END);
}
@@ -191,7 +191,7 @@ trx_undo_page_set_next_prev_and_add(
mach_write_to_2(ptr, first_free);
ptr += 2;
- end_of_rec = ptr - undo_block->frame;
+ end_of_rec = ulint(ptr - undo_block->frame);
/* Write offset of the next undo log record */
mach_write_to_2(undo_block->frame + first_free, end_of_rec);
@@ -270,7 +270,7 @@ trx_undo_log_v_idx(
ptr += mach_write_compressed(ptr, v_index.nth_field);
}
- mach_write_to_2(old_ptr, ptr - old_ptr);
+ mach_write_to_2(old_ptr, ulint(ptr - old_ptr));
return(ptr);
}
@@ -453,7 +453,7 @@ trx_undo_report_insert_virtual(
}
/* Always mark the end of the log with 2 bytes length field */
- mach_write_to_2(start, *ptr - start);
+ mach_write_to_2(start, ulint(*ptr - start));
return(true);
}
@@ -505,7 +505,7 @@ trx_undo_page_report_insert(
/*----------------------------------------*/
/* Store then the fields required to uniquely determine the record
to be inserted in the clustered index */
- if (UNIV_UNLIKELY(clust_entry->info_bits)) {
+ if (UNIV_UNLIKELY(clust_entry->info_bits != 0)) {
ut_ad(clust_entry->info_bits == REC_INFO_DEFAULT_ROW);
ut_ad(index->is_instant());
ut_ad(undo_block->frame[first_free + 2]
@@ -782,7 +782,7 @@ trx_undo_page_report_modify_ext(
}
/* Encode spatial status into length. */
- spatial_len |= spatial_status << SPATIAL_STATUS_SHIFT;
+ spatial_len |= ulint(spatial_status) << SPATIAL_STATUS_SHIFT;
if (spatial_status == SPATIAL_ONLY) {
/* If the column is only used by gis index, log its
@@ -1402,7 +1402,7 @@ already_logged:
}
}
- mach_write_to_2(old_ptr, ptr - old_ptr);
+ mach_write_to_2(old_ptr, ulint(ptr - old_ptr));
if (row_heap) {
mem_heap_free(row_heap);
@@ -1417,7 +1417,7 @@ already_logged:
mach_write_to_2(ptr, first_free);
ptr += 2;
- const ulint new_free = ptr - undo_block->frame;
+ const ulint new_free = ulint(ptr - undo_block->frame);
mach_write_to_2(undo_block->frame + first_free, new_free);
mach_write_to_2(TRX_UNDO_PAGE_HDR + TRX_UNDO_PAGE_FREE
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 436c07090cb..a7a1decabee 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -953,7 +953,7 @@ trx_roll_pop_top_rec(
}
undo->top_page_no = page_get_page_no(prev_rec_page);
- undo->top_offset = prev_rec - prev_rec_page;
+ undo->top_offset = ulint(prev_rec - prev_rec_page);
undo->top_undo_no = trx_undo_rec_get_undo_no(prev_rec);
ut_ad(!undo->empty());
}
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index c4bda7efb3a..c734823fff6 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -2115,7 +2115,7 @@ int trx_recover_for_mysql(XID *xid_list, uint len)
if (arg.count)
ib::info() << arg.count
<< " transactions in prepared state after recovery";
- return(arg.count);
+ return int(arg.count);
}
diff --git a/storage/innobase/trx/trx0undo.cc b/storage/innobase/trx/trx0undo.cc
index adcc67ae167..2910daea1eb 100644
--- a/storage/innobase/trx/trx0undo.cc
+++ b/storage/innobase/trx/trx0undo.cc
@@ -930,7 +930,7 @@ function_exit:
if (trunc_here) {
mlog_write_ulint(undo_page + TRX_UNDO_PAGE_HDR
+ TRX_UNDO_PAGE_FREE,
- trunc_here - undo_page,
+ ulint(trunc_here - undo_page),
MLOG_2BYTES, &mtr);
}
@@ -1153,7 +1153,7 @@ trx_undo_mem_create_at_db_start(trx_rseg_t* rseg, ulint id, ulint page_no,
if (const trx_undo_rec_t* rec = trx_undo_page_get_last_rec(
last_page, page_no, offset)) {
- undo->top_offset = rec - last_page;
+ undo->top_offset = ulint(rec - last_page);
undo->top_undo_no = trx_undo_rec_get_undo_no(rec);
ut_ad(!undo->empty());
} else {
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index 7bc51b801c5..a5db87ad372 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -160,7 +160,7 @@ ut_time_us(
ut_gettimeofday(&tv, NULL);
- us = static_cast<uintmax_t>(tv.tv_sec) * 1000000 + tv.tv_usec;
+ us = uintmax_t(tv.tv_sec) * 1000000 + uintmax_t(tv.tv_usec);
if (tloc != NULL) {
*tloc = us;
@@ -182,7 +182,7 @@ ut_time_ms(void)
ut_gettimeofday(&tv, NULL);
- return((ulint) tv.tv_sec * 1000 + tv.tv_usec / 1000);
+ return(ulint(tv.tv_sec) * 1000 + ulint(tv.tv_usec / 1000));
}
/**********************************************************//**
@@ -429,7 +429,7 @@ ut_get_name(
name, strlen(name),
trx ? trx->mysql_thd : NULL);
buf[bufend - buf] = '\0';
- return(std::string(buf, 0, bufend - buf));
+ return(std::string(buf, 0, size_t(bufend - buf)));
}
/**********************************************************************//**
@@ -453,7 +453,7 @@ ut_print_name(
name, strlen(name),
trx ? trx->mysql_thd : NULL);
- if (fwrite(buf, 1, bufend - buf, f) != (size_t) (bufend - buf)) {
+ if (fwrite(buf, 1, size_t(bufend - buf), f) != size_t(bufend - buf)) {
perror("fwrite");
}
}