summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-03-01 08:27:39 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-03-07 19:07:27 +0200
commit89d80c1b0be94639d0913dee7b6a284c32787b09 (patch)
treea08340d45a09b067df4490259f68b5a3f9d2fa03 /storage
parentd2f5e624223fe502ddf4c6f42062c29edb988627 (diff)
downloadmariadb-git-89d80c1b0be94639d0913dee7b6a284c32787b09.tar.gz
Fix many -Wconversion warnings.
Define my_thread_id as an unsigned type, to avoid mismatch with ulonglong. Change some parameters to this type. Use size_t in a few more places. Declare many flag constants as unsigned to avoid sign mismatch when shifting bits or applying the unary ~ operator. When applying the unary ~ operator to enum constants, explictly cast the result to an unsigned type, because enum constants can be treated as signed. In InnoDB, change the source code line number parameters from ulint to unsigned type. Also, make some InnoDB functions return a narrower type (unsigned or uint32_t instead of ulint; bool instead of ibool).
Diffstat (limited to 'storage')
-rw-r--r--storage/connect/blkfil.cpp6
-rw-r--r--storage/innobase/btr/btr0btr.cc8
-rw-r--r--storage/innobase/btr/btr0cur.cc20
-rw-r--r--storage/innobase/btr/btr0defragment.cc6
-rw-r--r--storage/innobase/btr/btr0pcur.cc4
-rw-r--r--storage/innobase/btr/btr0scrub.cc21
-rw-r--r--storage/innobase/btr/btr0sea.cc7
-rw-r--r--storage/innobase/buf/buf0buf.cc14
-rw-r--r--storage/innobase/data/data0data.cc3
-rw-r--r--storage/innobase/data/data0type.cc18
-rw-r--r--storage/innobase/dict/dict0dict.cc14
-rw-r--r--storage/innobase/dict/dict0load.cc6
-rw-r--r--storage/innobase/dict/dict0mem.cc5
-rw-r--r--storage/innobase/fil/fil0crypt.cc2
-rw-r--r--storage/innobase/fil/fil0fil.cc41
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc2
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc2
-rw-r--r--storage/innobase/gis/gis0sea.cc6
-rw-r--r--storage/innobase/handler/ha_innodb.cc25
-rw-r--r--storage/innobase/handler/handler0alter.cc2
-rw-r--r--storage/innobase/handler/i_s.cc25
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc4
-rw-r--r--storage/innobase/include/btr0btr.h64
-rw-r--r--storage/innobase/include/btr0btr.ic4
-rw-r--r--storage/innobase/include/btr0cur.h13
-rw-r--r--storage/innobase/include/btr0pcur.h11
-rw-r--r--storage/innobase/include/btr0pcur.ic8
-rw-r--r--storage/innobase/include/buf0buf.h24
-rw-r--r--storage/innobase/include/buf0buf.ic24
-rw-r--r--storage/innobase/include/buf0flu.h4
-rw-r--r--storage/innobase/include/data0data.ic3
-rw-r--r--storage/innobase/include/data0type.h50
-rw-r--r--storage/innobase/include/data0type.ic7
-rw-r--r--storage/innobase/include/dict0dict.h8
-rw-r--r--storage/innobase/include/dict0dict.ic2
-rw-r--r--storage/innobase/include/dict0mem.h28
-rw-r--r--storage/innobase/include/dict0mem.ic3
-rw-r--r--storage/innobase/include/dict0stats.h22
-rw-r--r--storage/innobase/include/dict0stats.ic29
-rw-r--r--storage/innobase/include/dict0types.h4
-rw-r--r--storage/innobase/include/fil0crypt.h2
-rw-r--r--storage/innobase/include/fil0crypt.ic4
-rw-r--r--storage/innobase/include/fil0fil.h4
-rw-r--r--storage/innobase/include/fsp0fsp.h2
-rw-r--r--storage/innobase/include/fsp0types.h2
-rw-r--r--storage/innobase/include/gis0rtree.h7
-rw-r--r--storage/innobase/include/gis0rtree.ic7
-rw-r--r--storage/innobase/include/ibuf0ibuf.h4
-rw-r--r--storage/innobase/include/lock0lock.h18
-rw-r--r--storage/innobase/include/lock0lock.ic7
-rw-r--r--storage/innobase/include/mach0data.h44
-rw-r--r--storage/innobase/include/mach0data.ic62
-rw-r--r--storage/innobase/include/mem0mem.h5
-rw-r--r--storage/innobase/include/mem0mem.ic5
-rw-r--r--storage/innobase/include/mtr0mtr.h8
-rw-r--r--storage/innobase/include/mtr0mtr.ic7
-rw-r--r--storage/innobase/include/os0file.h26
-rw-r--r--storage/innobase/include/os0file.ic25
-rw-r--r--storage/innobase/include/page0page.ic8
-rw-r--r--storage/innobase/include/page0size.h4
-rw-r--r--storage/innobase/include/page0zip.h7
-rw-r--r--storage/innobase/include/page0zip.ic11
-rw-r--r--storage/innobase/include/rem0rec.h3
-rw-r--r--storage/innobase/include/row0ins.h3
-rw-r--r--storage/innobase/include/row0merge.h6
-rw-r--r--storage/innobase/include/row0mysql.h5
-rw-r--r--storage/innobase/include/row0upd.ic18
-rw-r--r--storage/innobase/include/sync0arr.h6
-rw-r--r--storage/innobase/include/sync0arr.ic3
-rw-r--r--storage/innobase/include/sync0policy.h25
-rw-r--r--storage/innobase/include/sync0policy.ic5
-rw-r--r--storage/innobase/include/sync0rw.h32
-rw-r--r--storage/innobase/include/sync0rw.ic24
-rw-r--r--storage/innobase/include/trx0rec.h9
-rw-r--r--storage/innobase/include/trx0trx.h8
-rw-r--r--storage/innobase/include/trx0types.h3
-rw-r--r--storage/innobase/include/univ.i16
-rw-r--r--storage/innobase/include/ut0dbg.h7
-rw-r--r--storage/innobase/include/ut0mem.ic9
-rw-r--r--storage/innobase/include/ut0mutex.h17
-rw-r--r--storage/innobase/lock/lock0lock.cc6
-rw-r--r--storage/innobase/mem/mem0mem.cc3
-rw-r--r--storage/innobase/mtr/mtr0log.cc2
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc28
-rw-r--r--storage/innobase/os/os0file.cc12
-rw-r--r--storage/innobase/page/page0page.cc4
-rw-r--r--storage/innobase/page/page0zip.cc33
-rw-r--r--storage/innobase/rem/rem0rec.cc3
-rw-r--r--storage/innobase/row/row0ins.cc6
-rw-r--r--storage/innobase/row/row0merge.cc4
-rw-r--r--storage/innobase/row/row0mysql.cc4
-rw-r--r--storage/innobase/row/row0trunc.cc2
-rw-r--r--storage/innobase/srv/srv0start.cc2
-rw-r--r--storage/innobase/sync/sync0arr.cc51
-rw-r--r--storage/innobase/sync/sync0rw.cc23
-rw-r--r--storage/innobase/ut/ut0dbg.cc5
-rw-r--r--storage/maria/ma_blockrec.h22
-rw-r--r--storage/maria/ma_loghandler.h6
-rw-r--r--storage/maria/maria_chk.c4
-rw-r--r--storage/maria/maria_def.h88
-rw-r--r--storage/myisam/myisamdef.h75
-rw-r--r--storage/perfschema/pfs_events_waits.h9
-rw-r--r--storage/spider/spd_db_include.h40
103 files changed, 707 insertions, 742 deletions
diff --git a/storage/connect/blkfil.cpp b/storage/connect/blkfil.cpp
index 1f5a1a27ae5..50535d20a3d 100644
--- a/storage/connect/blkfil.cpp
+++ b/storage/connect/blkfil.cpp
@@ -412,7 +412,7 @@ void BLKFILMR2::MakeValueBitmap(void)
Void = !Bmp[N]; // There are no good values in the file
for (i = 0; i < N; i++) {
- Bxp[i] = ~0;
+ Bxp[i] = ~0U;
if (noteq)
Bmp[i] = Bxp[i];
@@ -708,7 +708,7 @@ void BLKFILIN2::MakeValueBitmap(void)
Void = !Bmp[N]; // There are no good values in the file
for (i = 0; i < N; i++) {
- Bxp[i] = ~0;
+ Bxp[i] = ~0U;
if (noteq) {
Bmp[i] = Bxp[i];
@@ -828,7 +828,7 @@ BLKFILIN2::BLKFILIN2(PGLOBAL g, PTDBDOS tdbp, int op, int opm, PXOB *xp)
Bxp[i] |= btp;
for (N = i--; i >= 0; i--)
- Bxp[i] = ~0;
+ Bxp[i] = ~0U;
break;
} // endif Bmp
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 4bebb9ee7dd..49ac63cff6d 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -2,7 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2014, 2016, MariaDB Corporation
+Copyright (c) 2014, 2017, 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
@@ -725,7 +725,7 @@ btr_page_free_low(
offsets = rec_get_offsets(rec, index,
offsets, ULINT_UNDEFINED,
&heap);
- uint size = rec_offs_data_size(offsets);
+ ulint size = rec_offs_data_size(offsets);
memset(rec, 0, size);
rec = page_rec_get_next(rec);
cnt++;
@@ -890,7 +890,7 @@ btr_page_get_father_node_ptr_func(
ulint latch_mode,/*!< in: BTR_CONT_MODIFY_TREE
or BTR_CONT_SEARCH_TREE */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dtuple_t* tuple;
@@ -2396,7 +2396,7 @@ btr_insert_on_non_leaf_level_func(
ulint level, /*!< in: level, must be > 0 */
dtuple_t* tuple, /*!< in: the record to be inserted */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
big_rec_t* dummy_big_rec;
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 0abc930c11d..06b5b66c2aa 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -148,7 +148,7 @@ can be released by page reorganize, then it is reorganized */
@param not_empty table not empty
@return estimated table wide stats from sampled value */
#define BTR_TABLE_STATS_FROM_SAMPLE(value, index, sample, ext_size, not_empty) \
- (((value) * static_cast<int64_t>(index->stat_n_leaf_pages) \
+ (((value) * static_cast<ib_uint64_t>(index->stat_n_leaf_pages) \
+ (sample) - 1 + (ext_size) + (not_empty)) / ((sample) + (ext_size)))
/* @} */
@@ -414,7 +414,7 @@ btr_cur_optimistic_latch_leaves(
ulint* latch_mode,
btr_cur_t* cursor,
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr)
{
ulint mode;
@@ -747,7 +747,7 @@ btr_cur_search_to_nth_level(
caller currently has on search system:
RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr, /*!< in: mtr */
ib_uint64_t autoinc)/*!< in: PAGE_ROOT_AUTO_INC to be written
(0 if none) */
@@ -2042,7 +2042,7 @@ btr_cur_open_at_index_side_func(
ulint level, /*!< in: level to search for
(0=leaf). */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in/out: mini-transaction */
{
page_cur_t* page_cursor;
@@ -2414,7 +2414,7 @@ btr_cur_open_at_rnd_pos_func(
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
page_cur_t* page_cursor;
@@ -3623,7 +3623,7 @@ btr_cur_update_in_place(
ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG)
|| dict_index_is_clust(index));
ut_ad(thr_get_trx(thr)->id == trx_id
- || (flags & ~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP))
+ || (flags & ulint(~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP)))
== (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
| BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
ut_ad(fil_page_index_page_check(btr_cur_get_page(cursor)));
@@ -3790,7 +3790,7 @@ btr_cur_optimistic_update(
ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG)
|| dict_index_is_clust(index));
ut_ad(thr_get_trx(thr)->id == trx_id
- || (flags & ~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP))
+ || (flags & ulint(~(BTR_KEEP_POS_FLAG | BTR_KEEP_IBUF_BITMAP)))
== (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
| BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
ut_ad(fil_page_index_page_check(page));
@@ -4123,7 +4123,7 @@ btr_cur_pessimistic_update(
ut_ad(dict_index_is_online_ddl(index) == !!(flags & BTR_CREATE_FLAG)
|| dict_index_is_clust(index));
ut_ad(thr_get_trx(thr)->id == trx_id
- || (flags & ~BTR_KEEP_POS_FLAG)
+ || (flags & ulint(~BTR_KEEP_POS_FLAG))
== (BTR_NO_UNDO_LOG_FLAG | BTR_NO_LOCKING_FLAG
| BTR_CREATE_FLAG | BTR_KEEP_SYS_FLAG));
@@ -6231,12 +6231,12 @@ btr_cur_set_ownership_of_extern_field(
byte_val = mach_read_from_1(data + local_len + BTR_EXTERN_LEN);
if (val) {
- byte_val = byte_val & (~BTR_EXTERN_OWNER_FLAG);
+ byte_val &= ~BTR_EXTERN_OWNER_FLAG;
} else {
#if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
ut_a(!(byte_val & BTR_EXTERN_OWNER_FLAG));
#endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */
- byte_val = byte_val | BTR_EXTERN_OWNER_FLAG;
+ byte_val |= BTR_EXTERN_OWNER_FLAG;
}
if (page_zip) {
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 7f06aed9ff0..8c4f27cc78a 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved.
-Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (C) 2014, 2017, 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
@@ -696,8 +696,8 @@ btr_defragment_n_pages(
(data_size_per_rec
* srv_defragment_fill_factor_n_recs));
optimal_page_size -= reserved_space;
- n_new_slots = (total_data_size + optimal_page_size - 1)
- / optimal_page_size;
+ n_new_slots = uint((total_data_size + optimal_page_size - 1)
+ / optimal_page_size);
if (n_new_slots >= n_pages) {
/* Can't defragment. */
if (end_of_index)
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index ecf3f7c07cb..741f16e0df4 100644
--- a/storage/innobase/btr/btr0pcur.cc
+++ b/storage/innobase/btr/btr0pcur.cc
@@ -229,7 +229,7 @@ btr_pcur_restore_position_func(
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: detached persistent cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dict_index_t* index;
@@ -586,7 +586,7 @@ btr_pcur_open_on_user_rec_func(
btr_pcur_t* cursor, /*!< in: memory buffer for persistent
cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
btr_pcur_open_low(index, 0, tuple, mode, latch_mode, cursor,
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index 8051c517e3a..e2670521cf3 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -254,11 +254,10 @@ btr_page_needs_scrubbing(
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
}
- page_t* page = buf_block_get_frame(block);
- uint type = fil_page_get_type(page);
+ const page_t* page = buf_block_get_frame(block);
if (allocated == BTR_SCRUB_PAGE_ALLOCATED) {
- if (type != FIL_PAGE_INDEX) {
+ if (fil_page_get_type(page) != FIL_PAGE_INDEX) {
/* this function is called from fil-crypt-threads.
* these threads iterate all pages of all tablespaces
* and don't know about fil_page_type.
@@ -275,7 +274,7 @@ btr_page_needs_scrubbing(
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
}
- if (page_has_garbage(page) == false) {
+ if (!page_has_garbage(page)) {
/* no garbage (from deleted/shrunken records) */
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
}
@@ -283,11 +282,12 @@ btr_page_needs_scrubbing(
} else if (allocated == BTR_SCRUB_PAGE_FREE ||
allocated == BTR_SCRUB_PAGE_ALLOCATION_UNKNOWN) {
- if (! (type == FIL_PAGE_INDEX ||
- type == FIL_PAGE_TYPE_BLOB ||
- type == FIL_PAGE_TYPE_ZBLOB ||
- type == FIL_PAGE_TYPE_ZBLOB2)) {
-
+ switch (fil_page_get_type(page)) {
+ case FIL_PAGE_INDEX:
+ case FIL_PAGE_TYPE_ZBLOB:
+ case FIL_PAGE_TYPE_ZBLOB2:
+ break;
+ default:
/**
* If this is a dropped page, we also need to scrub
* BLOB pages
@@ -299,7 +299,8 @@ btr_page_needs_scrubbing(
}
}
- if (btr_page_get_index_id(page) == IBUF_INDEX_ID) {
+ if (block->page.id.space() == TRX_SYS_SPACE
+ && btr_page_get_index_id(page) == IBUF_INDEX_ID) {
/* skip ibuf */
return BTR_SCRUB_SKIP_PAGE_AND_CLOSE_TABLE;
}
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index d777e2abc4d..86827fabdd4 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -2,6 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1547,9 +1548,9 @@ btr_search_build_page_hash_index(
block->n_hash_helps = 0;
- block->curr_n_fields = n_fields;
- block->curr_n_bytes = n_bytes;
- block->curr_left_side = left_side;
+ block->curr_n_fields = unsigned(n_fields);
+ block->curr_n_bytes = unsigned(n_bytes);
+ block->curr_left_side = unsigned(left_side);
block->index = index;
for (i = 0; i < n_cached; i++) {
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index b3c11c62929..a1827e7b3b5 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -1954,7 +1954,8 @@ buf_pool_init_instance(
buf_pool->watch = (buf_page_t*) ut_zalloc_nokey(
sizeof(*buf_pool->watch) * BUF_POOL_WATCH_SIZE);
for (i = 0; i < BUF_POOL_WATCH_SIZE; i++) {
- buf_pool->watch[i].buf_pool_index = buf_pool->instance_no;
+ buf_pool->watch[i].buf_pool_index
+ = unsigned(buf_pool->instance_no);
}
/* All fields are initialized by ut_zalloc_nokey(). */
@@ -4212,7 +4213,7 @@ buf_page_get_gen(
buf_block_t* guess,
ulint mode,
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr,
dberr_t* err)
{
@@ -4882,7 +4883,7 @@ buf_page_optimistic_get(
buf_block_t* block, /*!< in: guessed buffer block */
ib_uint64_t modify_clock,/*!< in: modify clock value */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mini-transaction */
{
buf_pool_t* buf_pool;
@@ -5002,7 +5003,7 @@ buf_page_get_known_nowait(
buf_block_t* block, /*!< in: the known page */
ulint mode, /*!< in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mini-transaction */
{
buf_pool_t* buf_pool;
@@ -5110,7 +5111,7 @@ buf_block_t*
buf_page_try_get_func(
const page_id_t& page_id,
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr)
{
buf_block_t* block;
@@ -7468,7 +7469,8 @@ buf_page_encrypt_before_write(
page_size,
dst_frame);
- ulint key_version = mach_read_from_4(dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+ uint32_t key_version = mach_read_from_4(
+ dst_frame + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
ut_ad(key_version == 0 || key_version >= bpage->key_version);
bpage->key_version = key_version;
bpage->real_size = page_size.physical();
diff --git a/storage/innobase/data/data0data.cc b/storage/innobase/data/data0data.cc
index 0ccf5868d14..c897564c1d4 100644
--- a/storage/innobase/data/data0data.cc
+++ b/storage/innobase/data/data0data.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -728,7 +729,7 @@ skip_field:
DEBUG_SYNC_C("ib_mv_nonupdated_column_offpage");
upd_field_t upd_field;
- upd_field.field_no = longest_i;
+ upd_field.field_no = unsigned(longest_i);
upd_field.orig_len = 0;
upd_field.exp = NULL;
upd_field.old_v_val = NULL;
diff --git a/storage/innobase/data/data0type.cc b/storage/innobase/data/data0type.cc
index cad165d1489..7da473f0a3e 100644
--- a/storage/innobase/data/data0type.cc
+++ b/storage/innobase/data/data0type.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -140,23 +141,6 @@ dtype_is_non_binary_string_type(
}
/*********************************************************************//**
-Forms a precise type from the < 4.1.2 format precise type plus the
-charset-collation code.
-@return precise type, including the charset-collation code */
-ulint
-dtype_form_prtype(
-/*==============*/
- ulint old_prtype, /*!< in: the MySQL type code and the flags
- DATA_BINARY_TYPE etc. */
- ulint charset_coll) /*!< in: MySQL charset-collation code */
-{
- ut_a(old_prtype < 256 * 256);
- ut_a(charset_coll <= MAX_CHAR_COLL_NUM);
-
- return(old_prtype + (charset_coll << 16));
-}
-
-/*********************************************************************//**
Validates a data type structure.
@return TRUE if ok */
ibool
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 491f29067a8..32c1a12ec1e 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -264,13 +264,11 @@ dict_get_db_name_len(
return(s - name);
}
-/********************************************************************//**
-Reserves the dictionary system mutex for MySQL. */
+/** Reserve the dictionary system mutex. */
void
-dict_mutex_enter_for_mysql_func(const char * file, ulint line)
-/*============================*/
+dict_mutex_enter_for_mysql_func(const char *file, unsigned line)
{
- mutex_enter(&dict_sys->mutex);
+ mutex_enter_loc(&dict_sys->mutex, file, line);
}
/********************************************************************//**
@@ -1316,7 +1314,7 @@ void
dict_table_add_to_cache(
/*====================*/
dict_table_t* table, /*!< in: table */
- ibool can_be_evicted, /*!< in: TRUE if can be evicted */
+ bool can_be_evicted, /*!< in: whether can be evicted */
mem_heap_t* heap) /*!< in: temporary heap */
{
ulint fold;
@@ -2615,7 +2613,7 @@ dict_index_add_to_cache_w_vcol(
new_index->search_info = btr_search_info_create(new_index->heap);
#endif /* BTR_CUR_ADAPT */
- new_index->page = page_no;
+ new_index->page = unsigned(page_no);
rw_lock_create(index_tree_rw_lock_key, &new_index->lock,
SYNC_INDEX_TREE);
@@ -3179,7 +3177,7 @@ dict_index_build_internal_clust(
can theoretically occur. Check for it. */
fixed_size += new_index->trx_id_offset;
- new_index->trx_id_offset = fixed_size;
+ new_index->trx_id_offset = unsigned(fixed_size);
if (new_index->trx_id_offset != fixed_size) {
/* Overflow. Pretend that this is a
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index db14983cd8f..203185d55a5 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -1822,8 +1822,8 @@ dict_load_field_low(
{
const byte* field;
ulint len;
- ulint pos_and_prefix_len;
- ulint prefix_len;
+ unsigned pos_and_prefix_len;
+ unsigned prefix_len;
ibool first_field;
ulint position;
@@ -2027,7 +2027,7 @@ dict_load_index_low(
ulint n_fields;
ulint type;
ulint space;
- ulint merge_threshold;
+ unsigned merge_threshold;
if (allocate) {
/* If allocate=TRUE, no dict_index_t will
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 9463c5103ca..f4dbbf026aa 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -2,6 +2,7 @@
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2017, 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
@@ -1114,12 +1115,12 @@ dict_mem_table_is_system(
/* table has the following format: database/table
and some system table are of the form SYS_* */
if (strchr(name, '/')) {
- int table_len = strlen(name);
+ size_t table_len = strlen(name);
const char *system_db;
int i = 0;
while ((system_db = innobase_system_databases[i++])
&& (system_db != NullS)) {
- int len = strlen(system_db);
+ size_t len = strlen(system_db);
if (table_len > len && !strncmp(name, system_db, len)) {
return true;
}
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index ac1978f2673..ccec6191ed4 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -1727,7 +1727,7 @@ fil_crypt_get_page_throttle_func(
mtr_t* mtr, /*!< in/out: minitransaction */
ulint* sleeptime_ms, /*!< out: sleep time */
const char* file, /*!< in: file name */
- ulint line) /*!< in: file line */
+ unsigned line) /*!< in: file line */
{
const page_id_t& page_id = page_id_t(space, offset);
dberr_t err = DB_SUCCESS;
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 1ef209ed0ed..5a7a33f67e3 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -584,7 +584,9 @@ fil_node_open_file(
read_only_mode = !fsp_is_system_temporary(space->id)
&& srv_read_only_mode;
- if (node->size == 0
+ const bool first_time_open = node->size == 0;
+
+ if (first_time_open
|| (space->purpose == FIL_TYPE_TABLESPACE
&& node == UT_LIST_GET_FIRST(space->chain)
&& !undo::Truncate::was_tablespace_truncated(space->id)
@@ -689,7 +691,7 @@ retry:
space->free_limit = free_limit;
space->free_len = free_len;
- if (node->size == 0) {
+ if (first_time_open) {
ulint extent_size;
extent_size = psize * FSP_EXTENT_SIZE;
@@ -727,24 +729,21 @@ retry:
innodb_data_file_key, node->name, OS_FILE_OPEN,
OS_FILE_AIO, OS_DATA_FILE, read_only_mode, &success);
- if (!space->atomic_write_tested)
- {
- const page_size_t page_size(space->flags);
-
- space->atomic_write_tested= 1;
- /*
- Atomic writes is supported if the file can be used
- with atomic_writes (not log file), O_DIRECT is
- used (tested in ha_innodbc.cc) and the file is
- device and file system that supports atomic writes
- for the given block size
- */
- space->atomic_write_supported=
- srv_use_atomic_writes &&
- node->atomic_write &&
- my_test_if_atomic_write(node->handle,
- page_size.physical()) ?
- true : false;
+ if (first_time_open) {
+ /*
+ Atomic writes is supported if the file can be used
+ with atomic_writes (not log file), O_DIRECT is
+ used (tested in ha_innodb.cc) and the file is
+ device and file system that supports atomic writes
+ for the given block size
+ */
+ space->atomic_write_supported
+ = srv_use_atomic_writes
+ && node->atomic_write
+ && my_test_if_atomic_write(
+ node->handle,
+ int(page_size_t(space->flags)
+ .physical()));
}
}
@@ -1302,7 +1301,7 @@ fil_mutex_enter_and_prepare_for_io(
}
}
- if (ulint size = UNIV_UNLIKELY(space->recv_size)) {
+ if (ulint size = ulint(UNIV_UNLIKELY(space->recv_size))) {
ut_ad(node);
bool success;
if (fil_space_extend_must_retry(space, node, size,
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 18f95c94d75..1eb9ec37f5d 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -99,7 +99,7 @@ fil_compress_page(
byte* lzo_mem) /*!< in: temporal memory used by LZO */
{
int err = Z_OK;
- int comp_level = level;
+ int comp_level = int(level);
ulint header_len = FIL_PAGE_DATA + FIL_PAGE_COMPRESSED_SIZE;
ulint write_size=0;
/* Cache to avoid change during function execution */
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 6128fe54ecc..80a2aa211db 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -3755,7 +3755,7 @@ fsp_page_is_free_func(
ulint page_no, /*!< in: page offset */
mtr_t* mtr, /*!< in/out: mini-transaction */
const char *file,
- ulint line)
+ unsigned line)
{
ut_ad(mtr);
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 122d99dee8f..f23065ae3c7 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -542,7 +542,7 @@ rtr_pcur_open_low(
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
btr_cur_t* btr_cursor;
@@ -718,7 +718,7 @@ rtr_page_get_father_node_ptr_func(
out: cursor on node pointer record,
its page x-latched */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dtuple_t* tuple;
@@ -1262,7 +1262,7 @@ rtr_cur_restore_position_func(
btr_cur_t* btr_cur, /*!< in: detached persistent cursor */
ulint level, /*!< in: index level */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
dict_index_t* index;
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index b9caea017ab..8f1e7657d1d 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -640,25 +640,6 @@ static PSI_file_info all_innodb_files[] = {
# endif /* UNIV_PFS_IO */
#endif /* HAVE_PSI_INTERFACE */
-/******************************************************************//**
-Debug function used to read a MBR data */
-
-#ifdef UNIV_DEBUG
-void
-srv_mbr_debug(const byte* data)
-{
- double a, b, c , d;
- a = mach_double_read(data);
- data += sizeof(double);
- b = mach_double_read(data);
- data += sizeof(double);
- c = mach_double_read(data);
- data += sizeof(double);
- d = mach_double_read(data);
- ut_ad(a && b && c &&d);
-}
-#endif
-
static void innodb_remember_check_sysvar_funcs();
mysql_var_check_func check_sysvar_enum;
@@ -4338,8 +4319,8 @@ innobase_change_buffering_inited_ok:
" It will be removed in MariaDB 10.3.";
}
- srv_use_atomic_writes = (ibool) (innobase_use_atomic_writes &&
- my_may_have_atomic_write);
+ srv_use_atomic_writes
+ = innobase_use_atomic_writes && my_may_have_atomic_write;
if (srv_use_atomic_writes && !srv_file_per_table)
{
fprintf(stderr, "InnoDB: Disabling atomic_writes as file_per_table is not used.\n");
@@ -10069,7 +10050,7 @@ ha_innobase::innobase_get_index(
<< " InnoDB name " << index->name()
<< " for table " << m_prebuilt->table->name.m_name;
- for(ulint i=0; i < table->s->keys; i++) {
+ for(uint i=0; i < table->s->keys; i++) {
index = innobase_index_lookup(m_share, i);
key = table->key_info + keynr;
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 726f641ef5a..82fa4b724f4 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -5019,7 +5019,7 @@ op_ok:
ctx->prebuilt->trx->mysql_thd)
? DB_SUCCESS : DB_ERROR;
ctx->new_table->fts->fts_status
- &= ~TABLE_DICT_LOCKED;
+ &= ulint(~TABLE_DICT_LOCKED);
if (error != DB_SUCCESS) {
goto error_handling;
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index bc35f772af1..dd43a52ae66 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -950,8 +950,7 @@ fill_innodb_locks_from_cache(
strlen(row->lock_table),
thd);
OK(fields[IDX_LOCK_TABLE]->store(
- buf, static_cast<size_t>(bufend - buf),
- system_charset_info));
+ buf, uint(bufend - buf), system_charset_info));
/* lock_index */
if (row->lock_index != NULL) {
@@ -2594,7 +2593,7 @@ i_s_metrics_fill(
} else if (!(monitor_info->monitor_type & MONITOR_NO_AVERAGE)
&& !(monitor_info->monitor_type
& MONITOR_DISPLAY_CURRENT)) {
- if (time_diff) {
+ if (time_diff != 0) {
OK(fields[METRIC_AVG_VALUE_START]->store(
(double) MONITOR_VALUE_SINCE_START(
count) / time_diff));
@@ -2619,7 +2618,7 @@ i_s_metrics_fill(
time_diff = 0;
}
- if (time_diff) {
+ if (time_diff != 0) {
OK(fields[METRIC_AVG_VALUE_RESET]->store(
static_cast<double>(
MONITOR_VALUE(count) / time_diff)));
@@ -4931,7 +4930,7 @@ i_s_innodb_buffer_page_fill(
OK(fields[IDX_BUFFER_PAGE_TABLE_NAME]->store(
table_name,
- static_cast<size_t>(table_name_end - table_name),
+ uint(table_name_end - table_name),
system_charset_info));
fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull();
@@ -5053,7 +5052,7 @@ i_s_innodb_set_page_type(
page_info->page_type = I_S_PAGE_TYPE_INDEX;
}
- page_info->data_size = (ulint)(page_header_get_field(
+ page_info->data_size = unsigned(page_header_get_field(
page, PAGE_HEAP_TOP) - (page_is_comp(page)
? PAGE_NEW_SUPREMUM_END
: PAGE_OLD_SUPREMUM_END)
@@ -5651,7 +5650,7 @@ i_s_innodb_buf_page_lru_fill(
OK(fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->store(
table_name,
- static_cast<size_t>(table_name_end - table_name),
+ uint(table_name_end - table_name),
system_charset_info));
fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull();
@@ -9155,7 +9154,8 @@ i_s_innodb_mutexes_fill_table(
OK(field_store_string(fields[MUTEXES_NAME], mutex->cmutex_name));
OK(field_store_string(fields[MUTEXES_CREATE_FILE], innobase_basename(mutex->cfile_name)));
- OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], mutex->cline));
+ OK(fields[MUTEXES_CREATE_LINE]->store(mutex->cline, true));
+ fields[MUTEXES_CREATE_LINE]->set_notnull();
OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)mutex->count_os_wait));
OK(schema_table_store_record(thd, tables->table));
}
@@ -9168,7 +9168,8 @@ i_s_innodb_mutexes_fill_table(
OK(field_store_string(fields[MUTEXES_NAME], block_mutex->cmutex_name));
OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1));
- OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], block_mutex->cline));
+ OK(fields[MUTEXES_CREATE_LINE]->store(block_mutex->cline, true));
+ fields[MUTEXES_CREATE_LINE]->set_notnull();
OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)block_mutex_oswait_count));
OK(schema_table_store_record(thd, tables->table));
}
@@ -9192,7 +9193,8 @@ i_s_innodb_mutexes_fill_table(
//OK(field_store_string(fields[MUTEXES_NAME], lock->lock_name));
OK(field_store_string(fields[MUTEXES_CREATE_FILE], innobase_basename(lock->cfile_name)));
- OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], lock->cline));
+ OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline, true));
+ fields[MUTEXES_CREATE_LINE]->set_notnull();
OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)lock->count_os_wait));
OK(schema_table_store_record(thd, tables->table));
}
@@ -9205,7 +9207,8 @@ i_s_innodb_mutexes_fill_table(
//OK(field_store_string(fields[MUTEXES_NAME], block_lock->lock_name));
OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1));
- OK(field_store_ulint(fields[MUTEXES_CREATE_LINE], block_lock->cline));
+ OK(fields[MUTEXES_CREATE_LINE]->store(block_lock->cline, true));
+ fields[MUTEXES_CREATE_LINE]->set_notnull();
OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)block_lock_oswait_count));
OK(schema_table_store_record(thd, tables->table));
}
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index cf3ce487607..3bc56c2d737 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -810,7 +810,7 @@ ibuf_bitmap_get_map_page_func(
const page_id_t& page_id,
const page_size_t& page_size,
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr)
{
buf_block_t* block = NULL;
@@ -1138,7 +1138,7 @@ ibuf_page_low(
ibool x_latch,
#endif /* UNIV_DEBUG */
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr)
{
ibool ret;
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index 419c5db657d..4a80b5e4913 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, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2014, 2017, 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
@@ -79,66 +79,66 @@ enum btr_latch_mode {
/** If this is ORed to btr_latch_mode, it means that the search tuple
will be inserted to the index, at the searched position.
When the record is not in the buffer pool, try to use the insert buffer. */
-#define BTR_INSERT 512
+#define BTR_INSERT 512U
/** This flag ORed to btr_latch_mode says that we do the search in query
optimization */
-#define BTR_ESTIMATE 1024
+#define BTR_ESTIMATE 1024U
/** This flag ORed to BTR_INSERT says that we can ignore possible
UNIQUE definition on secondary indexes when we decide if we can use
the insert buffer to speed up inserts */
-#define BTR_IGNORE_SEC_UNIQUE 2048
+#define BTR_IGNORE_SEC_UNIQUE 2048U
/** Try to delete mark the record at the searched position using the
insert/delete buffer when the record is not in the buffer pool. */
-#define BTR_DELETE_MARK 4096
+#define BTR_DELETE_MARK 4096U
/** Try to purge the record at the searched position using the insert/delete
buffer when the record is not in the buffer pool. */
-#define BTR_DELETE 8192
+#define BTR_DELETE 8192U
/** In the case of BTR_SEARCH_LEAF or BTR_MODIFY_LEAF, the caller is
already holding an S latch on the index tree */
-#define BTR_ALREADY_S_LATCHED 16384
+#define BTR_ALREADY_S_LATCHED 16384U
/** In the case of BTR_MODIFY_TREE, the caller specifies the intention
to insert record only. It is used to optimize block->lock range.*/
-#define BTR_LATCH_FOR_INSERT 32768
+#define BTR_LATCH_FOR_INSERT 32768U
/** In the case of BTR_MODIFY_TREE, the caller specifies the intention
to delete record only. It is used to optimize block->lock range.*/
-#define BTR_LATCH_FOR_DELETE 65536
+#define BTR_LATCH_FOR_DELETE 65536U
/** This flag is for undo insert of rtree. For rtree, we need this flag
to find proper rec to undo insert.*/
-#define BTR_RTREE_UNDO_INS 131072
+#define BTR_RTREE_UNDO_INS 131072U
/** In the case of BTR_MODIFY_LEAF, the caller intends to allocate or
free the pages of externally stored fields. */
-#define BTR_MODIFY_EXTERNAL 262144
+#define BTR_MODIFY_EXTERNAL 262144U
/** Try to delete mark the record at the searched position when the
record is in spatial index */
-#define BTR_RTREE_DELETE_MARK 524288
-
-#define BTR_LATCH_MODE_WITHOUT_FLAGS(latch_mode) \
- ((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_FOR_INSERT \
- | BTR_LATCH_FOR_DELETE \
- | BTR_MODIFY_EXTERNAL))
+#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)))
/**************************************************************//**
Report that an index page is corrupted. */
@@ -206,7 +206,7 @@ btr_block_get_func(
const page_size_t& page_size,
ulint mode,
const char* file,
- ulint line,
+ unsigned line,
dict_index_t* index,
mtr_t* mtr);
@@ -507,7 +507,7 @@ btr_insert_on_non_leaf_level_func(
ulint level, /*!< in: level, must be > 0 */
dtuple_t* tuple, /*!< in: the record to be inserted */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define btr_insert_on_non_leaf_level(f,i,l,t,m) \
btr_insert_on_non_leaf_level_func(f,i,l,t,__FILE__,__LINE__,m)
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index 810ac8f8b67..308fcfe9b03 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2017, 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
@@ -51,7 +51,7 @@ btr_block_get_func(
const page_size_t& page_size,
ulint mode,
const char* file,
- ulint line,
+ unsigned line,
dict_index_t* index,
mtr_t* mtr)
{
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index 275c4dc51b0..19109e30b13 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -142,7 +143,7 @@ btr_cur_optimistic_latch_leaves(
ulint* latch_mode,
btr_cur_t* cursor,
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr);
/********************************************************************//**
@@ -185,7 +186,7 @@ btr_cur_search_to_nth_level(
currently has on search system:
RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr, /*!< in/out: mini-transaction */
ib_uint64_t autoinc = 0);
/*!< in: PAGE_ROOT_AUTO_INC to be written
@@ -205,7 +206,7 @@ btr_cur_open_at_index_side_func(
ulint level, /*!< in: level to search for
(0=leaf) */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in/out: mini-transaction */
MY_ATTRIBUTE((nonnull));
@@ -223,7 +224,7 @@ btr_cur_open_at_rnd_pos_func(
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_cur_t* cursor, /*!< in/out: B-tree cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define btr_cur_open_at_rnd_pos(i,l,c,m) \
btr_cur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
@@ -967,13 +968,13 @@ stored part. */
significant bit of the byte at smallest address) is set to 1 if this
field does not 'own' the externally stored field; only the owner field
is allowed to free the field in purge! */
-#define BTR_EXTERN_OWNER_FLAG 128
+#define BTR_EXTERN_OWNER_FLAG 128U
/** If the second most significant bit of BTR_EXTERN_LEN (i.e., the
second most significant bit of the byte at smallest address) is 1 then
it means that the externally stored field was inherited from an
earlier version of the row. In rollback we are not allowed to free an
inherited external field. */
-#define BTR_EXTERN_INHERITED_FLAG 64
+#define BTR_EXTERN_INHERITED_FLAG 64U
/** Number of searches down the B-tree in btr_cur_search_to_nth_level(). */
extern ulint btr_cur_n_non_sea;
diff --git a/storage/innobase/include/btr0pcur.h b/storage/innobase/include/btr0pcur.h
index 947316f0e4d..28636715c2b 100644
--- a/storage/innobase/include/btr0pcur.h
+++ b/storage/innobase/include/btr0pcur.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -113,7 +114,7 @@ btr_pcur_open_low(
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written
(0 if none) */
mtr_t* mtr); /*!< in: mtr */
@@ -145,7 +146,7 @@ btr_pcur_open_with_no_init_func(
currently has on search system:
RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_open_with_no_init(ix,t,md,l,cur,has,m) \
btr_pcur_open_with_no_init_func(ix,t,md,l,cur,has,__FILE__,__LINE__,m)
@@ -202,7 +203,7 @@ btr_pcur_open_on_user_rec_func(
btr_pcur_t* cursor, /*!< in: memory buffer for persistent
cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_open_on_user_rec(i,t,md,l,c,m) \
btr_pcur_open_on_user_rec_func(i,t,md,l,c,__FILE__,__LINE__,m)
@@ -218,7 +219,7 @@ btr_pcur_open_at_rnd_pos_func(
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in/out: B-tree pcur */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_open_at_rnd_pos(i,l,c,m) \
btr_pcur_open_at_rnd_pos_func(i,l,c,__FILE__,__LINE__,m)
@@ -272,7 +273,7 @@ btr_pcur_restore_position_func(
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: detached persistent cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define btr_pcur_restore_position(l,cur,mtr) \
btr_pcur_restore_position_func(l,cur,__FILE__,__LINE__,mtr)
diff --git a/storage/innobase/include/btr0pcur.ic b/storage/innobase/include/btr0pcur.ic
index 60790bc1316..425593631d3 100644
--- a/storage/innobase/include/btr0pcur.ic
+++ b/storage/innobase/include/btr0pcur.ic
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2017, 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
@@ -433,7 +433,7 @@ btr_pcur_open_low(
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
ib_uint64_t autoinc,/*!< in: PAGE_ROOT_AUTO_INC to be written
(0 if none) */
mtr_t* mtr) /*!< in: mtr */
@@ -499,7 +499,7 @@ btr_pcur_open_with_no_init_func(
currently has on search system:
RW_S_LATCH, or 0 */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
btr_cur_t* btr_cursor;
@@ -574,7 +574,7 @@ btr_pcur_open_at_rnd_pos_func(
ulint latch_mode, /*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in/out: B-tree pcur */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr) /*!< in: mtr */
{
/* Initialize the cursor */
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 0279887b226..ea0dd48cdbd 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, 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
@@ -493,7 +493,7 @@ buf_page_optimistic_get(
buf_block_t* block, /*!< in: guessed block */
ib_uint64_t modify_clock,/*!< in: modify clock value */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mini-transaction */
/********************************************************************//**
This is used to get access to a known database page, when no waiting can be
@@ -506,7 +506,7 @@ buf_page_get_known_nowait(
buf_block_t* block, /*!< in: the known page */
ulint mode, /*!< in: BUF_MAKE_YOUNG or BUF_KEEP_OLD */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mini-transaction */
/** Given a tablespace id and page number tries to get that page. If the
@@ -521,7 +521,7 @@ buf_block_t*
buf_page_try_get_func(
const page_id_t& page_id,
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr);
/** Tries to get a page.
@@ -567,7 +567,7 @@ buf_page_get_gen(
buf_block_t* guess,
ulint mode,
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr,
dberr_t* err);
@@ -647,7 +647,7 @@ buf_page_reset_file_page_was_freed(
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
UNIV_INLINE
-ulint
+unsigned
buf_page_get_freed_page_clock(
/*==========================*/
const buf_page_t* bpage) /*!< in: block */
@@ -656,7 +656,7 @@ buf_page_get_freed_page_clock(
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
UNIV_INLINE
-ulint
+unsigned
buf_block_get_freed_page_clock(
/*===========================*/
const buf_block_t* block) /*!< in: block */
@@ -720,7 +720,7 @@ buf_block_buf_fix_inc_func(
/*=======================*/
# ifdef UNIV_DEBUG
const char* file, /*!< in: file name */
- ulint line, /*!< in: line */
+ unsigned line, /*!< in: line */
# endif /* UNIV_DEBUG */
buf_block_t* block) /*!< in/out: block to bufferfix */
MY_ATTRIBUTE((nonnull));
@@ -820,7 +820,7 @@ Gets the hash value of a block. This can be used in searches in the
lock hash table.
@return lock hash value */
UNIV_INLINE
-ulint
+unsigned
buf_block_get_lock_hash_val(
/*========================*/
const buf_block_t* block) /*!< in: block */
@@ -1160,7 +1160,7 @@ void
buf_page_set_old(
/*=============*/
buf_page_t* bpage, /*!< in/out: control block */
- ibool old); /*!< in: old */
+ bool old); /*!< in: old */
/*********************************************************************//**
Determine the time of first access of a block in the buffer pool.
@return ut_time_ms() at the time of first access, 0 if not accessed */
@@ -1274,7 +1274,7 @@ buf_page_io_complete(
Calculates the index of a buffer pool to the buf_pool[] array.
@return the position of the buffer pool in buf_pool[] */
UNIV_INLINE
-ulint
+unsigned
buf_pool_index(
/*===========*/
const buf_pool_t* buf_pool) /*!< in: buffer pool */
@@ -2204,7 +2204,7 @@ struct buf_pool_t{
recovery and is set to NULL
once the recovery is over.
Protected by flush_list_mutex */
- ulint freed_page_clock;/*!< a sequence number used
+ unsigned freed_page_clock;/*!< a sequence number used
to count the number of buffer
blocks removed from the end of
the LRU list; NOTE that this
diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
index 5e75c446bbd..429c7fd3ba6 100644
--- a/storage/innobase/include/buf0buf.ic
+++ b/storage/innobase/include/buf0buf.ic
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2014, 2016, MariaDB Corporation.
+Copyright (c) 2014, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -71,12 +71,12 @@ buf_pool_get_curr_size(void)
Calculates the index of a buffer pool to the buf_pool[] array.
@return the position of the buffer pool in buf_pool[] */
UNIV_INLINE
-ulint
+unsigned
buf_pool_index(
/*===========*/
const buf_pool_t* buf_pool) /*!< in: buffer pool */
{
- ulint i = buf_pool - buf_pool_ptr;
+ unsigned i = unsigned(buf_pool - buf_pool_ptr);
ut_ad(i < MAX_BUFFER_POOLS);
ut_ad(i < srv_buf_pool_instances);
return(i);
@@ -91,10 +91,8 @@ buf_pool_from_bpage(
/*================*/
const buf_page_t* bpage) /*!< in: buffer pool page */
{
- ulint i;
- i = bpage->buf_pool_index;
- ut_ad(i < srv_buf_pool_instances);
- return(&buf_pool_ptr[i]);
+ ut_ad(bpage->buf_pool_index < srv_buf_pool_instances);
+ return(&buf_pool_ptr[bpage->buf_pool_index]);
}
/******************************************************************//**
@@ -124,7 +122,7 @@ buf_pool_get_n_pages(void)
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
UNIV_INLINE
-ulint
+unsigned
buf_page_get_freed_page_clock(
/*==========================*/
const buf_page_t* bpage) /*!< in: block */
@@ -137,7 +135,7 @@ buf_page_get_freed_page_clock(
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
UNIV_INLINE
-ulint
+unsigned
buf_block_get_freed_page_clock(
/*===========================*/
const buf_block_t* block) /*!< in: block */
@@ -162,7 +160,7 @@ buf_page_peek_if_young(
/* FIXME: bpage->freed_page_clock is 31 bits */
return((buf_pool->freed_page_clock & ((1UL << 31) - 1))
- < ((ulint) bpage->freed_page_clock
+ < (bpage->freed_page_clock
+ (buf_pool->curr_size
* (BUF_LRU_OLD_RATIO_DIV - buf_pool->LRU_old_ratio)
/ (BUF_LRU_OLD_RATIO_DIV * 4))));
@@ -629,7 +627,7 @@ void
buf_page_set_old(
/*=============*/
buf_page_t* bpage, /*!< in/out: control block */
- ibool old) /*!< in: old */
+ bool old) /*!< in: old */
{
#ifdef UNIV_DEBUG
buf_pool_t* buf_pool = buf_pool_from_bpage(bpage);
@@ -792,7 +790,7 @@ Gets the hash value of the page the pointer is pointing to. This can be used
in searches in the lock hash table.
@return lock hash value */
UNIV_INLINE
-ulint
+unsigned
buf_block_get_lock_hash_val(
/*========================*/
const buf_block_t* block) /*!< in: block */
@@ -978,7 +976,7 @@ buf_block_buf_fix_inc_func(
/*=======================*/
#ifdef UNIV_DEBUG
const char* file, /*!< in: file name */
- ulint line, /*!< in: line */
+ unsigned line, /*!< in: line */
#endif /* UNIV_DEBUG */
buf_block_t* block) /*!< in/out: block to bufferfix */
{
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index 273f9666419..fd124e8f94e 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2016, MariaDB Corporation
+Copyright (c) 2014, 2017, 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
@@ -376,7 +376,7 @@ public:
/** Check pages have been flushed and removed from the flush list
in a buffer pool instance.
- @pram[in] instance_no buffer pool instance no
+ @param[in] instance_no buffer pool instance no
@return true if the pages were removed from the flush list */
bool is_complete(ulint instance_no)
{
diff --git a/storage/innobase/include/data0data.ic b/storage/innobase/include/data0data.ic
index 2fe5190591b..81788885aa5 100644
--- a/storage/innobase/include/data0data.ic
+++ b/storage/innobase/include/data0data.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -221,7 +222,7 @@ dfield_write_mbr(
#endif /* UNIV_VALGRIND_DEBUG */
field->ext = 0;
- for (int i = 0; i < SPDIMS * 2; i++) {
+ for (unsigned i = 0; i < SPDIMS * 2; i++) {
mach_double_write(static_cast<byte*>(field->data)
+ i * sizeof(double), mbr[i]);
}
diff --git a/storage/innobase/include/data0type.h b/storage/innobase/include/data0type.h
index d38aa7c1533..958f5a4d0de 100644
--- a/storage/innobase/include/data0type.h
+++ b/storage/innobase/include/data0type.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -147,7 +148,7 @@ columns, and for them the precise type is usually not used at all.
for InnoDB's own system tables */
#define DATA_ERROR 111 /* another relic from pre-MySQL time */
-#define DATA_MYSQL_TYPE_MASK 255 /* AND with this mask to extract the MySQL
+#define DATA_MYSQL_TYPE_MASK 255U/* AND with this mask to extract the MySQL
type from the precise type */
#define DATA_MYSQL_TRUE_VARCHAR 15 /* MySQL type code for the >= 5.0.3
format true VARCHAR */
@@ -168,14 +169,14 @@ be less than 256 */
#define DATA_FTS_DOC_ID 3 /* Used as FTS DOC ID column */
-#define DATA_SYS_PRTYPE_MASK 0xF /* mask to extract the above from prtype */
+#define DATA_SYS_PRTYPE_MASK 0xFU /* mask to extract the above from prtype */
/* Flags ORed to the precise data type */
-#define DATA_NOT_NULL 256 /* this is ORed to the precise type when
+#define DATA_NOT_NULL 256U /* this is ORed to the precise type when
the column is declared as NOT NULL */
-#define DATA_UNSIGNED 512 /* this id ORed to the precise type when
+#define DATA_UNSIGNED 512U /* this id ORed to the precise type when
we have an unsigned integer type */
-#define DATA_BINARY_TYPE 1024 /* if the data type is a binary character
+#define DATA_BINARY_TYPE 1024U /* if the data type is a binary character
string, this is ORed to the precise type:
this only holds for tables created with
>= MySQL-4.0.14 */
@@ -183,14 +184,14 @@ be less than 256 */
In earlier versions this was set for some
BLOB columns.
*/
-#define DATA_GIS_MBR 2048 /* Used as GIS MBR column */
+#define DATA_GIS_MBR 2048U /* Used as GIS MBR column */
#define DATA_MBR_LEN SPDIMS * 2 * sizeof(double) /* GIS MBR length*/
-#define DATA_LONG_TRUE_VARCHAR 4096 /* this is ORed to the precise data
+#define DATA_LONG_TRUE_VARCHAR 4096U /* this is ORed to the precise data
type when the column is true VARCHAR where
MySQL uses 2 bytes to store the data len;
for shorter VARCHARs MySQL uses only 1 byte */
-#define DATA_VIRTUAL 8192 /* Virtual column */
+#define DATA_VIRTUAL 8192U /* Virtual column */
/** Get the number of system columns in a table. */
#define dict_table_get_n_sys_cols(table) DATA_N_SYS_COLS
@@ -221,14 +222,12 @@ length from corresponding column or index definition, instead of this MACRO
/* Pack mbminlen, mbmaxlen to mbminmaxlen. */
#define DATA_MBMINMAXLEN(mbminlen, mbmaxlen) \
- ((mbmaxlen) * DATA_MBMAX + (mbminlen))
-/* Get mbminlen from mbminmaxlen. Cast the result of UNIV_EXPECT to ulint
-because in GCC it returns a long. */
-#define DATA_MBMINLEN(mbminmaxlen) ((ulint) \
- UNIV_EXPECT(((mbminmaxlen) % DATA_MBMAX), \
- 1))
+ unsigned((mbmaxlen) * DATA_MBMAX + (mbminlen))
+/* Get mbminlen from mbminmaxlen. */
+#define DATA_MBMINLEN(mbminmaxlen) \
+ unsigned(UNIV_EXPECT((mbminmaxlen) % DATA_MBMAX, 1))
/* Get mbmaxlen from mbminmaxlen. */
-#define DATA_MBMAXLEN(mbminmaxlen) ((ulint) ((mbminmaxlen) / DATA_MBMAX))
+#define DATA_MBMAXLEN(mbminmaxlen) unsigned((mbminmaxlen) / DATA_MBMAX)
/* For checking if a geom_type is POINT */
#define DATA_POINT_MTYPE(mtype) ((mtype) == DATA_POINT \
@@ -369,16 +368,21 @@ ulint
dtype_get_charset_coll(
/*===================*/
ulint prtype);/*!< in: precise data type */
-/*********************************************************************//**
-Forms a precise type from the < 4.1.2 format precise type plus the
+/** Form a precise type from the < 4.1.2 format precise type plus the
charset-collation code.
+@param[in] old_prtype MySQL type code and the flags
+ DATA_BINARY_TYPE etc.
+@param[in] charset_coll character-set collation code
@return precise type, including the charset-collation code */
-ulint
-dtype_form_prtype(
-/*==============*/
- ulint old_prtype, /*!< in: the MySQL type code and the flags
- DATA_BINARY_TYPE etc. */
- ulint charset_coll); /*!< in: MySQL charset-collation code */
+UNIV_INLINE
+uint32_t
+dtype_form_prtype(ulint old_prtype, ulint charset_coll)
+{
+ ut_ad(old_prtype < 256 * 256);
+ ut_ad(charset_coll <= MAX_CHAR_COLL_NUM);
+ return(uint32_t(old_prtype + (charset_coll << 16)));
+}
+
/*********************************************************************//**
Determines if a MySQL string type is a subset of UTF-8. This function
may return false negatives, in case further character-set collation
diff --git a/storage/innobase/include/data0type.ic b/storage/innobase/include/data0type.ic
index 869d0ba8ed6..9ec85dfaf50 100644
--- a/storage/innobase/include/data0type.ic
+++ b/storage/innobase/include/data0type.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -151,9 +152,9 @@ dtype_set(
ut_ad(type);
ut_ad(mtype <= DATA_MTYPE_MAX);
- type->mtype = mtype;
- type->prtype = prtype;
- type->len = len;
+ type->mtype = unsigned(mtype);
+ type->prtype = unsigned(prtype);
+ type->len = unsigned(len);
dtype_set_mblen(type);
}
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index 036d905f0d8..92f00549dc9 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -399,7 +399,7 @@ void
dict_table_add_to_cache(
/*====================*/
dict_table_t* table, /*!< in: table */
- ibool can_be_evicted, /*!< in: TRUE if can be evicted*/
+ bool can_be_evicted, /*!< in: whether can be evicted*/
mem_heap_t* heap) /*!< in: temporary heap */
MY_ATTRIBUTE((nonnull));
/**********************************************************************//**
@@ -1567,11 +1567,9 @@ dict_index_calc_min_rec_len(
/*========================*/
const dict_index_t* index) /*!< in: index */
MY_ATTRIBUTE((nonnull, warn_unused_result));
-/********************************************************************//**
-Reserves the dictionary system mutex for MySQL. */
+/** Reserve the dictionary system mutex. */
void
-dict_mutex_enter_for_mysql_func(const char * file, ulint line);
-/*============================*/
+dict_mutex_enter_for_mysql_func(const char *file, unsigned line);
#define dict_mutex_enter_for_mysql() \
dict_mutex_enter_for_mysql_func(__FILE__, __LINE__)
diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic
index 905a1b78782..061153589c8 100644
--- a/storage/innobase/include/dict0dict.ic
+++ b/storage/innobase/include/dict0dict.ic
@@ -1418,7 +1418,7 @@ dict_index_set_space(
ut_ad(index);
ut_ad(index->magic_n == DICT_INDEX_MAGIC_N);
- index->space = space;
+ index->space = unsigned(space);
}
/*********************************************************************//**
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index a458054c225..ff28add8ca4 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -300,28 +300,28 @@ for unknown bits in order to protect backward incompatibility. */
#define DICT_TF2_BIT_MASK ~DICT_TF2_UNUSED_BIT_MASK
/** TEMPORARY; TRUE for tables from CREATE TEMPORARY TABLE. */
-#define DICT_TF2_TEMPORARY 1
+#define DICT_TF2_TEMPORARY 1U
/** The table has an internal defined DOC ID column */
-#define DICT_TF2_FTS_HAS_DOC_ID 2
+#define DICT_TF2_FTS_HAS_DOC_ID 2U
/** The table has an FTS index */
-#define DICT_TF2_FTS 4
+#define DICT_TF2_FTS 4U
/** Need to add Doc ID column for FTS index build.
This is a transient bit for index build */
-#define DICT_TF2_FTS_ADD_DOC_ID 8
+#define DICT_TF2_FTS_ADD_DOC_ID 8U
/** This bit is used during table creation to indicate that it will
use its own tablespace instead of the system tablespace. */
-#define DICT_TF2_USE_FILE_PER_TABLE 16
+#define DICT_TF2_USE_FILE_PER_TABLE 16U
/** Set when we discard/detach the tablespace */
-#define DICT_TF2_DISCARDED 32
+#define DICT_TF2_DISCARDED 32U
/** This bit is set if all aux table names (both common tables and
index tables) of a FTS table are in HEX format. */
-#define DICT_TF2_FTS_AUX_HEX_NAME 64
+#define DICT_TF2_FTS_AUX_HEX_NAME 64U
/* @} */
@@ -1257,12 +1257,12 @@ struct dict_foreign_set_free {
/** The flags for ON_UPDATE and ON_DELETE can be ORed; the default is that
a foreign key constraint is enforced, therefore RESTRICT just means no flag */
/* @{ */
-#define DICT_FOREIGN_ON_DELETE_CASCADE 1 /*!< ON DELETE CASCADE */
-#define DICT_FOREIGN_ON_DELETE_SET_NULL 2 /*!< ON UPDATE SET NULL */
-#define DICT_FOREIGN_ON_UPDATE_CASCADE 4 /*!< ON DELETE CASCADE */
-#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8 /*!< ON UPDATE SET NULL */
-#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16 /*!< ON DELETE NO ACTION */
-#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32 /*!< ON UPDATE NO ACTION */
+#define DICT_FOREIGN_ON_DELETE_CASCADE 1U /*!< ON DELETE CASCADE */
+#define DICT_FOREIGN_ON_DELETE_SET_NULL 2U /*!< ON UPDATE SET NULL */
+#define DICT_FOREIGN_ON_UPDATE_CASCADE 4U /*!< ON DELETE CASCADE */
+#define DICT_FOREIGN_ON_UPDATE_SET_NULL 8U /*!< ON UPDATE SET NULL */
+#define DICT_FOREIGN_ON_DELETE_NO_ACTION 16U /*!< ON DELETE NO ACTION */
+#define DICT_FOREIGN_ON_UPDATE_NO_ACTION 32U /*!< ON UPDATE NO ACTION */
/* @} */
/** Display an identifier.
@@ -1323,7 +1323,7 @@ struct dict_vcol_templ_t {
/** when mysql_table was cached */
uint64_t mysql_table_query_id;
- dict_vcol_templ_t() : vtempl(0), mysql_table_query_id(-1) {}
+ dict_vcol_templ_t() : vtempl(0), mysql_table_query_id(~0ULL) {}
};
/** These are used when MySQL FRM and InnoDB data dictionary are
diff --git a/storage/innobase/include/dict0mem.ic b/storage/innobase/include/dict0mem.ic
index e7d68dd4b9d..da2ac629850 100644
--- a/storage/innobase/include/dict0mem.ic
+++ b/storage/innobase/include/dict0mem.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -59,7 +60,7 @@ dict_mem_fill_index_struct(
/* Assign a ulint to a 4-bit-mapped field.
Only the low-order 4 bits are assigned. */
- index->type = type;
+ index->type = unsigned(type);
index->space = (unsigned int) space;
index->page = FIL_NULL;
index->merge_threshold = DICT_INDEX_MERGE_THRESHOLD_DEFAULT;
diff --git a/storage/innobase/include/dict0stats.h b/storage/innobase/include/dict0stats.h
index 8941b399f7d..cb16a4dee9c 100644
--- a/storage/innobase/include/dict0stats.h
+++ b/storage/innobase/include/dict0stats.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2009, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -77,14 +78,10 @@ dict_stats_set_persistent(
ibool ps_off) /*!< in: persistent stats explicitly disabled */
MY_ATTRIBUTE((nonnull));
-/*********************************************************************//**
-Check whether persistent statistics is enabled for a given table.
-@return TRUE if enabled, FALSE otherwise */
+/** @return whether persistent statistics is enabled for a given table */
UNIV_INLINE
-ibool
-dict_stats_is_persistent_enabled(
-/*=============================*/
- const dict_table_t* table) /*!< in: table */
+bool
+dict_stats_is_persistent_enabled(const dict_table_t* table)
MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
@@ -100,14 +97,11 @@ dict_stats_auto_recalc_set(
ibool auto_recalc_on, /*!< in: explicitly enabled */
ibool auto_recalc_off); /*!< in: explicitly disabled */
-/*********************************************************************//**
-Check whether auto recalc is enabled for a given table.
-@return TRUE if enabled, FALSE otherwise */
+/** @return whether auto recalc is enabled for a given table*/
UNIV_INLINE
-ibool
-dict_stats_auto_recalc_is_enabled(
-/*==============================*/
- const dict_table_t* table); /*!< in: table */
+bool
+dict_stats_auto_recalc_is_enabled(const dict_table_t* table)
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
/*********************************************************************//**
Initialize table's stats for the first time when opening a table. */
diff --git a/storage/innobase/include/dict0stats.ic b/storage/innobase/include/dict0stats.ic
index 61c88773912..1efe5780b58 100644
--- a/storage/innobase/include/dict0stats.ic
+++ b/storage/innobase/include/dict0stats.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+Copyright (c) 2017, 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
@@ -60,14 +61,10 @@ dict_stats_set_persistent(
table->stat_persistent = stat_persistent;
}
-/*********************************************************************//**
-Check whether persistent statistics is enabled for a given table.
-@return TRUE if enabled, FALSE otherwise */
+/** @return whether persistent statistics is enabled for a given table */
UNIV_INLINE
-ibool
-dict_stats_is_persistent_enabled(
-/*=============================*/
- const dict_table_t* table) /*!< in: table */
+bool
+dict_stats_is_persistent_enabled(const dict_table_t* table)
{
/* Because of the nature of this check (non-locking) it is possible
that a table becomes:
@@ -89,9 +86,9 @@ dict_stats_is_persistent_enabled(
if (stat_persistent & DICT_STATS_PERSISTENT_ON) {
ut_ad(!(stat_persistent & DICT_STATS_PERSISTENT_OFF));
- return(TRUE);
+ return(true);
} else if (stat_persistent & DICT_STATS_PERSISTENT_OFF) {
- return(FALSE);
+ return(false);
} else {
return(srv_stats_persistent);
}
@@ -126,23 +123,19 @@ dict_stats_auto_recalc_set(
table->stats_auto_recalc = stats_auto_recalc;
}
-/*********************************************************************//**
-Check whether auto recalc is enabled for a given table.
-@return TRUE if enabled, FALSE otherwise */
+/** @return whether auto recalc is enabled for a given table*/
UNIV_INLINE
-ibool
-dict_stats_auto_recalc_is_enabled(
-/*==============================*/
- const dict_table_t* table) /*!< in: table */
+bool
+dict_stats_auto_recalc_is_enabled(const dict_table_t* table)
{
/* we rely on this read to be atomic */
ib_uint32_t stats_auto_recalc = table->stats_auto_recalc;
if (stats_auto_recalc & DICT_STATS_AUTO_RECALC_ON) {
ut_ad(!(stats_auto_recalc & DICT_STATS_AUTO_RECALC_OFF));
- return(TRUE);
+ return(true);
} else if (stats_auto_recalc & DICT_STATS_AUTO_RECALC_OFF) {
- return(FALSE);
+ return(false);
} else {
return(srv_stats_auto_recalc);
}
diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h
index b0623f82bb7..27b4cc0e694 100644
--- a/storage/innobase/include/dict0types.h
+++ b/storage/innobase/include/dict0types.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, 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
@@ -101,7 +101,7 @@ extern uint ibuf_debug;
#define SPATIAL_STATUS_SHIFT 12
/** Mask to encode/decode spatial status. */
-#define SPATIAL_STATUS_MASK (3 << SPATIAL_STATUS_SHIFT)
+#define SPATIAL_STATUS_MASK (3U << SPATIAL_STATUS_SHIFT)
#if SPATIAL_STATUS_MASK < REC_VERSION_56_MAX_INDEX_COL_LEN
# error SPATIAL_STATUS_MASK < REC_VERSION_56_MAX_INDEX_COL_LEN
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index 7185857c039..7211d295c27 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -114,7 +114,7 @@ struct fil_space_crypt_struct : st_encryption_scheme
The object is expected to be placed in a buffer that
has been zero-initialized. */
fil_space_crypt_struct(
- ulint new_type,
+ uint new_type,
uint new_min_key_version,
uint new_key_id,
ulint offset,
diff --git a/storage/innobase/include/fil0crypt.ic b/storage/innobase/include/fil0crypt.ic
index 65ca4def85f..fe3a21f0643 100644
--- a/storage/innobase/include/fil0crypt.ic
+++ b/storage/innobase/include/fil0crypt.ic
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 2015, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2017, 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
@@ -59,7 +59,7 @@ fil_page_encryption_status(
}
}
} else {
- ulint key = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
+ unsigned key = mach_read_from_4(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
if (!encryption_key_version_exists(crypt_data->key_id, key)) {
return 1;
}
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index cda2fdb4656..587ad902c2a 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -176,8 +176,6 @@ struct fil_space_t {
/** True if page 0 of tablespace is read */
bool read_page0;
- /** True if we have tested if this filespace supports atomic writes */
- bool atomic_write_tested;
/** True if the device this filespace is on supports atomic writes */
bool atomic_write_supported;
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 892e6d1035e..621498b9a4c 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -862,7 +862,7 @@ fsp_page_is_free_func(
ulint page, /*!< in: page offset */
mtr_t* mtr, /*!< in/out: mini-transaction */
const char *file,
- ulint line);
+ unsigned line);
#define fsp_page_is_free(space,page,mtr) \
fsp_page_is_free_func(space,page,mtr, __FILE__, __LINE__)
diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h
index 429af4210b7..ec33f2e4d10 100644
--- a/storage/innobase/include/fsp0types.h
+++ b/storage/innobase/include/fsp0types.h
@@ -416,7 +416,7 @@ fsp_flags_is_valid(ulint flags)
bits 10..14 would be nonzero 0bsssaa where sss is
nonzero PAGE_SSIZE (3, 4, 6, or 7)
and aa is ATOMIC_WRITES (not 0b11). */
- if (FSP_FLAGS_GET_RESERVED(flags) & ~1) {
+ if (FSP_FLAGS_GET_RESERVED(flags) & ~1U) {
return(false);
}
diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h
index 436374fd6b2..950e2f2e9f5 100644
--- a/storage/innobase/include/gis0rtree.h
+++ b/storage/innobase/include/gis0rtree.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -151,7 +152,7 @@ rtr_cur_restore_position_func(
btr_cur_t* cursor, /*!< in: detached persistent cursor */
ulint level, /*!< in: index level */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define rtr_cur_restore_position(l,cur,level,mtr) \
rtr_cur_restore_position_func(l,cur,level,__FILE__,__LINE__,mtr)
@@ -351,7 +352,7 @@ rtr_page_get_father_node_ptr_func(
out: cursor on node pointer record,
its page x-latched */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
@@ -402,7 +403,7 @@ rtr_pcur_open_low(
ulint latch_mode,/*!< in: BTR_SEARCH_LEAF, ... */
btr_pcur_t* cursor, /*!< in: memory buffer for persistent cursor */
const char* file, /*!< in: file name */
- ulint line, /*!< in: line where called */
+ unsigned line, /*!< in: line where called */
mtr_t* mtr); /*!< in: mtr */
#define rtr_pcur_open(i,t,md,l,c,m) \
diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.ic
index a30db122273..7f64a9b13a1 100644
--- a/storage/innobase/include/gis0rtree.ic
+++ b/storage/innobase/include/gis0rtree.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -64,7 +65,7 @@ rtr_page_cal_mbr(
ut_ad(len == DATA_MBR_LEN);
inc = 0;
- for (int i = 0; i < SPDIMS; i++) {
+ for (unsigned i = 0; i < SPDIMS; i++) {
bmin = mach_double_read(field + inc);
bmax = mach_double_read(field + inc + sizeof(double));
@@ -167,7 +168,7 @@ rtr_write_mbr(
{
const double* my_mbr = reinterpret_cast<const double*>(mbr);
- for (int i = 0; i < SPDIMS * 2; i++) {
+ for (unsigned i = 0; i < SPDIMS * 2; i++) {
mach_double_write(data + i * sizeof(double), my_mbr[i]);
}
}
@@ -181,7 +182,7 @@ rtr_read_mbr(
const byte* data, /*!< in: data */
rtr_mbr_t* mbr) /*!< out: MBR */
{
- for (int i = 0; i < SPDIMS * 2; i++) {
+ for (unsigned i = 0; i < SPDIMS * 2; i++) {
(reinterpret_cast<double*>(mbr))[i] = mach_double_read(
data
+ i * sizeof(double));
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index e646f678964..ee8272d724c 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 2017, 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
@@ -274,7 +274,7 @@ ibuf_page_low(
ibool x_latch,
#endif /* UNIV_DEBUG */
const char* file,
- ulint line,
+ unsigned line,
mtr_t* mtr)
MY_ATTRIBUTE((warn_unused_result));
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index d96ba0d9c7d..b211b24d7ff 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -612,7 +612,7 @@ Calculates the hash value of a page file address: used in inserting or
searching for a lock in the hash table.
@return hashed value */
UNIV_INLINE
-ulint
+unsigned
lock_rec_hash(
/*==========*/
ulint space, /*!< in: space */
@@ -960,15 +960,15 @@ lock_trx_alloc_locks(trx_t* trx);
type_mode field in a lock */
/** Lock types */
/* @{ */
-#define LOCK_TABLE 16 /*!< table lock */
-#define LOCK_REC 32 /*!< record lock */
+#define LOCK_TABLE 16U /*!< table lock */
+#define LOCK_REC 32U /*!< record lock */
#define LOCK_TYPE_MASK 0xF0UL /*!< mask used to extract lock type from the
type_mode field in a lock */
#if LOCK_MODE_MASK & LOCK_TYPE_MASK
# error "LOCK_MODE_MASK & LOCK_TYPE_MASK"
#endif
-#define LOCK_WAIT 256 /*!< Waiting lock flag; when set, it
+#define LOCK_WAIT 256U /*!< Waiting lock flag; when set, it
means that the lock has not yet been
granted, it is just waiting for its
turn in the wait queue */
@@ -976,14 +976,14 @@ lock_trx_alloc_locks(trx_t* trx);
#define LOCK_ORDINARY 0 /*!< this flag denotes an ordinary
next-key lock in contrast to LOCK_GAP
or LOCK_REC_NOT_GAP */
-#define LOCK_GAP 512 /*!< when this bit is set, it means that the
+#define LOCK_GAP 512U /*!< when this bit is set, it means that the
lock holds only on the gap before the record;
for instance, an x-lock on the gap does not
give permission to modify the record on which
the bit is set; locks of this type are created
when records are removed from the index chain
of records */
-#define LOCK_REC_NOT_GAP 1024 /*!< this bit means that the lock is only on
+#define LOCK_REC_NOT_GAP 1024U /*!< this bit means that the lock is only on
the index record and does NOT block inserts
to the gap before the index record; this is
used in the case when we retrieve a record
@@ -991,7 +991,7 @@ lock_trx_alloc_locks(trx_t* trx);
locking plain SELECTs (not part of UPDATE
or DELETE) when the user has set the READ
COMMITTED isolation level */
-#define LOCK_INSERT_INTENTION 2048 /*!< this bit is set when we place a waiting
+#define LOCK_INSERT_INTENTION 2048U/*!< this bit is set when we place a waiting
gap type record lock request in order to let
an insert of an index record to wait until
there are no conflicting locks by other
@@ -999,8 +999,8 @@ lock_trx_alloc_locks(trx_t* trx);
remains set when the waiting lock is granted,
or if the lock is inherited to a neighboring
record */
-#define LOCK_PREDICATE 8192 /*!< Predicate lock */
-#define LOCK_PRDT_PAGE 16384 /*!< Page lock */
+#define LOCK_PREDICATE 8192U /*!< Predicate lock */
+#define LOCK_PRDT_PAGE 16384U /*!< Page lock */
#if (LOCK_WAIT|LOCK_GAP|LOCK_REC_NOT_GAP|LOCK_INSERT_INTENTION|LOCK_PREDICATE|LOCK_PRDT_PAGE)&LOCK_MODE_MASK
diff --git a/storage/innobase/include/lock0lock.ic b/storage/innobase/include/lock0lock.ic
index ba2311c02ea..6c28300467d 100644
--- a/storage/innobase/include/lock0lock.ic
+++ b/storage/innobase/include/lock0lock.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -56,14 +57,14 @@ Calculates the hash value of a page file address: used in inserting or
searching for a lock in the hash table.
@return hashed value */
UNIV_INLINE
-ulint
+unsigned
lock_rec_hash(
/*==========*/
ulint space, /*!< in: space */
ulint page_no)/*!< in: page number */
{
- return(hash_calc_hash(lock_rec_fold(space, page_no),
- lock_sys->rec_hash));
+ return(unsigned(hash_calc_hash(lock_rec_fold(space, page_no),
+ lock_sys->rec_hash)));
}
/*********************************************************************//**
diff --git a/storage/innobase/include/mach0data.h b/storage/innobase/include/mach0data.h
index 3d6bccec718..d3e3a53c655 100644
--- a/storage/innobase/include/mach0data.h
+++ b/storage/innobase/include/mach0data.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -45,14 +46,13 @@ mach_write_to_1(
/*============*/
byte* b, /*!< in: pointer to byte where to store */
ulint n); /*!< in: ulint integer to be stored, >= 0, < 256 */
-/********************************************************//**
-The following function is used to fetch data from one byte.
+/** The following function is used to fetch data from one byte.
+@param[in] b pointer to a byte to read
@return ulint integer, >= 0, < 256 */
UNIV_INLINE
-ulint
+uint8_t
mach_read_from_1(
-/*=============*/
- const byte* b) /*!< in: pointer to byte */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in two consecutive
@@ -63,17 +63,15 @@ mach_write_to_2(
/*============*/
byte* b, /*!< in: pointer to two bytes where to store */
ulint n); /*!< in: ulint integer to be stored, >= 0, < 64k */
-/********************************************************//**
-The following function is used to fetch data from two consecutive
+/** The following function is used to fetch data from 2 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer, >= 0, < 64k */
+@param[in] b pointer to 2 bytes where to store
+@return 2-byte integer, >= 0, < 64k */
UNIV_INLINE
-ulint
+uint16_t
mach_read_from_2(
-/*=============*/
- const byte* b) /*!< in: pointer to two bytes */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
-
/********************************************************//**
The following function is used to convert a 16-bit data item
to the canonical format, for fast bytewise equality test
@@ -105,15 +103,14 @@ mach_write_to_3(
/*============*/
byte* b, /*!< in: pointer to 3 bytes where to store */
ulint n); /*!< in: ulint integer to be stored */
-/********************************************************//**
-The following function is used to fetch data from 3 consecutive
+/** The following function is used to fetch data from 3 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@param[in] b pointer to 3 bytes to read
+@return 32 bit integer */
UNIV_INLINE
-ulint
+uint32_t
mach_read_from_3(
-/*=============*/
- const byte* b) /*!< in: pointer to 3 bytes */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
/*******************************************************//**
The following function is used to store data in four consecutive
@@ -124,15 +121,14 @@ mach_write_to_4(
/*============*/
byte* b, /*!< in: pointer to four bytes where to store */
ulint n); /*!< in: ulint integer to be stored */
-/********************************************************//**
-The following function is used to fetch data from 4 consecutive
+/** The following function is used to fetch data from 4 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@param[in] b pointer to 4 bytes to read
+@return 32 bit integer */
UNIV_INLINE
-ulint
+uint32_t
mach_read_from_4(
-/*=============*/
- const byte* b) /*!< in: pointer to four bytes */
+ const byte* b)
MY_ATTRIBUTE((warn_unused_result));
/*********************************************************//**
Writes a ulint in a compressed form (1..5 bytes).
diff --git a/storage/innobase/include/mach0data.ic b/storage/innobase/include/mach0data.ic
index 31cb873cdf6..6c879b38354 100644
--- a/storage/innobase/include/mach0data.ic
+++ b/storage/innobase/include/mach0data.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -62,30 +63,28 @@ mach_write_to_2(
b[1] = (byte)(n);
}
-/********************************************************//**
-The following function is used to fetch data from one byte.
+/** The following function is used to fetch data from one byte.
+@param[in] b pointer to a byte to read
@return ulint integer, >= 0, < 256 */
UNIV_INLINE
-ulint
+uint8_t
mach_read_from_1(
-/*=============*/
- const byte* b) /*!< in: pointer to byte */
+ const byte* b)
{
ut_ad(b);
- return((ulint)(b[0]));
+ return(uint8_t(*b));
}
-/********************************************************//**
-The following function is used to fetch data from 2 consecutive
+/** The following function is used to fetch data from 2 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@param[in] b pointer to 2 bytes to read
+@return 2-byte integer, >= 0, < 64k */
UNIV_INLINE
-ulint
+uint16_t
mach_read_from_2(
-/*=============*/
- const byte* b) /*!< in: pointer to 2 bytes */
+ const byte* b)
{
- return(((ulint)(b[0]) << 8) | (ulint)(b[1]));
+ return(uint16_t(uint16_t(b[0]) << 8 | b[1]));
}
#ifndef UNIV_INNOCHECKSUM
@@ -139,23 +138,21 @@ mach_write_to_3(
b[2] = (byte)(n);
}
-/********************************************************//**
-The following function is used to fetch data from 3 consecutive
+/** The following function is used to fetch data from 3 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@param[in] b pointer to 3 bytes to read
+@return uint32_t integer */
UNIV_INLINE
-ulint
+uint32_t
mach_read_from_3(
-/*=============*/
- const byte* b) /*!< in: pointer to 3 bytes */
+ const byte* b)
{
ut_ad(b);
- return( ((ulint)(b[0]) << 16)
- | ((ulint)(b[1]) << 8)
- | (ulint)(b[2])
+ return( (static_cast<uint32_t>(b[0]) << 16)
+ | (static_cast<uint32_t>(b[1]) << 8)
+ | static_cast<uint32_t>(b[2])
);
}
-
#endif /* !UNIV_INNOCHECKSUM */
/*******************************************************//**
@@ -176,21 +173,20 @@ mach_write_to_4(
b[3] = (byte) n;
}
-/********************************************************//**
-The following function is used to fetch data from 4 consecutive
+/** The following function is used to fetch data from 4 consecutive
bytes. The most significant byte is at the lowest address.
-@return ulint integer */
+@param[in] b pointer to 4 bytes to read
+@return 32 bit integer */
UNIV_INLINE
-ulint
+uint32_t
mach_read_from_4(
-/*=============*/
- const byte* b) /*!< in: pointer to four bytes */
+ const byte* b)
{
ut_ad(b);
- return( ((ulint)(b[0]) << 24)
- | ((ulint)(b[1]) << 16)
- | ((ulint)(b[2]) << 8)
- | (ulint)(b[3])
+ return( (static_cast<uint32_t>(b[0]) << 24)
+ | (static_cast<uint32_t>(b[1]) << 16)
+ | (static_cast<uint32_t>(b[2]) << 8)
+ | static_cast<uint32_t>(b[3])
);
}
diff --git a/storage/innobase/include/mem0mem.h b/storage/innobase/include/mem0mem.h
index 991d1179098..c44b6d38b78 100644
--- a/storage/innobase/include/mem0mem.h
+++ b/storage/innobase/include/mem0mem.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -121,7 +122,7 @@ mem_heap_create_func(
ulint size,
#ifdef UNIV_DEBUG
const char* file_name,
- ulint line,
+ unsigned line,
#endif /* UNIV_DEBUG */
ulint type);
@@ -371,7 +372,7 @@ struct mem_block_info_t {
ulint magic_n;/* magic number for debugging */
#ifdef UNIV_DEBUG
char file_name[8];/* file name where the mem heap was created */
- ulint line; /*!< line number where the mem heap was created */
+ unsigned line; /*!< line number where the mem heap was created */
#endif /* UNIV_DEBUG */
UT_LIST_BASE_NODE_T(mem_block_t) base; /* In the first block in the
the list this is the base node of the list of blocks;
diff --git a/storage/innobase/include/mem0mem.ic b/storage/innobase/include/mem0mem.ic
index 82c90584e6f..a8292a16143 100644
--- a/storage/innobase/include/mem0mem.ic
+++ b/storage/innobase/include/mem0mem.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -48,7 +49,7 @@ mem_heap_create_block_func(
ulint n, /*!< in: number of bytes needed for user data */
#ifdef UNIV_DEBUG
const char* file_name,/*!< in: file name where created */
- ulint line, /*!< in: line where created */
+ unsigned line, /*!< in: line where created */
#endif /* UNIV_DEBUG */
ulint type); /*!< in: type of heap: MEM_HEAP_DYNAMIC or
MEM_HEAP_BUFFER */
@@ -477,7 +478,7 @@ mem_heap_create_func(
ulint size,
#ifdef UNIV_DEBUG
const char* file_name,
- ulint line,
+ unsigned line,
#endif /* UNIV_DEBUG */
ulint type)
{
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index e761aaf7ec1..972209c1bf6 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -378,21 +378,21 @@ struct mtr_t {
@param lock rw-lock
@param file file name from where called
@param line line number in file */
- inline void s_lock(rw_lock_t* lock, const char* file, ulint line);
+ inline void s_lock(rw_lock_t* lock, const char* file, unsigned line);
/** Locks a rw-latch in X mode.
NOTE: use mtr_x_lock().
@param lock rw-lock
@param file file name from where called
@param line line number in file */
- inline void x_lock(rw_lock_t* lock, const char* file, ulint line);
+ inline void x_lock(rw_lock_t* lock, const char* file, unsigned line);
/** Locks a rw-latch in X mode.
NOTE: use mtr_sx_lock().
@param lock rw-lock
@param file file name from where called
@param line line number in file */
- inline void sx_lock(rw_lock_t* lock, const char* file, ulint line);
+ inline void sx_lock(rw_lock_t* lock, const char* file, unsigned line);
/** Acquire a tablespace X-latch.
NOTE: use mtr_x_lock_space().
@@ -403,7 +403,7 @@ struct mtr_t {
fil_space_t* x_lock_space(
ulint space_id,
const char* file,
- ulint line);
+ unsigned line);
/** Release an object in the memo stack.
@param object object
diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic
index f0354756b23..82f552f22ce 100644
--- a/storage/innobase/include/mtr0mtr.ic
+++ b/storage/innobase/include/mtr0mtr.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -232,7 +233,7 @@ mtr_t::set_log_mode(mtr_log_t mode)
Locks a lock in s-mode. */
void
-mtr_t::s_lock(rw_lock_t* lock, const char* file, ulint line)
+mtr_t::s_lock(rw_lock_t* lock, const char* file, unsigned line)
{
rw_lock_s_lock_inline(lock, 0, file, line);
@@ -243,7 +244,7 @@ mtr_t::s_lock(rw_lock_t* lock, const char* file, ulint line)
Locks a lock in x-mode. */
void
-mtr_t::x_lock(rw_lock_t* lock, const char* file, ulint line)
+mtr_t::x_lock(rw_lock_t* lock, const char* file, unsigned line)
{
rw_lock_x_lock_inline(lock, 0, file, line);
@@ -254,7 +255,7 @@ mtr_t::x_lock(rw_lock_t* lock, const char* file, ulint line)
Locks a lock in sx-mode. */
void
-mtr_t::sx_lock(rw_lock_t* lock, const char* file, ulint line)
+mtr_t::sx_lock(rw_lock_t* lock, const char* file, unsigned line)
{
rw_lock_sx_lock_inline(lock, 0, file, line);
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index ffe7b1a48bf..e30c427dff6 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -110,7 +110,7 @@ whole block gets written. This should be true even in most cases of a crash:
if this fails for a log block, then it is equivalent to a media failure in the
log. */
-#define OS_FILE_LOG_BLOCK_SIZE 512
+#define OS_FILE_LOG_BLOCK_SIZE 512U
/** Options for os_file_create_func @{ */
enum os_file_create_t {
@@ -861,7 +861,7 @@ pfs_os_file_create_simple_func(
bool read_only,
bool* success,
const char* src_file,
- ulint src_line)
+ uint src_line)
MY_ATTRIBUTE((warn_unused_result));
/** NOTE! Please use the corresponding macro
@@ -892,7 +892,7 @@ pfs_os_file_create_simple_no_error_handling_func(
bool read_only,
bool* success,
const char* src_file,
- ulint src_line)
+ uint src_line)
MY_ATTRIBUTE((warn_unused_result));
/** NOTE! Please use the corresponding macro os_file_create(), not directly
@@ -926,7 +926,7 @@ pfs_os_file_create_func(
bool read_only,
bool* success,
const char* src_file,
- ulint src_line)
+ uint src_line)
MY_ATTRIBUTE((warn_unused_result));
/** NOTE! Please use the corresponding macro os_file_close(), not directly
@@ -941,7 +941,7 @@ bool
pfs_os_file_close_func(
os_file_t file,
const char* src_file,
- ulint src_line);
+ uint src_line);
/** NOTE! Please use the corresponding macro os_file_read(), not directly
this function!
@@ -964,7 +964,7 @@ pfs_os_file_read_func(
os_offset_t offset,
ulint n,
const char* src_file,
- ulint src_line);
+ uint src_line);
/** NOTE! Please use the corresponding macro os_file_read_no_error_handling(),
not directly this function!
@@ -990,7 +990,7 @@ pfs_os_file_read_no_error_handling_func(
ulint n,
ulint* o,
const char* src_file,
- ulint src_line);
+ uint src_line);
/** NOTE! Please use the corresponding macro os_aio(), not directly this
function!
@@ -1028,7 +1028,7 @@ pfs_os_aio_func(
fil_node_t* m1,
void* m2,
const char* src_file,
- ulint src_line);
+ uint src_line);
/** NOTE! Please use the corresponding macro os_file_write(), not directly
this function!
@@ -1054,7 +1054,7 @@ pfs_os_file_write_func(
os_offset_t offset,
ulint n,
const char* src_file,
- ulint src_line);
+ uint src_line);
/** NOTE! Please use the corresponding macro os_file_flush(), not directly
this function!
@@ -1070,7 +1070,7 @@ bool
pfs_os_file_flush_func(
os_file_t file,
const char* src_file,
- ulint src_line);
+ uint src_line);
/** NOTE! Please use the corresponding macro os_file_rename(), not directly
this function!
@@ -1089,7 +1089,7 @@ pfs_os_file_rename_func(
const char* oldpath,
const char* newpath,
const char* src_file,
- ulint src_line);
+ uint src_line);
/**
NOTE! Please use the corresponding macro os_file_delete(), not directly
@@ -1107,7 +1107,7 @@ pfs_os_file_delete_func(
mysql_pfs_key_t key,
const char* name,
const char* src_file,
- ulint src_line);
+ uint src_line);
/**
NOTE! Please use the corresponding macro os_file_delete_if_exists(), not
@@ -1127,7 +1127,7 @@ pfs_os_file_delete_if_exists_func(
const char* name,
bool* exist,
const char* src_file,
- ulint src_line);
+ uint src_line);
#else /* UNIV_PFS_IO */
diff --git a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
index 5c7c4d45ca6..807d3254b9d 100644
--- a/storage/innobase/include/os0file.ic
+++ b/storage/innobase/include/os0file.ic
@@ -52,7 +52,7 @@ pfs_os_file_create_simple_func(
bool read_only,
bool* success,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -101,7 +101,7 @@ pfs_os_file_create_simple_no_error_handling_func(
bool read_only,
bool* success,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -152,7 +152,7 @@ pfs_os_file_create_func(
bool read_only,
bool* success,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -184,7 +184,7 @@ bool
pfs_os_file_close_func(
os_file_t file,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -236,7 +236,7 @@ pfs_os_aio_func(
fil_node_t* m1,
void* m2,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -278,7 +278,7 @@ pfs_os_file_read_func(
os_offset_t offset,
ulint n,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -321,7 +321,7 @@ pfs_os_file_read_no_error_handling_func(
ulint n,
ulint* o,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -361,7 +361,7 @@ pfs_os_file_write_func(
os_offset_t offset,
ulint n,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -392,7 +392,7 @@ bool
pfs_os_file_flush_func(
os_file_t file,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -424,7 +424,7 @@ pfs_os_file_rename_func(
const char* oldpath,
const char* newpath,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
@@ -456,7 +456,7 @@ pfs_os_file_delete_func(
mysql_pfs_key_t key,
const char* name,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -489,7 +489,7 @@ pfs_os_file_delete_if_exists_func(
const char* name,
bool* exist,
const char* src_file,
- ulint src_line)
+ uint src_line)
{
PSI_file_locker_state state;
struct PSI_file_locker* locker = NULL;
@@ -504,4 +504,3 @@ pfs_os_file_delete_if_exists_func(
return(result);
}
#endif /* UNIV_PFS_IO */
-
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index a70ca3da8d8..3940931125e 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -252,7 +252,7 @@ page_header_set_ptr(
if (ptr == NULL) {
offs = 0;
} else {
- offs = ptr - page;
+ offs = ulint(ptr - page);
}
ut_ad((field != PAGE_HEAP_TOP) || offs);
@@ -1248,11 +1248,9 @@ page_mem_free(
ut_ad(rec_offs_validate(rec, index, offsets));
free = page_header_get_ptr(page, PAGE_FREE);
- bool scrub = srv_immediate_scrub_data_uncompressed;
- if (scrub) {
+ if (srv_immediate_scrub_data_uncompressed) {
/* scrub record */
- uint size = rec_offs_data_size(offsets);
- memset(rec, 0, size);
+ memset(rec, 0, rec_offs_data_size(offsets));
}
page_rec_set_next(rec, free);
diff --git a/storage/innobase/include/page0size.h b/storage/innobase/include/page0size.h
index ca173db9b6d..30a996df0a6 100644
--- a/storage/innobase/include/page0size.h
+++ b/storage/innobase/include/page0size.h
@@ -82,7 +82,7 @@ public:
ssize = (0 == ssize) ? UNIV_PAGE_SSIZE_ORIG : ssize;
/* Convert from a 'log2 minus 9' to a page size in bytes. */
- const ulint size = ((UNIV_ZIP_SIZE_MIN >> 1) << ssize);
+ const unsigned size = ((UNIV_ZIP_SIZE_MIN >> 1) << ssize);
ut_ad(size <= UNIV_PAGE_SIZE_MAX);
ut_ad(size <= (1 << PAGE_SIZE_T_SIZE_BITS));
@@ -102,7 +102,7 @@ public:
/* Convert from a 'log2 minus 9' to a page size
in bytes. */
- const ulint phy
+ const unsigned phy
= ((UNIV_ZIP_SIZE_MIN >> 1) << ssize);
ut_ad(phy <= UNIV_ZIP_SIZE_MAX);
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index 4a32595af66..f4da2b55385 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -2,6 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2017, 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
@@ -69,11 +70,11 @@ extern uint page_zip_level;
+ DATA_TRX_ID_LEN \
+ DATA_ROLL_PTR_LEN)
/** Mask of record offsets */
-#define PAGE_ZIP_DIR_SLOT_MASK 0x3fff
+#define PAGE_ZIP_DIR_SLOT_MASK 0x3fffU
/** 'owned' flag */
-#define PAGE_ZIP_DIR_SLOT_OWNED 0x4000
+#define PAGE_ZIP_DIR_SLOT_OWNED 0x4000U
/** 'deleted' flag */
-#define PAGE_ZIP_DIR_SLOT_DEL 0x8000
+#define PAGE_ZIP_DIR_SLOT_DEL 0x8000U
/* Whether or not to log compressed page images to avoid possible
compression algorithm changes in zlib. */
diff --git a/storage/innobase/include/page0zip.ic b/storage/innobase/include/page0zip.ic
index 9cc54dc42fa..5f754e1f993 100644
--- a/storage/innobase/include/page0zip.ic
+++ b/storage/innobase/include/page0zip.ic
@@ -2,6 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2017, 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
@@ -133,11 +134,11 @@ page_zip_set_size(
ulint size) /*!< in: size in bytes */
{
if (size) {
- int ssize;
+ unsigned ssize;
ut_ad(ut_is_2pow(size));
- for (ssize = 1; size > (ulint) (512 << ssize); ssize++) {
+ for (ssize = 1; size > (512U << ssize); ssize++) {
}
page_zip->ssize = ssize;
@@ -268,9 +269,9 @@ page_zip_max_ins_size(
trailer_len += PAGE_ZIP_DIR_SLOT_SIZE;
- return((lint) page_zip_get_size(page_zip)
- - trailer_len - page_zip->m_end
- - (REC_N_NEW_EXTRA_BYTES - 2));
+ return(lint(page_zip_get_size(page_zip)
+ - trailer_len - page_zip->m_end
+ - (REC_N_NEW_EXTRA_BYTES - 2)));
}
/**********************************************************************//**
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index ed700139b53..4b82a6b05b9 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -458,7 +459,7 @@ rec_get_offsets_func(
(ULINT_UNDEFINED if all fields) */
#ifdef UNIV_DEBUG
const char* file, /*!< in: file name where called */
- ulint line, /*!< in: line number where called */
+ unsigned line, /*!< in: line number where called */
#endif /* UNIV_DEBUG */
mem_heap_t** heap) /*!< in/out: memory heap */
#ifdef UNIV_DEBUG
diff --git a/storage/innobase/include/row0ins.h b/storage/innobase/include/row0ins.h
index 4038c32b9c0..00a32942de2 100644
--- a/storage/innobase/include/row0ins.h
+++ b/storage/innobase/include/row0ins.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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,7 +154,7 @@ row_ins_index_entry_big_rec_func(
#ifndef DBUG_OFF
const void* thd, /*!< in: connection, or NULL */
#endif /* DBUG_OFF */
- ulint line) /*!< in: line number of caller */
+ unsigned line) /*!< in: line number of caller */
MY_ATTRIBUTE((nonnull(1,2,3,4,5,6), warn_unused_result));
#ifdef DBUG_OFF
# define row_ins_index_entry_big_rec(e,big,ofs,heap,index,thd,file,line) \
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index 9e71ee42bb0..1b61c475c6f 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2017, 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
@@ -283,8 +283,8 @@ row_merge_create_index(
/*********************************************************************//**
Check if a transaction can use an index.
-@return TRUE if index can be used by the transaction else FALSE */
-ibool
+@return whether the index can be used by the transaction */
+bool
row_merge_is_index_usable(
/*======================*/
const trx_t* trx, /*!< in: transaction */
diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h
index 607f7c96389..0e4ebafc990 100644
--- a/storage/innobase/include/row0mysql.h
+++ b/storage/innobase/include/row0mysql.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -337,7 +338,7 @@ row_mysql_lock_data_dictionary_func(
/*================================*/
trx_t* trx, /*!< in/out: transaction */
const char* file, /*!< in: file name */
- ulint line); /*!< in: line number */
+ unsigned line); /*!< in: line number */
#define row_mysql_lock_data_dictionary(trx) \
row_mysql_lock_data_dictionary_func(trx, __FILE__, __LINE__)
/*********************************************************************//**
@@ -354,7 +355,7 @@ row_mysql_freeze_data_dictionary_func(
/*==================================*/
trx_t* trx, /*!< in/out: transaction */
const char* file, /*!< in: file name */
- ulint line); /*!< in: line number */
+ unsigned line); /*!< in: line number */
#define row_mysql_freeze_data_dictionary(trx) \
row_mysql_freeze_data_dictionary_func(trx, __FILE__, __LINE__)
/*********************************************************************//**
diff --git a/storage/innobase/include/row0upd.ic b/storage/innobase/include/row0upd.ic
index 8b794e47a07..18c72309930 100644
--- a/storage/innobase/include/row0upd.ic
+++ b/storage/innobase/include/row0upd.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -97,10 +98,10 @@ upd_field_set_field_no(
dict_index_t* index, /*!< in: index */
trx_t* trx) /*!< in: transaction */
{
- upd_field->field_no = field_no;
+ upd_field->field_no = unsigned(field_no);
upd_field->orig_len = 0;
- if (field_no >= dict_index_get_n_fields(index)) {
+ if (UNIV_UNLIKELY(field_no >= dict_index_get_n_fields(index))) {
ib::error()
<< " trying to access field " << field_no
<< " in " << index->name
@@ -125,19 +126,10 @@ upd_field_set_v_field_no(
ulint field_no,
dict_index_t* index)
{
- upd_field->field_no = field_no;
+ ut_a(field_no < dict_table_get_n_v_cols(index->table));
+ upd_field->field_no = unsigned(field_no);
upd_field->orig_len = 0;
- if (field_no >= dict_table_get_n_v_cols(index->table)) {
- ib::error()
- << " trying to access virtual field " << field_no
- << " in " << index->name
- << " of table " << index->table->name
- << " which contains only " << index->table->n_v_cols
- << " virutal columns";
- ut_ad(0);
- }
-
dict_col_copy_type(&dict_table_get_nth_v_col(
index->table, field_no)->m_col,
dfield_get_type(&upd_field->new_val));
diff --git a/storage/innobase/include/sync0arr.h b/storage/innobase/include/sync0arr.h
index bc419a9be8f..23b9b746d20 100644
--- a/storage/innobase/include/sync0arr.h
+++ b/storage/innobase/include/sync0arr.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2015, 2016, MariaDB Corporation.
+Copyright (c) 2015, 2017, 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
@@ -49,7 +49,7 @@ sync_array_get_and_reserve_cell(
void* object, /*!< in: pointer to the object to wait for */
ulint type, /*!< in: lock request type */
const char* file, /*!< in: file where requested */
- ulint line, /*!< in: line where requested */
+ unsigned line, /*!< in: line where requested */
sync_cell_t** cell); /*!< out: the cell reserved, never NULL */
/******************************************************************//**
Reserves a wait array cell for waiting for an object.
@@ -60,7 +60,7 @@ sync_array_reserve_cell(
void* object, /*!< in: pointer to the object to wait for */
ulint type, /*!< in: lock request type */
const char* file, /*!< in: file where requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
This function should be called when a thread starts to wait on
diff --git a/storage/innobase/include/sync0arr.ic b/storage/innobase/include/sync0arr.ic
index a15e2176278..cd1d8e27625 100644
--- a/storage/innobase/include/sync0arr.ic
+++ b/storage/innobase/include/sync0arr.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -61,7 +62,7 @@ sync_array_get_and_reserve_cell(
void* object, /*!< in: pointer to the object to wait for */
ulint type, /*!< in: lock request type */
const char* file, /*!< in: file where requested */
- ulint line, /*!< in: line where requested */
+ unsigned line, /*!< in: line where requested */
sync_cell_t** cell) /*!< out: the cell reserved, never NULL */
{
sync_array_t* sync_arr = NULL;
diff --git a/storage/innobase/include/sync0policy.h b/storage/innobase/include/sync0policy.h
index 0eaefc7167a..1a430328f0e 100644
--- a/storage/innobase/include/sync0policy.h
+++ b/storage/innobase/include/sync0policy.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -70,7 +71,7 @@ public:
void locked(
const Mutex* mutex,
const char* filename,
- ulint line)
+ unsigned line)
UNIV_NOTHROW
{
m_mutex = mutex;
@@ -92,7 +93,7 @@ public:
m_filename = NULL;
- m_line = ULINT_UNDEFINED;
+ m_line = 0;
}
/** Print information about the latch
@@ -134,7 +135,7 @@ public:
const char* m_filename;
/** Line mumber in filename */
- ulint m_line;
+ unsigned m_line;
/** Thread ID of the thread that own(ed) the mutex */
os_thread_id_t m_thread_id;
@@ -176,7 +177,7 @@ public:
void enter(
const Mutex* mutex,
const char* filename,
- ulint line)
+ unsigned line)
UNIV_NOTHROW;
/** Called when the mutex is locked
@@ -186,7 +187,7 @@ public:
void locked(
const Mutex* mutex,
const char* filename,
- ulint line)
+ unsigned line)
UNIV_NOTHROW;
/** Called when the mutex is released
@@ -210,7 +211,7 @@ public:
}
/** @return the name of the file from the mutex was acquired */
- ulint get_enter_line() const
+ unsigned get_enter_line() const
UNIV_NOTHROW
{
return(m_context.m_line);
@@ -240,7 +241,7 @@ struct NoPolicy {
void init(const Mutex&, latch_id_t, const char*, uint32_t)
UNIV_NOTHROW { }
void destroy() UNIV_NOTHROW { }
- void enter(const Mutex&, const char*, ulint line) UNIV_NOTHROW { }
+ void enter(const Mutex&, const char*, unsigned line) UNIV_NOTHROW { }
void add(uint32_t, uint32_t) UNIV_NOTHROW { }
void locked(const Mutex&, const char*, ulint) UNIV_NOTHROW { }
void release(const Mutex&) UNIV_NOTHROW { }
@@ -293,7 +294,7 @@ public:
meta.get_counter()->single_register(&m_count);
- sync_file_created_register(this, filename, line);
+ sync_file_created_register(this, filename, uint16_t(line));
ut_d(MutexDebug<MutexType>::init(m_id));
}
@@ -341,7 +342,7 @@ public:
void enter(
const MutexType& mutex,
const char* filename,
- ulint line)
+ unsigned line)
UNIV_NOTHROW
{
ut_d(MutexDebug<MutexType>::enter(&mutex, filename, line));
@@ -354,7 +355,7 @@ public:
void locked(
const MutexType& mutex,
const char* filename,
- ulint line)
+ unsigned line)
UNIV_NOTHROW
{
ut_d(MutexDebug<MutexType>::locked(&mutex, filename, line));
@@ -492,7 +493,7 @@ public:
void locked(
const MutexType& mutex,
const char* filename,
- ulint line)
+ unsigned line)
UNIV_NOTHROW
{
ut_d(MutexDebug<MutexType>::locked(&mutex, filename, line));
@@ -513,7 +514,7 @@ public:
void enter(
const MutexType& mutex,
const char* filename,
- ulint line)
+ unsigned line)
UNIV_NOTHROW
{
ut_d(MutexDebug<MutexType>::enter(&mutex, filename, line));
diff --git a/storage/innobase/include/sync0policy.ic b/storage/innobase/include/sync0policy.ic
index f7598fe7854..f3526bbfef5 100644
--- a/storage/innobase/include/sync0policy.ic
+++ b/storage/innobase/include/sync0policy.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2015, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -57,7 +58,7 @@ template <typename Mutex>
void MutexDebug<Mutex>::enter(
const Mutex* mutex,
const char* name,
- ulint line)
+ unsigned line)
UNIV_NOTHROW
{
ut_ad(!is_owned());
@@ -75,7 +76,7 @@ template <typename Mutex>
void MutexDebug<Mutex>::locked(
const Mutex* mutex,
const char* name,
- ulint line)
+ unsigned line)
UNIV_NOTHROW
{
ut_ad(!is_owned());
diff --git a/storage/innobase/include/sync0rw.h b/storage/innobase/include/sync0rw.h
index 79532790f76..cf4a646cdcc 100644
--- a/storage/innobase/include/sync0rw.h
+++ b/storage/innobase/include/sync0rw.h
@@ -302,7 +302,7 @@ rw_lock_create_func(
latch_level_t level, /*!< in: level */
#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline); /*!< in: file line where created */
+ unsigned cline); /*!< in: file line where created */
/******************************************************************//**
Calling this function is obligatory only if the memory buffer containing
the rw-lock is freed. Removes an rw-lock object from the global list. The
@@ -334,7 +334,7 @@ rw_lock_s_lock_low(
/*!< in: pass value; != 0, if the lock will be
passed to another thread to unlock */
const char* file_name, /*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
NOTE! Use the corresponding macro, not directly this function, except if
you supply the file name and line number. Lock an rw-lock in shared mode
@@ -350,7 +350,7 @@ rw_lock_s_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
NOTE! Use the corresponding macro, not directly this function! Lock an
rw-lock in exclusive mode for the current thread if the lock can be
@@ -362,7 +362,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
rw_lock_t* lock, /*!< in: pointer to rw-lock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Releases a shared mode lock. */
UNIV_INLINE
@@ -391,7 +391,7 @@ rw_lock_x_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Low-level function for acquiring an sx lock.
@return FALSE if did not succeed, TRUE if success. */
@@ -402,7 +402,7 @@ rw_lock_sx_lock_low(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
NOTE! Use the corresponding macro, not directly this function! Lock an
rw-lock in SX mode for the current thread. If the rw-lock is locked
@@ -419,7 +419,7 @@ rw_lock_sx_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Releases an exclusive mode lock. */
UNIV_INLINE
@@ -688,7 +688,7 @@ struct rw_lock_debug_t {
ulint lock_type; /*!< Type of the lock: RW_LOCK_X,
RW_LOCK_S, RW_LOCK_X_WAIT */
const char* file_name;/*!< File name where the lock was obtained */
- ulint line; /*!< Line where the rw-lock was locked */
+ unsigned line; /*!< Line where the rw-lock was locked */
UT_LIST_NODE_T(rw_lock_debug_t) list;
/*!< Debug structs are linked in a two-way
list */
@@ -737,7 +737,7 @@ pfs_rw_lock_create_func(
latch_level_t level, /*!< in: level */
#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline); /*!< in: file line where created */
+ unsigned cline); /*!< in: file line where created */
/******************************************************************//**
Performance schema instrumented wrap function for rw_lock_x_lock_func()
@@ -751,7 +751,7 @@ pfs_rw_lock_x_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Performance schema instrumented wrap function for
rw_lock_x_lock_func_nowait()
@@ -763,7 +763,7 @@ pfs_rw_lock_x_lock_func_nowait(
/*===========================*/
rw_lock_t* lock, /*!< in: pointer to rw-lock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Performance schema instrumented wrap function for rw_lock_s_lock_func()
NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly
@@ -776,7 +776,7 @@ pfs_rw_lock_s_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Performance schema instrumented wrap function for rw_lock_s_lock_func()
NOTE! Please use the corresponding macro rw_lock_s_lock(), not directly
@@ -791,7 +791,7 @@ pfs_rw_lock_s_lock_low(
lock will be passed to another
thread to unlock */
const char* file_name, /*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Performance schema instrumented wrap function for rw_lock_x_lock_func()
NOTE! Please use the corresponding macro rw_lock_x_lock(), not directly
@@ -804,7 +804,7 @@ pfs_rw_lock_x_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Performance schema instrumented wrap function for rw_lock_s_unlock_func()
NOTE! Please use the corresponding macro rw_lock_s_unlock(), not directly
@@ -845,7 +845,7 @@ pfs_rw_lock_sx_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Performance schema instrumented wrap function for rw_lock_sx_lock_nowait()
NOTE! Please use the corresponding macro, not directly
@@ -858,7 +858,7 @@ pfs_rw_lock_sx_lock_low(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Performance schema instrumented wrap function for rw_lock_sx_unlock_func()
NOTE! Please use the corresponding macro rw_lock_sx_unlock(), not directly
diff --git a/storage/innobase/include/sync0rw.ic b/storage/innobase/include/sync0rw.ic
index 0d2c28d9d19..21872cc8bee 100644
--- a/storage/innobase/include/sync0rw.ic
+++ b/storage/innobase/include/sync0rw.ic
@@ -45,7 +45,7 @@ rw_lock_s_lock_spin(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
#ifdef UNIV_DEBUG
/******************************************************************//**
Inserts the debug information for an rw-lock. */
@@ -56,7 +56,7 @@ rw_lock_add_debug_info(
ulint pass, /*!< in: pass value */
ulint lock_type, /*!< in: lock type */
const char* file_name, /*!< in: file where requested */
- ulint line); /*!< in: line where requested */
+ unsigned line); /*!< in: line where requested */
/******************************************************************//**
Removes a debug information struct for an rw-lock. */
void
@@ -237,7 +237,7 @@ rw_lock_s_lock_low(
/*!< in: pass value; != 0, if the lock will be
passed to another thread to unlock */
const char* file_name, /*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
if (!rw_lock_lock_word_decr(lock, 1, 0)) {
/* Locking did not succeed */
@@ -268,7 +268,7 @@ rw_lock_s_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
/* NOTE: As we do not know the thread ids for threads which have
s-locked a latch, and s-lockers will be served only after waiting
@@ -303,7 +303,7 @@ rw_lock_x_lock_func_nowait(
/*=======================*/
rw_lock_t* lock, /*!< in: pointer to rw-lock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
lint oldval = X_LOCK_DECR;
@@ -493,7 +493,7 @@ pfs_rw_lock_create_func(
latch_level_t level, /*!< in: level */
# endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline) /*!< in: file line where created */
+ unsigned cline) /*!< in: file line where created */
{
ut_d(new(lock) rw_lock_t());
@@ -520,7 +520,7 @@ pfs_rw_lock_x_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
if (lock->pfs_psi != NULL) {
PSI_rwlock_locker* locker;
@@ -558,7 +558,7 @@ pfs_rw_lock_x_lock_func_nowait(
rw_lock_t* lock, /*!< in: pointer to rw-lock */
const char* file_name,/*!< in: file name where lock
requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ibool ret;
@@ -617,7 +617,7 @@ pfs_rw_lock_s_lock_func(
thread to unlock */
const char* file_name,/*!< in: file name where lock
requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
if (lock->pfs_psi != NULL) {
PSI_rwlock_locker* locker;
@@ -652,7 +652,7 @@ pfs_rw_lock_sx_lock_func(
thread to unlock */
const char* file_name,/*!< in: file name where lock
requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
if (lock->pfs_psi != NULL) {
PSI_rwlock_locker* locker;
@@ -687,7 +687,7 @@ pfs_rw_lock_s_lock_low(
lock will be passed to another
thread to unlock */
const char* file_name, /*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ibool ret;
@@ -727,7 +727,7 @@ pfs_rw_lock_sx_lock_low(
lock will be passed to another
thread to unlock */
const char* file_name, /*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ibool ret;
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index 90f4604043b..fc3d90b478d 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -353,16 +354,16 @@ record */
fields of the record can change */
#define TRX_UNDO_DEL_MARK_REC 14 /* delete marking of a record; fields
do not change */
-#define TRX_UNDO_CMPL_INFO_MULT 16 /* compilation info is multiplied by
+#define TRX_UNDO_CMPL_INFO_MULT 16U /* compilation info is multiplied by
this and ORed to the type above */
-#define TRX_UNDO_UPD_EXTERN 128 /* This bit can be ORed to type_cmpl
+#define TRX_UNDO_UPD_EXTERN 128U /* This bit can be ORed to type_cmpl
to denote that we updated external
storage fields: used by purge to
free the external storage */
/* Operation type flags used in trx_undo_report_row_operation */
-#define TRX_UNDO_INSERT_OP 1
-#define TRX_UNDO_MODIFY_OP 2
+#define TRX_UNDO_INSERT_OP 1U
+#define TRX_UNDO_MODIFY_OP 2U
#ifndef UNIV_NONINL
#include "trx0rec.ic"
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index 062cac2b9ab..efae0556469 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, 2017, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2016, 2017, 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
@@ -1242,7 +1242,7 @@ struct trx_t {
read-write. */
/*------------------------------*/
#ifdef UNIV_DEBUG
- ulint start_line; /*!< Track where it was started from */
+ unsigned start_line; /*!< Track where it was started from */
const char* start_file; /*!< Filename where it was started */
#endif /* UNIV_DEBUG */
@@ -1347,8 +1347,8 @@ trx_is_started(
/* Treatment of duplicate values (trx->duplicates; for example, in inserts).
Multiple flags can be combined with bitwise OR. */
-#define TRX_DUP_IGNORE 1 /* duplicate rows are to be updated */
-#define TRX_DUP_REPLACE 2 /* duplicate rows are to be replaced */
+#define TRX_DUP_IGNORE 1U /* duplicate rows are to be updated */
+#define TRX_DUP_REPLACE 2U /* duplicate rows are to be replaced */
/** Commit node states */
diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h
index 37a53f900eb..6fd5b1ab678 100644
--- a/storage/innobase/include/trx0types.h
+++ b/storage/innobase/include/trx0types.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -62,7 +63,7 @@ is set. */
static const ib_uint32_t TRX_FORCE_ROLLBACK_ASYNC = 1 << 30;
/** Mark the transaction for forced rollback */
-static const ib_uint32_t TRX_FORCE_ROLLBACK = 1 << 31;
+static const ib_uint32_t TRX_FORCE_ROLLBACK = 1U << 31;
/** For masking out the above four flags */
static const ib_uint32_t TRX_FORCE_ROLLBACK_MASK = 0x1FFFFFFF;
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index 908fb60e956..edb018c46e2 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -302,7 +302,7 @@ definitions: */
/** The following alignment is used in memory allocations in memory heap
management to ensure correct alignment for doubles etc. */
-#define UNIV_MEM_ALIGNMENT 8
+#define UNIV_MEM_ALIGNMENT 8U
/*
DATABASE VERSION CONTROL
@@ -400,19 +400,19 @@ and 2 bits for flags. This limits the uncompressed page size to 16k.
#define UNIV_PAGE_SSIZE_ORIG (UNIV_PAGE_SIZE_SHIFT_ORIG - 9)
/** Minimum page size InnoDB currently supports. */
-#define UNIV_PAGE_SIZE_MIN (1 << UNIV_PAGE_SIZE_SHIFT_MIN)
+#define UNIV_PAGE_SIZE_MIN (1U << UNIV_PAGE_SIZE_SHIFT_MIN)
/** Maximum page size InnoDB currently supports. */
-#define UNIV_PAGE_SIZE_MAX (1 << UNIV_PAGE_SIZE_SHIFT_MAX)
+#define UNIV_PAGE_SIZE_MAX (1U << UNIV_PAGE_SIZE_SHIFT_MAX)
/** Default page size for InnoDB tablespaces. */
-#define UNIV_PAGE_SIZE_DEF (1 << UNIV_PAGE_SIZE_SHIFT_DEF)
+#define UNIV_PAGE_SIZE_DEF (1U << UNIV_PAGE_SIZE_SHIFT_DEF)
/** Original 16k page size for InnoDB tablespaces. */
-#define UNIV_PAGE_SIZE_ORIG (1 << UNIV_PAGE_SIZE_SHIFT_ORIG)
+#define UNIV_PAGE_SIZE_ORIG (1U << UNIV_PAGE_SIZE_SHIFT_ORIG)
/** Smallest compressed page size */
-#define UNIV_ZIP_SIZE_MIN (1 << UNIV_ZIP_SIZE_SHIFT_MIN)
+#define UNIV_ZIP_SIZE_MIN (1U << UNIV_ZIP_SIZE_SHIFT_MIN)
/** Largest compressed page size */
-#define UNIV_ZIP_SIZE_MAX (1 << UNIV_ZIP_SIZE_SHIFT_MAX)
+#define UNIV_ZIP_SIZE_MAX (1U << UNIV_ZIP_SIZE_SHIFT_MAX)
/** Largest possible ssize for an uncompressed page.
(The convention 'ssize' is used for 'log2 minus 9' or the number of
@@ -584,7 +584,7 @@ contains the sum of the following flag and the locally stored len. */
/* Tell the compiler that 'expr' probably evaluates to 'constant'. */
# define UNIV_EXPECT(expr,constant) __builtin_expect(expr, constant)
/* Tell the compiler that a pointer is likely to be NULL */
-# define UNIV_LIKELY_NULL(ptr) __builtin_expect((ulint) ptr, 0)
+# define UNIV_LIKELY_NULL(ptr) __builtin_expect((ptr) != 0, 0)
/* Minimize cache-miss latency by moving data at addr into a cache before
it is read. */
# define UNIV_PREFETCH_R(addr) __builtin_prefetch(addr, 0, 3)
diff --git a/storage/innobase/include/ut0dbg.h b/storage/innobase/include/ut0dbg.h
index 1a61ed84a38..7d212dfcff4 100644
--- a/storage/innobase/include/ut0dbg.h
+++ b/storage/innobase/include/ut0dbg.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -43,7 +44,7 @@ ut_dbg_assertion_failed(
/*====================*/
const char* expr, /*!< in: the failed assertion */
const char* file, /*!< in: source file containing the assertion */
- ulint line) /*!< in: line number of the assertion */
+ unsigned line) /*!< in: line number of the assertion */
UNIV_COLD MY_ATTRIBUTE((nonnull(2), noreturn));
/** Abort execution if EXPR does not evaluate to nonzero.
@@ -51,13 +52,13 @@ ut_dbg_assertion_failed(
#define ut_a(EXPR) do { \
if (UNIV_UNLIKELY(!(ulint) (EXPR))) { \
ut_dbg_assertion_failed(#EXPR, \
- __FILE__, (ulint) __LINE__); \
+ __FILE__, __LINE__); \
} \
} while (0)
/** Abort execution. */
#define ut_error \
- ut_dbg_assertion_failed(0, __FILE__, (ulint) __LINE__)
+ ut_dbg_assertion_failed(0, __FILE__, __LINE__)
#ifdef UNIV_DEBUG
/** Debug assertion. Does nothing unless UNIV_DEBUG is defined. */
diff --git a/storage/innobase/include/ut0mem.ic b/storage/innobase/include/ut0mem.ic
index 224ff98b0f4..df04449bcb9 100644
--- a/storage/innobase/include/ut0mem.ic
+++ b/storage/innobase/include/ut0mem.ic
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -118,15 +119,15 @@ ut_raw_to_hex(
#define MK_UINT16(a, b) (((uint16) (a)) << 8 | (uint16) (b))
-#define UINT16_GET_A(u) ((unsigned char) ((u) >> 8))
-#define UINT16_GET_B(u) ((unsigned char) ((u) & 0xFF))
+#define UINT16_GET_A(u) ((char) ((u) >> 8))
+#define UINT16_GET_B(u) ((char) ((u) & 0xFF))
#else /* WORDS_BIGENDIAN */
#define MK_UINT16(a, b) (((uint16) (b)) << 8 | (uint16) (a))
-#define UINT16_GET_A(u) ((unsigned char) ((u) & 0xFF))
-#define UINT16_GET_B(u) ((unsigned char) ((u) >> 8))
+#define UINT16_GET_A(u) ((char) ((u) & 0xFF))
+#define UINT16_GET_B(u) ((char) ((u) >> 8))
#endif /* WORDS_BIGENDIAN */
diff --git a/storage/innobase/include/ut0mutex.h b/storage/innobase/include/ut0mutex.h
index 354fd9e0a7a..bd3603ad4d0 100644
--- a/storage/innobase/include/ut0mutex.h
+++ b/storage/innobase/include/ut0mutex.h
@@ -78,19 +78,22 @@ typedef BlockSyncArrayMutex ib_bpmutex_t;
extern uint srv_spin_wait_delay;
extern ulong srv_n_spin_wait_rounds;
-#define mutex_create(I, M) mutex_init((M), (I), __FILE__, __LINE__)
+#define mutex_create(I, M) mutex_init((M), (I), \
+ __FILE__, __LINE__)
-#define mutex_enter(M) (M)->enter( \
- srv_n_spin_wait_rounds, \
- srv_spin_wait_delay, \
- __FILE__, __LINE__)
+#define mutex_enter_loc(M,file,line) (M)->enter( \
+ uint32_t(srv_n_spin_wait_rounds), \
+ uint32_t(srv_spin_wait_delay), \
+ file, line)
+#define mutex_enter(M) mutex_enter_loc(M, __FILE__, __LINE__)
#define mutex_enter_nospin(M) (M)->enter( \
0, \
0, \
- __FILE__, __LINE__)
+ __FILE__, uint32_t(__LINE__))
-#define mutex_enter_nowait(M) (M)->trylock(__FILE__, __LINE__)
+#define mutex_enter_nowait(M) (M)->trylock(__FILE__, \
+ uint32_t(__LINE__))
#define mutex_exit(M) (M)->exit()
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 3916bf9961f..11c1bedd39a 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2016, MariaDB Corporation
+Copyright (c) 2014, 2017, 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
@@ -1109,7 +1109,7 @@ lock_rec_reset_nth_bit(
ut_ad(i < lock->un_member.rec_lock.n_bits);
byte* b = reinterpret_cast<byte*>(&lock[1]) + (i >> 3);
- byte mask = 1 << (i & 7);
+ byte mask = static_cast<byte>(1U << (i & 7));
byte bit = *b & mask;
*b &= ~mask;
@@ -1717,7 +1717,7 @@ RecLock::lock_alloc(
/* Setup the lock attributes */
- lock->type_mode = LOCK_REC | (mode & ~LOCK_TYPE_MASK);
+ lock->type_mode = uint32_t(LOCK_REC | (mode & ~LOCK_TYPE_MASK));
lock_rec_t& rec_lock = lock->un_member.rec_lock;
diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc
index ff793821895..d067bbaa803 100644
--- a/storage/innobase/mem/mem0mem.cc
+++ b/storage/innobase/mem/mem0mem.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -272,7 +273,7 @@ mem_heap_create_block_func(
ulint n, /*!< in: number of bytes needed for user data */
#ifdef UNIV_DEBUG
const char* file_name,/*!< in: file name where created */
- ulint line, /*!< in: line where created */
+ unsigned line, /*!< in: line where created */
#endif /* UNIV_DEBUG */
ulint type) /*!< in: type of heap: MEM_HEAP_DYNAMIC or
MEM_HEAP_BUFFER */
diff --git a/storage/innobase/mtr/mtr0log.cc b/storage/innobase/mtr/mtr0log.cc
index a63ad40a3b0..783fdcd05ac 100644
--- a/storage/innobase/mtr/mtr0log.cc
+++ b/storage/innobase/mtr/mtr0log.cc
@@ -101,7 +101,7 @@ mlog_parse_initial_log_record(
return(NULL);
}
- *type = (mlog_id_t)((ulint)*ptr & ~MLOG_SINGLE_REC_FLAG);
+ *type = mlog_id_t(*ptr & ~MLOG_SINGLE_REC_FLAG);
ut_ad(*type <= MLOG_BIGGEST_TYPE || EXTRA_CHECK_MLOG_NUMBER(*type));
ptr++;
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 418cd7042c6..c19d2131d1e 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -124,11 +124,11 @@ struct FindPage
/* There must be some flags to look for. */
ut_ad(flags);
/* We can only look for page-related flags. */
- ut_ad(!(flags & ~(MTR_MEMO_PAGE_S_FIX
- | MTR_MEMO_PAGE_X_FIX
- | MTR_MEMO_PAGE_SX_FIX
- | MTR_MEMO_BUF_FIX
- | MTR_MEMO_MODIFY)));
+ ut_ad(!(flags & ulint(~(MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_SX_FIX
+ | MTR_MEMO_BUF_FIX
+ | MTR_MEMO_MODIFY))));
}
/** Visit a memo entry.
@@ -680,7 +680,7 @@ NOTE: use mtr_x_lock_space().
@param[in] line line number in file
@return the tablespace object (never NULL) */
fil_space_t*
-mtr_t::x_lock_space(ulint space_id, const char* file, ulint line)
+mtr_t::x_lock_space(ulint space_id, const char* file, unsigned line)
{
fil_space_t* space;
@@ -1053,14 +1053,14 @@ struct FlaggedCheck {
/* There must be some flags to look for. */
ut_ad(flags);
/* Look for rw-lock-related and page-related flags. */
- ut_ad(!(flags & ~(MTR_MEMO_PAGE_S_FIX
- | MTR_MEMO_PAGE_X_FIX
- | MTR_MEMO_PAGE_SX_FIX
- | MTR_MEMO_BUF_FIX
- | MTR_MEMO_MODIFY
- | MTR_MEMO_X_LOCK
- | MTR_MEMO_SX_LOCK
- | MTR_MEMO_S_LOCK)));
+ ut_ad(!(flags & ulint(~(MTR_MEMO_PAGE_S_FIX
+ | MTR_MEMO_PAGE_X_FIX
+ | MTR_MEMO_PAGE_SX_FIX
+ | MTR_MEMO_BUF_FIX
+ | MTR_MEMO_MODIFY
+ | MTR_MEMO_X_LOCK
+ | MTR_MEMO_SX_LOCK
+ | MTR_MEMO_S_LOCK))));
/* Either some rw-lock-related or page-related flags
must be specified, but not both at the same time. */
ut_ad(!(flags & (MTR_MEMO_PAGE_S_FIX
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index e4bc2754b40..f71602c43b9 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -366,7 +366,7 @@ public:
void print(FILE* file);
/** @return the number of slots per segment */
- ulint slots_per_segment() const
+ unsigned slots_per_segment() const
MY_ATTRIBUTE((warn_unused_result))
{
return(m_slots.size() / m_n_segments);
@@ -437,7 +437,7 @@ public:
@param[in] max_events number of events
@param[out] io_ctx io_ctx to initialize.
@return true on success. */
- static bool linux_create_io_ctx(ulint max_events, io_context_t* io_ctx)
+ static bool linux_create_io_ctx(unsigned max_events, io_context_t* io_ctx)
MY_ATTRIBUTE((warn_unused_result));
/** Checks if the system supports native linux aio. On some kernel
@@ -2129,7 +2129,7 @@ AIO::linux_dispatch(Slot* slot)
@return true on success. */
bool
AIO::linux_create_io_ctx(
- ulint max_events,
+ unsigned max_events,
io_context_t* io_ctx)
{
ssize_t n_retries = 0;
@@ -2907,8 +2907,8 @@ os_file_create_func(
on_error_silent = create_mode & OS_FILE_ON_ERROR_SILENT
? true : false;
- create_mode &= ~OS_FILE_ON_ERROR_NO_EXIT;
- create_mode &= ~OS_FILE_ON_ERROR_SILENT;
+ create_mode &= ulint(~(OS_FILE_ON_ERROR_NO_EXIT
+ | OS_FILE_ON_ERROR_SILENT));
if (create_mode == OS_FILE_OPEN
|| create_mode == OS_FILE_OPEN_RAW
@@ -5759,7 +5759,7 @@ AIO::init_linux_native_aio()
}
io_context** ctx = m_aio_ctx;
- ulint max_events = slots_per_segment();
+ unsigned max_events = slots_per_segment();
for (ulint i = 0; i < m_n_segments; ++i, ++ctx) {
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index e2d2dd40fd8..d38b426b0d4 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -2,6 +2,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2017, 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
@@ -1162,8 +1163,7 @@ delete_all:
if (scrub) {
/* scrub record */
- uint recsize = rec_offs_data_size(offsets);
- memset(rec2, 0, recsize);
+ memset(rec2, 0, rec_offs_data_size(offsets));
}
rec2 = page_rec_get_next(rec2);
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index d49cecdb968..c0746bd9d5f 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -2,6 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
+Copyright (c) 2017, 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
@@ -1595,9 +1596,9 @@ err_exit:
#ifdef UNIV_DEBUG
page_zip->m_start =
#endif /* UNIV_DEBUG */
- page_zip->m_end = PAGE_DATA + c_stream.total_out;
+ page_zip->m_end = unsigned(PAGE_DATA + c_stream.total_out);
page_zip->m_nonempty = FALSE;
- page_zip->n_blobs = n_blobs;
+ page_zip->n_blobs = unsigned(n_blobs);
/* Copy those header fields that will not be written
in buf_flush_init_for_writing() */
memcpy(page_zip->data + FIL_PAGE_PREV, page + FIL_PAGE_PREV,
@@ -1714,7 +1715,7 @@ page_zip_fields_decode(
index = dict_mem_index_create("ZIP_DUMMY", "ZIP_DUMMY",
DICT_HDR_SPACE, 0, n);
index->table = table;
- index->n_uniq = n;
+ index->n_uniq = unsigned(n);
/* avoid ut_ad(index->cached) in dict_index_get_n_unique_in_tree */
index->cached = TRUE;
@@ -1773,7 +1774,7 @@ page_zip_fields_decode(
page_zip_fields_free(index);
index = NULL;
} else {
- index->n_nullable = val;
+ index->n_nullable = unsigned(val);
}
}
@@ -2429,7 +2430,7 @@ zlib_done:
}
#ifdef UNIV_DEBUG
- page_zip->m_start = PAGE_DATA + d_stream->total_in;
+ page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in);
#endif /* UNIV_DEBUG */
/* Apply the modification log. */
@@ -2444,7 +2445,7 @@ zlib_done:
if (UNIV_UNLIKELY(!mod_log_ptr)) {
return(FALSE);
}
- page_zip->m_end = mod_log_ptr - page_zip->data;
+ page_zip->m_end = unsigned(mod_log_ptr - page_zip->data);
page_zip->m_nonempty = mod_log_ptr != d_stream->next_in;
}
@@ -2582,9 +2583,7 @@ zlib_done:
- d_stream->next_out);
}
-#ifdef UNIV_DEBUG
- page_zip->m_start = PAGE_DATA + d_stream->total_in;
-#endif /* UNIV_DEBUG */
+ ut_d(page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in));
/* Apply the modification log. */
{
@@ -2598,7 +2597,7 @@ zlib_done:
if (UNIV_UNLIKELY(!mod_log_ptr)) {
return(FALSE);
}
- page_zip->m_end = mod_log_ptr - page_zip->data;
+ page_zip->m_end = unsigned(mod_log_ptr - page_zip->data);
page_zip->m_nonempty = mod_log_ptr != d_stream->next_in;
}
@@ -2913,9 +2912,7 @@ zlib_done:
- d_stream->next_out);
}
-#ifdef UNIV_DEBUG
- page_zip->m_start = PAGE_DATA + d_stream->total_in;
-#endif /* UNIV_DEBUG */
+ ut_d(page_zip->m_start = unsigned(PAGE_DATA + d_stream->total_in));
/* Apply the modification log. */
{
@@ -2929,7 +2926,7 @@ zlib_done:
if (UNIV_UNLIKELY(!mod_log_ptr)) {
return(FALSE);
}
- page_zip->m_end = mod_log_ptr - page_zip->data;
+ page_zip->m_end = unsigned(mod_log_ptr - page_zip->data);
page_zip->m_nonempty = mod_log_ptr != d_stream->next_in;
}
@@ -3132,7 +3129,7 @@ zlib_error:
d_stream.avail_in = static_cast<uInt>(
page_zip_get_size(page_zip) - (PAGE_DATA + 1));
d_stream.next_out = page + PAGE_ZIP_START;
- d_stream.avail_out = UNIV_PAGE_SIZE - PAGE_ZIP_START;
+ d_stream.avail_out = uInt(UNIV_PAGE_SIZE - PAGE_ZIP_START);
if (UNIV_UNLIKELY(inflateInit2(&d_stream, UNIV_PAGE_SIZE_SHIFT)
!= Z_OK)) {
@@ -3853,7 +3850,7 @@ page_zip_write_rec(
ut_a(!*data);
ut_ad((ulint) (data - page_zip->data) < page_zip_get_size(page_zip));
- page_zip->m_end = data - page_zip->data;
+ page_zip->m_end = unsigned(data - page_zip->data);
page_zip->m_nonempty = TRUE;
#ifdef UNIV_ZIP_DEBUG
@@ -4919,7 +4916,7 @@ page_zip_calc_checksum(
srv_checksum_algorithm_t algo,
bool use_legacy_big_endian /* = false */)
{
- uint32_t adler;
+ uLong adler;
const Bytef* s = static_cast<const byte*>(data);
/* Exclude FIL_PAGE_SPACE_OR_CHKSUM, FIL_PAGE_LSN,
@@ -4959,7 +4956,7 @@ page_zip_calc_checksum(
static_cast<uInt>(size)
- FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
- return(adler);
+ return(uint32_t(adler));
case SRV_CHECKSUM_ALGORITHM_NONE:
case SRV_CHECKSUM_ALGORITHM_STRICT_NONE:
return(BUF_NO_CHECKSUM_MAGIC);
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index 920fdb62079..d79b25a35a7 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -549,7 +550,7 @@ rec_get_offsets_func(
(ULINT_UNDEFINED if all fields) */
#ifdef UNIV_DEBUG
const char* file, /*!< in: file name where called */
- ulint line, /*!< in: line number where called */
+ unsigned line, /*!< in: line number where called */
#endif /* UNIV_DEBUG */
mem_heap_t** heap) /*!< in/out: memory heap */
{
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 1f884017dd3..db8a91ed21e 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2016, MariaDB Corporation.
+Copyright (c) 2016, 2017, 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
@@ -2836,7 +2836,7 @@ row_ins_sec_index_entry_low(
rtr_info_update_btr(&cursor, &rtr_info);
mtr_start(&mtr);
mtr.set_named_space(index->space);
- search_mode &= ~BTR_MODIFY_LEAF;
+ search_mode &= ulint(~BTR_MODIFY_LEAF);
search_mode |= BTR_MODIFY_TREE;
err = btr_cur_search_to_nth_level(
index, 0, entry, PAGE_CUR_RTREE_INSERT,
@@ -3086,7 +3086,7 @@ row_ins_index_entry_big_rec_func(
#ifndef DBUG_OFF
const void* thd, /*!< in: connection, or NULL */
#endif /* DBUG_OFF */
- ulint line) /*!< in: line number of caller */
+ unsigned line) /*!< in: line number of caller */
{
mtr_t mtr;
btr_pcur_t pcur;
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 8fc7ecf75ac..ef832c38b95 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -4511,7 +4511,7 @@ row_merge_create_index(
/*********************************************************************//**
Check if a transaction can use an index. */
-ibool
+bool
row_merge_is_index_usable(
/*======================*/
const trx_t* trx, /*!< in: transaction */
@@ -4520,7 +4520,7 @@ row_merge_is_index_usable(
if (!dict_index_is_clust(index)
&& dict_index_is_online_ddl(index)) {
/* Indexes that are being created are not useable. */
- return(FALSE);
+ return(false);
}
return(!dict_index_is_corrupted(index)
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index fbf49d8d3a0..ab5736f88d7 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2344,7 +2344,7 @@ row_mysql_freeze_data_dictionary_func(
/*==================================*/
trx_t* trx, /*!< in/out: transaction */
const char* file, /*!< in: file name */
- ulint line) /*!< in: line number */
+ unsigned line) /*!< in: line number */
{
ut_a(trx->dict_operation_lock_mode == 0);
@@ -2377,7 +2377,7 @@ row_mysql_lock_data_dictionary_func(
/*================================*/
trx_t* trx, /*!< in/out: transaction */
const char* file, /*!< in: file name */
- ulint line) /*!< in: line number */
+ unsigned line) /*!< in: line number */
{
ut_a(trx->dict_operation_lock_mode == 0
|| trx->dict_operation_lock_mode == RW_X_LATCH);
diff --git a/storage/innobase/row/row0trunc.cc b/storage/innobase/row/row0trunc.cc
index b8002b439da..2402b4807ba 100644
--- a/storage/innobase/row/row0trunc.cc
+++ b/storage/innobase/row/row0trunc.cc
@@ -1558,7 +1558,7 @@ row_truncate_update_system_tables(
fts_update_next_doc_id(trx, table, NULL, 0);
fts_cache_clear(table->fts->cache);
fts_cache_init(table->fts->cache);
- table->fts->fts_status &= ~TABLE_DICT_LOCKED;
+ table->fts->fts_status &= uint(~TABLE_DICT_LOCKED);
}
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 65991a711a3..46d3a7aff0e 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -1319,7 +1319,7 @@ srv_init_abort_low(
bool create_new_db,
#ifdef UNIV_DEBUG
const char* file,
- ulint line,
+ unsigned line,
#endif /* UNIV_DEBUG */
dberr_t err)
{
diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc
index c9423a04fba..1b561dc3297 100644
--- a/storage/innobase/sync/sync0arr.cc
+++ b/storage/innobase/sync/sync0arr.cc
@@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
-Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved.
+Copyright (c) 2013, 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -117,7 +117,7 @@ struct sync_cell_t {
const char* file; /*!< in debug version file where
requested */
ulint line; /*!< in debug version line where
- requested */
+ requested, or ULINT_UNDEFINED */
os_thread_id_t thread_id; /*!< thread id of this waiting
thread */
bool waiting; /*!< TRUE if the thread has already
@@ -213,24 +213,16 @@ sync_array_t::sync_array_t(ulint num_cells)
UNIV_NOTHROW
:
n_reserved(),
- n_cells(),
- array(),
+ n_cells(num_cells),
+ array(UT_NEW_ARRAY_NOKEY(sync_cell_t, num_cells)),
mutex(),
res_count(),
next_free_slot(),
- first_free_slot()
+ first_free_slot(ULINT_UNDEFINED)
{
ut_a(num_cells > 0);
- array = UT_NEW_ARRAY_NOKEY(sync_cell_t, num_cells);
-
- ulint sz = sizeof(sync_cell_t) * num_cells;
-
- memset(array, 0x0, sz);
-
- n_cells = num_cells;
-
- first_free_slot = ULINT_UNDEFINED;
+ memset(array, 0x0, sizeof(sync_cell_t) * n_cells);
/* Then create the mutex to protect the wait array */
mutex_create(LATCH_ID_SYNC_ARRAY_MUTEX, &mutex);
@@ -344,7 +336,7 @@ sync_array_reserve_cell(
void* object, /*!< in: pointer to the object to wait for */
ulint type, /*!< in: lock request type */
const char* file, /*!< in: file where requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
sync_cell_t* cell;
@@ -604,15 +596,15 @@ sync_array_cell_print(
fprintf(file,
"number of readers %lu, waiters flag %lu,"
" lock_word: %lx\n"
- "Last time read locked in file %s line %lu\n"
- "Last time write locked in file %s line %lu\n",
+ "Last time read locked in file %s line %u\n"
+ "Last time write locked in file %s line %u\n",
(ulint) rw_lock_get_reader_count(rwlock),
(ulint) rwlock->waiters,
rwlock->lock_word,
innobase_basename(rwlock->last_s_file_name),
- (ulint) rwlock->last_s_line,
+ rwlock->last_s_line,
rwlock->last_x_file_name,
- (ulint) rwlock->last_x_line);
+ rwlock->last_x_line);
/* JAN: TODO: FIX LATER
fprintf(file,
@@ -1339,7 +1331,8 @@ sync_arr_fill_sys_semphore_waits_table(
(longlong)os_thread_pf(cell->thread)));
*/
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_FILE], innobase_basename(cell->file)));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LINE], cell->line));
+ OK(fields[SYS_SEMAPHORE_WAITS_LINE]->store(cell->line, true));
+ fields[SYS_SEMAPHORE_WAITS_LINE]->set_notnull();
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAIT_TIME], (ulint)difftime(time(NULL), cell->reservation_time)));
if (type == SYNC_MUTEX) {
@@ -1352,13 +1345,16 @@ sync_arr_fill_sys_semphore_waits_table(
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_WAIT_TYPE], "MUTEX"));
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)mutex->thread_id));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(mutex->file_name)));
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE], mutex->line));
+ //OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(mutex->line, true));
+ //fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull();
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_CREATED_FILE], innobase_basename(mutex->cfile_name)));
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_CREATED_LINE], mutex->cline));
+ //OK(fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->store(mutex->cline, true));
+ //fields[SYS_SEMAPHORE_WAITS_CREATED_LINE]->set_notnull();
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], (longlong)mutex->waiters));
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], (longlong)mutex->lock_word));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(mutex->file_name)));
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE], mutex->line));
+ //OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(mutex->line, true));
+ //fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], mutex->count_os_wait));
}
} else if (type == RW_LOCK_X_WAIT
@@ -1398,14 +1394,17 @@ sync_arr_fill_sys_semphore_waits_table(
//OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_THREAD_ID], (longlong)rwlock->thread_id));
//OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_HOLDER_FILE], innobase_basename(rwlock->file_name)));
- //OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE], rwlock->line));
+ //OK(fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->store(rwlock->line, true));
+ //fields[SYS_SEMAPHORE_WAITS_HOLDER_LINE]->set_notnull();
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_READERS], rw_lock_get_reader_count(rwlock)));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_WAITERS_FLAG], (longlong)rwlock->waiters));
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LOCK_WORD], (longlong)rwlock->lock_word));
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_READER_FILE], innobase_basename(rwlock->last_s_file_name)));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE], rwlock->last_s_line));
+ OK(fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->store(rwlock->last_s_line, true));
+ fields[SYS_SEMAPHORE_WAITS_LAST_READER_LINE]->set_notnull();
OK(field_store_string(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_FILE], innobase_basename(rwlock->last_x_file_name)));
- OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE], rwlock->last_x_line));
+ OK(fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->store(rwlock->last_x_line, true));
+ fields[SYS_SEMAPHORE_WAITS_LAST_WRITER_LINE]->set_notnull();
OK(field_store_ulint(fields[SYS_SEMAPHORE_WAITS_OS_WAIT_COUNT], rwlock->count_os_wait));
}
}
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index 9160d9c8bee..497f7f3f9e9 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -2,6 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
+Copyright (c) 2017, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -203,7 +204,7 @@ rw_lock_create_func(
latch_level_t level, /*!< in: level */
#endif /* UNIV_DEBUG */
const char* cfile_name, /*!< in: file name where created */
- ulint cline) /*!< in: file line where created */
+ unsigned cline) /*!< in: file line where created */
{
#if defined(UNIV_DEBUG) && !defined(UNIV_PFS_RWLOCK)
/* It should have been created in pfs_rw_lock_create_func() */
@@ -236,7 +237,7 @@ rw_lock_create_func(
split the source file anyway. Or create the locks on lines
less than 8192. cline is unsigned:13. */
ut_ad(cline <= 8192);
- lock->cline = (unsigned int) cline;
+ lock->cline = cline;
lock->count_os_wait = 0;
lock->last_s_file_name = "not yet reserved";
lock->last_x_file_name = "not yet reserved";
@@ -295,7 +296,7 @@ rw_lock_s_lock_spin(
ulint pass, /*!< in: pass value; != 0, if the lock
will be passed to another thread to unlock */
const char* file_name, /*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ulint i = 0; /* spin round count */
sync_array_t* sync_arr;
@@ -425,7 +426,7 @@ rw_lock_x_lock_wait_func(
#endif
lint threshold,/*!< in: threshold to wait for */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ulint i = 0;
ulint n_spins = 0;
@@ -520,7 +521,7 @@ rw_lock_x_lock_low(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
if (rw_lock_lock_word_decr(lock, X_LOCK_DECR, X_LOCK_HALF_DECR)) {
@@ -578,7 +579,7 @@ rw_lock_x_lock_low(
ut_d(rw_lock_add_debug_info(lock, pass, RW_LOCK_X, file_name, line));
lock->last_x_file_name = file_name;
- lock->last_x_line = (unsigned int) line;
+ lock->last_x_line = line;
return(TRUE);
}
@@ -593,7 +594,7 @@ rw_lock_sx_lock_low(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
if (rw_lock_lock_word_decr(lock, X_LOCK_HALF_DECR, X_LOCK_HALF_DECR)) {
@@ -652,7 +653,7 @@ rw_lock_sx_lock_low(
ut_d(rw_lock_add_debug_info(lock, pass, RW_LOCK_SX, file_name, line));
lock->last_x_file_name = file_name;
- lock->last_x_line = (unsigned int) line;
+ lock->last_x_line = line;
return(TRUE);
}
@@ -673,7 +674,7 @@ rw_lock_x_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ulint i = 0;
sync_array_t* sync_arr;
@@ -775,7 +776,7 @@ rw_lock_sx_lock_func(
ulint pass, /*!< in: pass value; != 0, if the lock will
be passed to another thread to unlock */
const char* file_name,/*!< in: file name where lock requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ulint i = 0;
@@ -928,7 +929,7 @@ rw_lock_add_debug_info(
ulint pass, /*!< in: pass value */
ulint lock_type, /*!< in: lock type */
const char* file_name, /*!< in: file where requested */
- ulint line) /*!< in: line where requested */
+ unsigned line) /*!< in: line where requested */
{
ut_ad(file_name != NULL);
diff --git a/storage/innobase/ut/ut0dbg.cc b/storage/innobase/ut/ut0dbg.cc
index ed4a7778afa..fff1f0e6687 100644
--- a/storage/innobase/ut/ut0dbg.cc
+++ b/storage/innobase/ut/ut0dbg.cc
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, 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
@@ -34,10 +35,10 @@ ut_dbg_assertion_failed(
/*====================*/
const char* expr, /*!< in: the failed assertion (optional) */
const char* file, /*!< in: source file containing the assertion */
- ulint line) /*!< in: line number of the assertion */
+ unsigned line) /*!< in: line number of the assertion */
{
ut_print_timestamp(stderr);
- fprintf(stderr, " InnoDB: Assertion failure in file %s line %lu\n",
+ fprintf(stderr, " InnoDB: Assertion failure in file %s line %u\n",
file, line);
if (expr) {
fprintf(stderr,
diff --git a/storage/maria/ma_blockrec.h b/storage/maria/ma_blockrec.h
index 3ea1fedf237..c33dfa0d5ea 100644
--- a/storage/maria/ma_blockrec.h
+++ b/storage/maria/ma_blockrec.h
@@ -50,8 +50,8 @@
#define SUB_RANGE_SIZE 2
#define BLOCK_FILLER_SIZE 2
#define ROW_EXTENT_SIZE (ROW_EXTENT_PAGE_SIZE + ROW_EXTENT_COUNT_SIZE)
-#define TAIL_BIT 0x8000 /* Bit in page_count to signify tail */
-#define START_EXTENT_BIT 0x4000 /* Bit in page_count to signify start*/
+#define TAIL_BIT 0x8000U /* Bit in page_count to signify tail */
+#define START_EXTENT_BIT 0x4000U /* Bit in page_count to signify start*/
/* page_count set by bitmap code for tail pages */
#define TAIL_PAGE_COUNT_MARKER 0xffff
/* Number of extents reserved MARIA_BITMAP_BLOCKS to store head part */
@@ -75,7 +75,7 @@
#define PAGE_TYPE_MASK 7
enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_TYPE };
-#define PAGE_CAN_BE_COMPACTED 128 /* Bit in PAGE_TYPE */
+#define PAGE_CAN_BE_COMPACTED 128U /* Bit in PAGE_TYPE */
#define PAGE_TYPE_OFFSET LSN_SIZE
#define DIR_COUNT_OFFSET (LSN_SIZE+PAGE_TYPE_SIZE)
@@ -86,12 +86,12 @@ enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_
#define FULL_PAGE_KEY_VERSION_OFFSET (PAGE_TYPE_OFFSET + PAGE_TYPE_SIZE)
/* Bits used for flag uchar (one byte, first in record) */
-#define ROW_FLAG_TRANSID 1
-#define ROW_FLAG_VER_PTR 2
-#define ROW_FLAG_DELETE_TRANSID 4
-#define ROW_FLAG_NULLS_EXTENDED 8
-#define ROW_FLAG_EXTENTS 128
-#define ROW_FLAG_ALL (1+2+4+8+128)
+#define ROW_FLAG_TRANSID 1U
+#define ROW_FLAG_VER_PTR 2U
+#define ROW_FLAG_DELETE_TRANSID 4U
+#define ROW_FLAG_NULLS_EXTENDED 8U
+#define ROW_FLAG_EXTENTS 128U
+#define ROW_FLAG_ALL (1U+2U+4U+8U+128U)
/* Size for buffer to hold information about bitmap */
#define MAX_BITMAP_INFO_LENGTH ((MARIA_MAX_KEY_BLOCK_LENGTH*8/3)*(61*11/60)+10)
@@ -99,8 +99,8 @@ enum en_page_type { UNALLOCATED_PAGE, HEAD_PAGE, TAIL_PAGE, BLOB_PAGE, MAX_PAGE_
/******** Variables that affects how data pages are utilized ********/
-/* Minium size of tail segment */
-#define MIN_TAIL_SIZE 32
+/* Minimum size of tail segment */
+#define MIN_TAIL_SIZE 32U
/*
Fixed length part of Max possible header size; See row data structure
diff --git a/storage/maria/ma_loghandler.h b/storage/maria/ma_loghandler.h
index 5ac6d67413a..3719ec5e666 100644
--- a/storage/maria/ma_loghandler.h
+++ b/storage/maria/ma_loghandler.h
@@ -33,9 +33,9 @@
We allow all kind protections to be switched on together for people who
really unsure in their hardware/OS.
*/
-#define TRANSLOG_PAGE_CRC 1
-#define TRANSLOG_SECTOR_PROTECTION (1<<1)
-#define TRANSLOG_RECORD_CRC (1<<2)
+#define TRANSLOG_PAGE_CRC 1U
+#define TRANSLOG_SECTOR_PROTECTION (1U<<1)
+#define TRANSLOG_RECORD_CRC (1U<<2)
#define TRANSLOG_FLAGS_NUM ((TRANSLOG_PAGE_CRC | TRANSLOG_SECTOR_PROTECTION | \
TRANSLOG_RECORD_CRC) + 1)
diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c
index 0c1c56dfa94..0e347cbbd47 100644
--- a/storage/maria/maria_chk.c
+++ b/storage/maria/maria_chk.c
@@ -384,13 +384,13 @@ static struct my_option my_long_options[] =
&check_param.read_buffer_length,
&check_param.read_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
- (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ ~0ULL, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "write_buffer_size", OPT_WRITE_BUFFER_SIZE,
"Write buffer size for sequential writes during repair of fixed size or dynamic size rows",
&check_param.write_buffer_length,
&check_param.write_buffer_length, 0, GET_ULONG, REQUIRED_ARG,
(long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD,
- (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0},
+ ~0UL, (long) MALLOC_OVERHEAD, (long) 1L, 0},
{ "sort_buffer_size", OPT_SORT_BUFFER_SIZE,
"Size of sort buffer. Used by --recover",
&check_param.sort_buffer_length,
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 19910f4288d..f3c66e87c46 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -710,49 +710,49 @@ struct st_maria_handler
#define F_EXTRA_LCK -1
/* bits in opt_flag */
-#define MEMMAP_USED 32
-#define REMEMBER_OLD_POS 64
+#define MEMMAP_USED 32U
+#define REMEMBER_OLD_POS 64U
-#define WRITEINFO_UPDATE_KEYFILE 1
-#define WRITEINFO_NO_UNLOCK 2
+#define WRITEINFO_UPDATE_KEYFILE 1U
+#define WRITEINFO_NO_UNLOCK 2U
/* once_flags */
-#define USE_PACKED_KEYS 1
-#define RRND_PRESERVE_LASTINX 2
+#define USE_PACKED_KEYS 1U
+#define RRND_PRESERVE_LASTINX 2U
/* bits in state.changed */
-#define STATE_CHANGED 1
-#define STATE_CRASHED 2
-#define STATE_CRASHED_ON_REPAIR 4
-#define STATE_NOT_ANALYZED 8
-#define STATE_NOT_OPTIMIZED_KEYS 16
-#define STATE_NOT_SORTED_PAGES 32
-#define STATE_NOT_OPTIMIZED_ROWS 64
-#define STATE_NOT_ZEROFILLED 128
-#define STATE_NOT_MOVABLE 256
-#define STATE_MOVED 512 /* set if base->uuid != maria_uuid */
-#define STATE_IN_REPAIR 1024 /* We are running repair on table */
-#define STATE_CRASHED_PRINTED 2048
+#define STATE_CHANGED 1U
+#define STATE_CRASHED 2U
+#define STATE_CRASHED_ON_REPAIR 4U
+#define STATE_NOT_ANALYZED 8U
+#define STATE_NOT_OPTIMIZED_KEYS 16U
+#define STATE_NOT_SORTED_PAGES 32U
+#define STATE_NOT_OPTIMIZED_ROWS 64U
+#define STATE_NOT_ZEROFILLED 128U
+#define STATE_NOT_MOVABLE 256U
+#define STATE_MOVED 512U /* set if base->uuid != maria_uuid */
+#define STATE_IN_REPAIR 1024U /* We are running repair on table */
+#define STATE_CRASHED_PRINTED 2048U
#define STATE_CRASHED_FLAGS (STATE_CRASHED | STATE_CRASHED_ON_REPAIR | STATE_CRASHED_PRINTED)
/* options to maria_read_cache */
-#define READING_NEXT 1
-#define READING_HEADER 2
+#define READING_NEXT 1U
+#define READING_HEADER 2U
/* Number of bytes on key pages to indicate used size */
-#define KEYPAGE_USED_SIZE 2
-#define KEYPAGE_KEYID_SIZE 1
-#define KEYPAGE_FLAG_SIZE 1
-#define KEYPAGE_KEY_VERSION_SIZE 4 /* encryption */
-#define KEYPAGE_CHECKSUM_SIZE 4
+#define KEYPAGE_USED_SIZE 2U
+#define KEYPAGE_KEYID_SIZE 1U
+#define KEYPAGE_FLAG_SIZE 1U
+#define KEYPAGE_KEY_VERSION_SIZE 4U /* encryption */
+#define KEYPAGE_CHECKSUM_SIZE 4U
#define MAX_KEYPAGE_HEADER_SIZE (LSN_STORE_SIZE + KEYPAGE_USED_SIZE + \
KEYPAGE_KEYID_SIZE + KEYPAGE_FLAG_SIZE + \
TRANSID_SIZE + KEYPAGE_KEY_VERSION_SIZE)
-#define KEYPAGE_FLAG_ISNOD 1
-#define KEYPAGE_FLAG_HAS_TRANSID 2
+#define KEYPAGE_FLAG_ISNOD 1U
+#define KEYPAGE_FLAG_HAS_TRANSID 2U
#define _ma_get_page_used(share,x) \
((uint) mi_uint2korr((x) + (share)->keypage_header - KEYPAGE_USED_SIZE))
@@ -886,9 +886,9 @@ struct st_maria_handler
#define MEMMAP_EXTRA_MARGIN 7 /* Write this as a suffix for file */
-#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */
-#define PACK_TYPE_SPACE_FIELDS 2
-#define PACK_TYPE_ZERO_FILL 4
+#define PACK_TYPE_SELECTED 1U /* Bits in field->pack_type */
+#define PACK_TYPE_SPACE_FIELDS 2U
+#define PACK_TYPE_ZERO_FILL 4U
#define MARIA_FOUND_WRONG_KEY 32738 /* Impossible value from ha_key_cmp */
#define MARIA_BLOCK_SIZE(key_length,data_pointer,key_pointer,block_size) (((((key_length)+(data_pointer)+(key_pointer))*4+(key_pointer)+2)/(block_size)+1)*(block_size))
@@ -911,12 +911,12 @@ extern mysql_mutex_t THR_LOCK_maria;
/* Some tuning parameters */
#define MARIA_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */
-#define MARIA_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */
+#define MARIA_MIN_SIZE_BULK_INSERT_TREE 16384U /* this is per key */
#define MARIA_MIN_ROWS_TO_USE_BULK_INSERT 100
#define MARIA_MIN_ROWS_TO_DISABLE_INDEXES 100
#define MARIA_MIN_ROWS_TO_USE_WRITE_CACHE 10
/* Keep a small buffer for tables only using small blobs */
-#define MARIA_SMALL_BLOB_BUFFER 1024
+#define MARIA_SMALL_BLOB_BUFFER 1024U
#define MARIA_MAX_CONTROL_FILE_LOCK_RETRY 30 /* Retry this many times */
/* Some extern variables */
@@ -1247,12 +1247,12 @@ typedef struct st_maria_block_info
/* bits in return from _ma_get_block_info */
-#define BLOCK_FIRST 1
-#define BLOCK_LAST 2
-#define BLOCK_DELETED 4
-#define BLOCK_ERROR 8 /* Wrong data */
-#define BLOCK_SYNC_ERROR 16 /* Right data at wrong place */
-#define BLOCK_FATAL_ERROR 32 /* hardware-error */
+#define BLOCK_FIRST 1U
+#define BLOCK_LAST 2U
+#define BLOCK_DELETED 4U
+#define BLOCK_ERROR 8U /* Wrong data */
+#define BLOCK_SYNC_ERROR 16U /* Right data at wrong place */
+#define BLOCK_FATAL_ERROR 32U /* hardware-error */
#define NEED_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */
#define MAXERR 20
@@ -1261,17 +1261,17 @@ typedef struct st_maria_block_info
#define INDEX_TMP_EXT ".TMM"
#define DATA_TMP_EXT ".TMD"
-#define UPDATE_TIME 1
-#define UPDATE_STAT 2
-#define UPDATE_SORT 4
-#define UPDATE_AUTO_INC 8
-#define UPDATE_OPEN_COUNT 16
+#define UPDATE_TIME 1U
+#define UPDATE_STAT 2U
+#define UPDATE_SORT 4U
+#define UPDATE_AUTO_INC 8U
+#define UPDATE_OPEN_COUNT 16U
/* We use MY_ALIGN_DOWN here mainly to ensure that we get stable values for mysqld --help ) */
#define PAGE_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*256L-MALLOC_OVERHEAD, 8192)
#define READ_BUFFER_INIT MY_ALIGN_DOWN(1024L*256L-MALLOC_OVERHEAD, 1024)
#define SORT_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*256L-MALLOC_OVERHEAD, 1024)
-#define MIN_SORT_BUFFER 4096
+#define MIN_SORT_BUFFER 4096U
#define fast_ma_writeinfo(INFO) if (!(INFO)->s->tot_locks) (void) _ma_writeinfo((INFO),0)
#define fast_ma_readinfo(INFO) ((INFO)->lock_type == F_UNLCK) && _ma_readinfo((INFO),F_RDLCK,1)
diff --git a/storage/myisam/myisamdef.h b/storage/myisam/myisamdef.h
index f467d44bcb9..8467daaafc3 100644
--- a/storage/myisam/myisamdef.h
+++ b/storage/myisam/myisamdef.h
@@ -1,5 +1,6 @@
/*
Copyright (c) 2000, 2012, Oracle and/or its affiliates.
+ Copyright (c) 2017, 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
@@ -92,16 +93,16 @@ typedef struct st_mi_state_info
} MI_STATE_INFO;
#define MI_STATE_INFO_SIZE (24+14*8+7*4+2*2+8)
-#define MI_STATE_KEY_SIZE 8
-#define MI_STATE_KEYBLOCK_SIZE 8
-#define MI_STATE_KEYSEG_SIZE 4
+#define MI_STATE_KEY_SIZE 8U
+#define MI_STATE_KEYBLOCK_SIZE 8U
+#define MI_STATE_KEYSEG_SIZE 4U
#define MI_STATE_EXTRA_SIZE ((MI_MAX_KEY+MI_MAX_KEY_BLOCK_SIZE)*MI_STATE_KEY_SIZE + MI_MAX_KEY*HA_MAX_KEY_SEG*MI_STATE_KEYSEG_SIZE)
#define MI_KEYDEF_SIZE (2+ 5*2)
#define MI_UNIQUEDEF_SIZE (2+1+1)
#define HA_KEYSEG_SIZE (6+ 2*2 + 4*2)
#define MI_COLUMNDEF_SIZE (2*3+1)
#define MI_BASE_INFO_SIZE (5*8 + 8*4 + 4 + 4*2 + 16)
-#define MI_INDEX_BLOCK_MARGIN 16 /* Safety margin for .MYI tables */
+#define MI_INDEX_BLOCK_MARGIN 16U /* Safety margin for .MYI tables */
typedef struct st_mi_base_info
{
@@ -311,27 +312,27 @@ struct st_myisam_info
#define USE_WHOLE_KEY (HA_MAX_KEY_BUFF*2) /* Use whole key in _mi_search() */
#define F_EXTRA_LCK -1
/* bits in opt_flag */
-#define MEMMAP_USED 32
-#define REMEMBER_OLD_POS 64
+#define MEMMAP_USED 32U
+#define REMEMBER_OLD_POS 64U
-#define WRITEINFO_UPDATE_KEYFILE 1
-#define WRITEINFO_NO_UNLOCK 2
+#define WRITEINFO_UPDATE_KEYFILE 1U
+#define WRITEINFO_NO_UNLOCK 2U
/* once_flags */
-#define USE_PACKED_KEYS 1
-#define RRND_PRESERVE_LASTINX 2
+#define USE_PACKED_KEYS 1U
+#define RRND_PRESERVE_LASTINX 2U
/* bits in state.changed */
-#define STATE_CHANGED 1
-#define STATE_CRASHED 2
-#define STATE_CRASHED_ON_REPAIR 4
-#define STATE_NOT_ANALYZED 8
-#define STATE_NOT_OPTIMIZED_KEYS 16
-#define STATE_NOT_SORTED_PAGES 32
+#define STATE_CHANGED 1U
+#define STATE_CRASHED 2U
+#define STATE_CRASHED_ON_REPAIR 4U
+#define STATE_NOT_ANALYZED 8U
+#define STATE_NOT_OPTIMIZED_KEYS 16U
+#define STATE_NOT_SORTED_PAGES 32U
/* options to mi_read_cache */
-#define READING_NEXT 1
-#define READING_HEADER 2
+#define READING_NEXT 1U
+#define READING_HEADER 2U
#define mi_getint(x) ((uint) mi_uint2korr(x) & 32767)
#define mi_putint(x,y,nod) { uint16 boh=(nod ? (uint16) 32768 : 0) + (uint16) (y);\
@@ -384,17 +385,17 @@ struct st_myisam_info
#define MI_MAX_DYN_BLOCK_HEADER 20 /* Max prefix of record-block */
#define MI_BLOCK_INFO_HEADER_LENGTH 20
#define MI_DYN_DELETE_BLOCK_HEADER 20 /* length of delete-block-header */
-#define MI_DYN_MAX_BLOCK_LENGTH ((1L << 24)-4L)
+#define MI_DYN_MAX_BLOCK_LENGTH ((1UL << 24)-4UL)
#define MI_DYN_MAX_ROW_LENGTH (MI_DYN_MAX_BLOCK_LENGTH - MI_SPLIT_LENGTH)
-#define MI_DYN_ALIGN_SIZE 4 /* Align blocks on this */
+#define MI_DYN_ALIGN_SIZE 4U /* Align blocks on this */
#define MI_MAX_DYN_HEADER_BYTE 13 /* max header byte for dynamic rows */
-#define MI_MAX_BLOCK_LENGTH ((((ulong) 1 << 24)-1) & (~ (ulong) (MI_DYN_ALIGN_SIZE-1)))
+#define MI_MAX_BLOCK_LENGTH (((1U << 24)-1) & (~(MI_DYN_ALIGN_SIZE-1)))
#define MI_REC_BUFF_OFFSET ALIGN_SIZE(MI_DYN_DELETE_BLOCK_HEADER+sizeof(uint32))
-#define PACK_TYPE_SELECTED 1 /* Bits in field->pack_type */
-#define PACK_TYPE_SPACE_FIELDS 2
-#define PACK_TYPE_ZERO_FILL 4
+#define PACK_TYPE_SELECTED 1U /* Bits in field->pack_type */
+#define PACK_TYPE_SPACE_FIELDS 2U
+#define PACK_TYPE_ZERO_FILL 4U
#define MI_FOUND_WRONG_KEY 0x7FFFFFFF /* Impossible value from ha_key_cmp */
#define MI_MAX_KEY_BLOCK_SIZE (MI_MAX_KEY_BLOCK_LENGTH/MI_MIN_KEY_BLOCK_LENGTH)
@@ -402,7 +403,7 @@ struct st_myisam_info
#define MI_MAX_KEYPTR_SIZE 5 /* For calculating block lengths */
#define MI_MIN_KEYBLOCK_LENGTH 50 /* When to split delete blocks */
-#define MI_MIN_SIZE_BULK_INSERT_TREE 16384 /* this is per key */
+#define MI_MIN_SIZE_BULK_INSERT_TREE 16384U /* this is per key */
#define MI_MIN_ROWS_TO_USE_BULK_INSERT 100
#define MI_MIN_ROWS_TO_DISABLE_INDEXES 100
#define MI_MIN_ROWS_TO_USE_WRITE_CACHE 10
@@ -609,12 +610,12 @@ typedef struct st_mi_block_info /* Parameter to _mi_get_block_info */
/* bits in return from _mi_get_block_info */
-#define BLOCK_FIRST 1
-#define BLOCK_LAST 2
-#define BLOCK_DELETED 4
-#define BLOCK_ERROR 8 /* Wrong data */
-#define BLOCK_SYNC_ERROR 16 /* Right data at wrong place */
-#define BLOCK_FATAL_ERROR 32 /* hardware-error */
+#define BLOCK_FIRST 1U
+#define BLOCK_LAST 2U
+#define BLOCK_DELETED 4U
+#define BLOCK_ERROR 8U /* Wrong data */
+#define BLOCK_SYNC_ERROR 16U /* Right data at wrong place */
+#define BLOCK_FATAL_ERROR 32U /* hardware-error */
#define NEED_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */
#define MAXERR 20
@@ -623,17 +624,17 @@ typedef struct st_mi_block_info /* Parameter to _mi_get_block_info */
#define INDEX_TMP_EXT ".TMM"
#define DATA_TMP_EXT ".TMD"
-#define UPDATE_TIME 1
-#define UPDATE_STAT 2
-#define UPDATE_SORT 4
-#define UPDATE_AUTO_INC 8
-#define UPDATE_OPEN_COUNT 16
+#define UPDATE_TIME 1U
+#define UPDATE_STAT 2U
+#define UPDATE_SORT 4U
+#define UPDATE_AUTO_INC 8U
+#define UPDATE_OPEN_COUNT 16U
/* We use MY_ALIGN_DOWN here mainly to ensure that we get stable values for mysqld --help ) */
#define KEY_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L-MALLOC_OVERHEAD, IO_SIZE)
#define READ_BUFFER_INIT MY_ALIGN_DOWN(1024L*256L-MALLOC_OVERHEAD, 1024)
#define SORT_BUFFER_INIT MY_ALIGN_DOWN(1024L*1024L*128L-MALLOC_OVERHEAD, 1024)
-#define MIN_SORT_BUFFER 4096
+#define MIN_SORT_BUFFER 4096U
enum myisam_log_commands
{
diff --git a/storage/perfschema/pfs_events_waits.h b/storage/perfschema/pfs_events_waits.h
index a7f7a095b9f..6a50134ad44 100644
--- a/storage/perfschema/pfs_events_waits.h
+++ b/storage/perfschema/pfs_events_waits.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2017, 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
@@ -97,13 +98,13 @@ struct PFS_events_waits : public PFS_events
};
/** TIMED bit in the state flags bitfield. */
-#define STATE_FLAG_TIMED (1<<0)
+#define STATE_FLAG_TIMED (1U<<0)
/** THREAD bit in the state flags bitfield. */
-#define STATE_FLAG_THREAD (1<<1)
+#define STATE_FLAG_THREAD (1U<<1)
/** EVENT bit in the state flags bitfield. */
-#define STATE_FLAG_EVENT (1<<2)
+#define STATE_FLAG_EVENT (1U<<2)
/** DIGEST bit in the state flags bitfield. */
-#define STATE_FLAG_DIGEST (1<<3)
+#define STATE_FLAG_DIGEST (1U<<3)
void insert_events_waits_history(PFS_thread *thread, PFS_events_waits *wait);
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 56dbc9ce0dc..929b9778556 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -182,32 +182,32 @@ typedef st_spider_result SPIDER_RESULT;
#define SPIDER_SQL_LCL_NAME_QUOTE_STR "`"
#define SPIDER_SQL_LCL_NAME_QUOTE_LEN (sizeof(SPIDER_SQL_LCL_NAME_QUOTE_STR) - 1)
-#define SPIDER_CONN_KIND_MYSQL (1 << 0)
+#define SPIDER_CONN_KIND_MYSQL (1U << 0)
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
-#define SPIDER_CONN_KIND_HS_READ (1 << 2)
-#define SPIDER_CONN_KIND_HS_WRITE (1 << 3)
+#define SPIDER_CONN_KIND_HS_READ (1U << 2)
+#define SPIDER_CONN_KIND_HS_WRITE (1U << 3)
#endif
-#define SPIDER_SQL_KIND_SQL (1 << 0)
-#define SPIDER_SQL_KIND_HANDLER (1 << 1)
+#define SPIDER_SQL_KIND_SQL (1U << 0)
+#define SPIDER_SQL_KIND_HANDLER (1U << 1)
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
-#define SPIDER_SQL_KIND_HS (1 << 2)
+#define SPIDER_SQL_KIND_HS (1U << 2)
#endif
-#define SPIDER_SQL_TYPE_SELECT_SQL (1 << 0)
-#define SPIDER_SQL_TYPE_INSERT_SQL (1 << 1)
-#define SPIDER_SQL_TYPE_UPDATE_SQL (1 << 2)
-#define SPIDER_SQL_TYPE_DELETE_SQL (1 << 3)
-#define SPIDER_SQL_TYPE_BULK_UPDATE_SQL (1 << 4)
-#define SPIDER_SQL_TYPE_TMP_SQL (1 << 5)
-#define SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL (1 << 6)
-#define SPIDER_SQL_TYPE_OTHER_SQL (1 << 7)
-#define SPIDER_SQL_TYPE_HANDLER (1 << 8)
-#define SPIDER_SQL_TYPE_SELECT_HS (1 << 9)
-#define SPIDER_SQL_TYPE_INSERT_HS (1 << 10)
-#define SPIDER_SQL_TYPE_UPDATE_HS (1 << 11)
-#define SPIDER_SQL_TYPE_DELETE_HS (1 << 12)
-#define SPIDER_SQL_TYPE_OTHER_HS (1 << 13)
+#define SPIDER_SQL_TYPE_SELECT_SQL (1U << 0)
+#define SPIDER_SQL_TYPE_INSERT_SQL (1U << 1)
+#define SPIDER_SQL_TYPE_UPDATE_SQL (1U << 2)
+#define SPIDER_SQL_TYPE_DELETE_SQL (1U << 3)
+#define SPIDER_SQL_TYPE_BULK_UPDATE_SQL (1U << 4)
+#define SPIDER_SQL_TYPE_TMP_SQL (1U << 5)
+#define SPIDER_SQL_TYPE_DROP_TMP_TABLE_SQL (1U << 6)
+#define SPIDER_SQL_TYPE_OTHER_SQL (1U << 7)
+#define SPIDER_SQL_TYPE_HANDLER (1U << 8)
+#define SPIDER_SQL_TYPE_SELECT_HS (1U << 9)
+#define SPIDER_SQL_TYPE_INSERT_HS (1U << 10)
+#define SPIDER_SQL_TYPE_UPDATE_HS (1U << 11)
+#define SPIDER_SQL_TYPE_DELETE_HS (1U << 12)
+#define SPIDER_SQL_TYPE_OTHER_HS (1U << 13)
enum spider_bulk_upd_start {
SPD_BU_NOT_START,