diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-03-01 08:27:39 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-03-07 19:07:27 +0200 |
commit | 89d80c1b0be94639d0913dee7b6a284c32787b09 (patch) | |
tree | a08340d45a09b067df4490259f68b5a3f9d2fa03 /storage/innobase/include | |
parent | d2f5e624223fe502ddf4c6f42062c29edb988627 (diff) | |
download | mariadb-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/innobase/include')
58 files changed, 384 insertions, 392 deletions
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() |