summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/my_base.h212
-rw-r--r--include/my_bit.h4
-rw-r--r--include/my_global.h4
-rw-r--r--include/my_pthread.h4
-rw-r--r--include/my_sys.h142
-rw-r--r--include/my_time.h13
-rw-r--r--include/my_valgrind.h4
-rw-r--r--include/myisamchk.h11
-rw-r--r--include/mysql/psi/mysql_idle.h3
-rw-r--r--include/mysql/psi/mysql_socket.h15
-rw-r--r--include/mysql/psi/mysql_statement.h3
-rw-r--r--include/mysql/psi/mysql_table.h3
-rw-r--r--include/mysql_com.h90
-rw-r--r--include/thr_lock.h7
-rw-r--r--include/typelib.h5
-rw-r--r--include/violite.h8
16 files changed, 266 insertions, 262 deletions
diff --git a/include/my_base.h b/include/my_base.h
index 84b2e28d340..89f5e826fd5 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 1995, 2012 Monty Program Ab
+ Copyright (c) 1995, 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
@@ -34,25 +34,25 @@
/* The following is bits in the flag parameter to ha_open() */
-#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */
-#define HA_OPEN_WAIT_IF_LOCKED 1
-#define HA_OPEN_IGNORE_IF_LOCKED 2
-#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */
-#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */
-#define HA_OPEN_ABORT_IF_CRASHED 16
-#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */
-#define HA_OPEN_FROM_SQL_LAYER 64
-#define HA_OPEN_MMAP 128 /* open memory mapped */
-#define HA_OPEN_COPY 256 /* Open copy (for repair) */
+#define HA_OPEN_ABORT_IF_LOCKED 0U /* default */
+#define HA_OPEN_WAIT_IF_LOCKED 1U
+#define HA_OPEN_IGNORE_IF_LOCKED 2U
+#define HA_OPEN_TMP_TABLE 4U /* Table is a temp table */
+#define HA_OPEN_DELAY_KEY_WRITE 8U /* Don't update index */
+#define HA_OPEN_ABORT_IF_CRASHED 16U
+#define HA_OPEN_FOR_REPAIR 32U /* open even if crashed */
+#define HA_OPEN_FROM_SQL_LAYER 64U
+#define HA_OPEN_MMAP 128U /* open memory mapped */
+#define HA_OPEN_COPY 256U /* Open copy (for repair) */
/* Internal temp table, used for temporary results */
-#define HA_OPEN_INTERNAL_TABLE 512
-#define HA_OPEN_NO_PSI_CALL 1024 /* Don't call/connect PSI */
-#define HA_OPEN_MERGE_TABLE 2048
+#define HA_OPEN_INTERNAL_TABLE 512U
+#define HA_OPEN_NO_PSI_CALL 1024U /* Don't call/connect PSI */
+#define HA_OPEN_MERGE_TABLE 2048U
/*
Allow opening even if table is incompatible as this is for ALTER TABLE which
will fix the table structure.
*/
-#define HA_OPEN_FOR_ALTER 4096
+#define HA_OPEN_FOR_ALTER 4096U
/* The following is parameter to ha_rkey() how to use key */
@@ -248,15 +248,15 @@ enum ha_base_keytype {
Note that these can only be up to 16 bits!
*/
-#define HA_NOSAME 1 /* Set if not dupplicated records */
-#define HA_PACK_KEY 2 /* Pack string key to previous key */
-#define HA_AUTO_KEY 16
-#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */
-#define HA_FULLTEXT 128 /* For full-text search */
-#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */
-#define HA_SPATIAL 1024 /* For spatial search */
-#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
-#define HA_GENERATED_KEY 8192 /* Automaticly generated key */
+#define HA_NOSAME 1U /* Set if not dupplicated records */
+#define HA_PACK_KEY 2U /* Pack string key to previous key */
+#define HA_AUTO_KEY 16U
+#define HA_BINARY_PACK_KEY 32U /* Packing of all keys to prev key */
+#define HA_FULLTEXT 128U /* For full-text search */
+#define HA_UNIQUE_CHECK 256U /* Check the key for uniqueness */
+#define HA_SPATIAL 1024U /* For spatial search */
+#define HA_NULL_ARE_EQUAL 2048U /* NULL in key are cmp as equal */
+#define HA_GENERATED_KEY 8192U /* Automaticly generated key */
/* The combination of the above can be used for key type comparison. */
#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
@@ -303,25 +303,25 @@ enum ha_base_keytype {
#define HA_CAN_MEMCMP 2048 /* internal, never stored in frm */
/* optionbits for database */
-#define HA_OPTION_PACK_RECORD 1
-#define HA_OPTION_PACK_KEYS 2
-#define HA_OPTION_COMPRESS_RECORD 4
-#define HA_OPTION_LONG_BLOB_PTR 8 /* new ISAM format */
-#define HA_OPTION_TMP_TABLE 16
-#define HA_OPTION_CHECKSUM 32
-#define HA_OPTION_DELAY_KEY_WRITE 64
-#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
+#define HA_OPTION_PACK_RECORD 1U
+#define HA_OPTION_PACK_KEYS 2U
+#define HA_OPTION_COMPRESS_RECORD 4U
+#define HA_OPTION_LONG_BLOB_PTR 8U /* new ISAM format */
+#define HA_OPTION_TMP_TABLE 16U
+#define HA_OPTION_CHECKSUM 32U
+#define HA_OPTION_DELAY_KEY_WRITE 64U
+#define HA_OPTION_NO_PACK_KEYS 128U /* Reserved for MySQL */
/* unused 256 */
-#define HA_OPTION_RELIES_ON_SQL_LAYER 512
-#define HA_OPTION_NULL_FIELDS 1024
-#define HA_OPTION_PAGE_CHECKSUM 2048
+#define HA_OPTION_RELIES_ON_SQL_LAYER 512U
+#define HA_OPTION_NULL_FIELDS 1024U
+#define HA_OPTION_PAGE_CHECKSUM 2048U
/*
STATS_PERSISTENT=1 has been specified in the SQL command (either CREATE
or ALTER TABLE). Table and index statistics that are collected by the
storage engine and used by the optimizer for query optimization will be
stored on disk and will not change after a server restart.
*/
-#define HA_OPTION_STATS_PERSISTENT 4096
+#define HA_OPTION_STATS_PERSISTENT 4096U
/*
STATS_PERSISTENT=0 has been specified in CREATE/ALTER TABLE. Statistics
for the table will be wiped away on server shutdown and new ones recalculated
@@ -330,31 +330,31 @@ enum ha_base_keytype {
explicitly set at table level and the corresponding table will use whatever
is the global server default.
*/
-#define HA_OPTION_NO_STATS_PERSISTENT 8192
+#define HA_OPTION_NO_STATS_PERSISTENT 8192U
/* .frm has extra create options in linked-list format */
-#define HA_OPTION_TEXT_CREATE_OPTIONS_legacy (1L << 14) /* 5.2 to 5.5, unused since 10.0 */
-#define HA_OPTION_TEMP_COMPRESS_RECORD (1L << 15) /* set by isamchk */
-#define HA_OPTION_READ_ONLY_DATA (1L << 16) /* Set by isamchk */
-#define HA_OPTION_NO_CHECKSUM (1L << 17)
-#define HA_OPTION_NO_DELAY_KEY_WRITE (1L << 18)
+#define HA_OPTION_TEXT_CREATE_OPTIONS_legacy (1U << 14) /* 5.2 to 5.5, unused since 10.0 */
+#define HA_OPTION_TEMP_COMPRESS_RECORD (1U << 15) /* set by isamchk */
+#define HA_OPTION_READ_ONLY_DATA (1U << 16) /* Set by isamchk */
+#define HA_OPTION_NO_CHECKSUM (1U << 17)
+#define HA_OPTION_NO_DELAY_KEY_WRITE (1U << 18)
/* Bits in flag to create() */
-#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */
-#define HA_PACK_RECORD 2 /* Request packed record format */
-#define HA_CREATE_TMP_TABLE 4
-#define HA_CREATE_CHECKSUM 8
-#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */
-#define HA_CREATE_PAGE_CHECKSUM 32
-#define HA_CREATE_DELAY_KEY_WRITE 64
-#define HA_CREATE_RELIES_ON_SQL_LAYER 128
-#define HA_CREATE_INTERNAL_TABLE 256
-#define HA_PRESERVE_INSERT_ORDER 512
+#define HA_DONT_TOUCH_DATA 1U /* Don't empty datafile (isamchk) */
+#define HA_PACK_RECORD 2U /* Request packed record format */
+#define HA_CREATE_TMP_TABLE 4U
+#define HA_CREATE_CHECKSUM 8U
+#define HA_CREATE_KEEP_FILES 16U /* don't overwrite .MYD and MYI */
+#define HA_CREATE_PAGE_CHECKSUM 32U
+#define HA_CREATE_DELAY_KEY_WRITE 64U
+#define HA_CREATE_RELIES_ON_SQL_LAYER 128U
+#define HA_CREATE_INTERNAL_TABLE 256U
+#define HA_PRESERVE_INSERT_ORDER 512U
/* Flags used by start_bulk_insert */
-#define HA_CREATE_UNIQUE_INDEX_BY_SORT 1
+#define HA_CREATE_UNIQUE_INDEX_BY_SORT 1U
/*
@@ -366,44 +366,44 @@ enum ha_base_keytype {
*/
/* this one is not used */
-#define HA_STATUS_POS 1
+#define HA_STATUS_POS 1U
/*
assuming the table keeps shared actual copy of the 'info' and
local, possibly outdated copy, the following flag means that
it should not try to get the actual data (locking the shared structure)
slightly outdated version will suffice
*/
-#define HA_STATUS_NO_LOCK 2
+#define HA_STATUS_NO_LOCK 2U
/* update the time of the last modification (in handler::update_time) */
-#define HA_STATUS_TIME 4
+#define HA_STATUS_TIME 4U
/*
update the 'constant' part of the info:
handler::max_data_file_length, max_index_file_length, create_time
sortkey, ref_length, block_size, data_file_name, index_file_name.
handler::table->s->keys_in_use, keys_for_keyread, rec_per_key
*/
-#define HA_STATUS_CONST 8
+#define HA_STATUS_CONST 8U
/*
update the 'variable' part of the info:
handler::records, deleted, data_file_length, index_file_length,
check_time, mean_rec_length
*/
-#define HA_STATUS_VARIABLE 16
+#define HA_STATUS_VARIABLE 16U
/*
get the information about the key that caused last duplicate value error
update handler::errkey and handler::dupp_ref
see handler::get_dup_key()
*/
-#define HA_STATUS_ERRKEY 32
+#define HA_STATUS_ERRKEY 32U
/*
update handler::auto_increment_value
*/
-#define HA_STATUS_AUTO 64
+#define HA_STATUS_AUTO 64U
/*
Get also delete_length when HA_STATUS_VARIABLE is called. It's ok to set it also
when only HA_STATUS_VARIABLE but it won't be used.
*/
-#define HA_STATUS_VARIABLE_EXTRA 128
+#define HA_STATUS_VARIABLE_EXTRA 128U
/*
Errorcodes given by handler functions
@@ -521,23 +521,23 @@ typedef ulong key_part_map;
/* Intern constants in databases */
/* bits in _search */
-#define SEARCH_FIND 1
-#define SEARCH_NO_FIND 2
-#define SEARCH_SAME 4
-#define SEARCH_BIGGER 8
-#define SEARCH_SMALLER 16
-#define SEARCH_SAVE_BUFF 32
-#define SEARCH_UPDATE 64
-#define SEARCH_PREFIX 128
-#define SEARCH_LAST 256
-#define MBR_CONTAIN 512
-#define MBR_INTERSECT 1024
-#define MBR_WITHIN 2048
-#define MBR_DISJOINT 4096
-#define MBR_EQUAL 8192
-#define MBR_DATA 16384
-#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */
-#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */
+#define SEARCH_FIND 1U
+#define SEARCH_NO_FIND 2U
+#define SEARCH_SAME 4U
+#define SEARCH_BIGGER 8U
+#define SEARCH_SMALLER 16U
+#define SEARCH_SAVE_BUFF 32U
+#define SEARCH_UPDATE 64U
+#define SEARCH_PREFIX 128U
+#define SEARCH_LAST 256U
+#define MBR_CONTAIN 512U
+#define MBR_INTERSECT 1024U
+#define MBR_WITHIN 2048U
+#define MBR_DISJOINT 4096U
+#define MBR_EQUAL 8192U
+#define MBR_DATA 16384U
+#define SEARCH_NULL_ARE_EQUAL 32768U /* NULL in keys are equal */
+#define SEARCH_NULL_ARE_NOT_EQUAL 65536U/* NULL in keys are not equal */
/* Use this when inserting a key in position order */
#define SEARCH_INSERT (SEARCH_NULL_ARE_NOT_EQUAL*2)
/* Only part of the key is specified while reading */
@@ -548,27 +548,27 @@ typedef ulong key_part_map;
#define SEARCH_PAGE_KEY_HAS_TRANSID (SEARCH_USER_KEY_HAS_TRANSID*2)
/* bits in opt_flag */
-#define QUICK_USED 1
-#define READ_CACHE_USED 2
-#define READ_CHECK_USED 4
-#define KEY_READ_USED 8
-#define WRITE_CACHE_USED 16
-#define OPT_NO_ROWS 32
+#define QUICK_USED 1U
+#define READ_CACHE_USED 2U
+#define READ_CHECK_USED 4U
+#define KEY_READ_USED 8U
+#define WRITE_CACHE_USED 16U
+#define OPT_NO_ROWS 32U
/* bits in update */
-#define HA_STATE_CHANGED 1 /* Database has changed */
-#define HA_STATE_AKTIV 2 /* Has a current record */
-#define HA_STATE_WRITTEN 4 /* Record is written */
-#define HA_STATE_DELETED 8
-#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */
-#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */
-#define HA_STATE_NO_KEY 64 /* Last read didn't find record */
-#define HA_STATE_KEY_CHANGED 128
-#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */
-#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */
-#define HA_STATE_ROW_CHANGED 1024 /* To invalidate ROW cache */
-#define HA_STATE_EXTEND_BLOCK 2048
-#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */
+#define HA_STATE_CHANGED 1U /* Database has changed */
+#define HA_STATE_AKTIV 2U /* Has a current record */
+#define HA_STATE_WRITTEN 4U /* Record is written */
+#define HA_STATE_DELETED 8U
+#define HA_STATE_NEXT_FOUND 16U /* Next found record (record before) */
+#define HA_STATE_PREV_FOUND 32U /* Prev found record (record after) */
+#define HA_STATE_NO_KEY 64U /* Last read didn't find record */
+#define HA_STATE_KEY_CHANGED 128U
+#define HA_STATE_WRITE_AT_END 256U /* set in _ps_find_writepos */
+#define HA_STATE_BUFF_SAVED 512U /* If current keybuff is info->buff */
+#define HA_STATE_ROW_CHANGED 1024U /* To invalidate ROW cache */
+#define HA_STATE_EXTEND_BLOCK 2048U
+#define HA_STATE_RNEXT_SAME 4096U /* rnext_same occupied lastkey2 */
/* myisampack expects no more than 32 field types. */
enum en_fieldtype {
@@ -584,15 +584,15 @@ enum data_file_type {
/* For key ranges */
-#define NO_MIN_RANGE 1
-#define NO_MAX_RANGE 2
-#define NEAR_MIN 4
-#define NEAR_MAX 8
-#define UNIQUE_RANGE 16
-#define EQ_RANGE 32
-#define NULL_RANGE 64
-#define GEOM_FLAG 128
-#define SKIP_RANGE 256
+#define NO_MIN_RANGE 1U
+#define NO_MAX_RANGE 2U
+#define NEAR_MIN 4U
+#define NEAR_MAX 8U
+#define UNIQUE_RANGE 16U
+#define EQ_RANGE 32U
+#define NULL_RANGE 64U
+#define GEOM_FLAG 128U
+#define SKIP_RANGE 256U
typedef struct st_key_range
{
diff --git a/include/my_bit.h b/include/my_bit.h
index a50403c312d..e7fd90f7b30 100644
--- a/include/my_bit.h
+++ b/include/my_bit.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2007, 2011, Oracle and/or its affiliates.
- Copyright (c) 2009-2011, Monty Program Ab
+ Copyright (c) 2009, 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
@@ -114,7 +114,7 @@ static inline uint32 my_clear_highest_bit(uint32 v)
static inline uint32 my_reverse_bits(uint32 key)
{
- return
+ return (uint32)
(_my_bits_reverse_table[ key & 255] << 24) |
(_my_bits_reverse_table[(key>> 8) & 255] << 16) |
(_my_bits_reverse_table[(key>>16) & 255] << 8) |
diff --git a/include/my_global.h b/include/my_global.h
index 4f40d3e0615..e4ca562772e 100644
--- a/include/my_global.h
+++ b/include/my_global.h
@@ -1,6 +1,6 @@
/*
Copyright (c) 2001, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab.
+ Copyright (c) 2010, 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
@@ -677,7 +677,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
smaller what the disk page size. This influences the speed of the
isam btree library. eg to big to slow.
*/
-#define IO_SIZE 4096
+#define IO_SIZE 4096U
/*
How much overhead does malloc have. The code often allocates
something like 1024-MALLOC_OVERHEAD bytes
diff --git a/include/my_pthread.h b/include/my_pthread.h
index bf61a024390..a38636af87d 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2014, Oracle and/or its affiliates.
- Copyright (c) 2009, 2014, MariaDB
+ Copyright (c) 2009, 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
@@ -651,7 +651,7 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr;
#define ESRCH 1
#endif
-typedef int64 my_thread_id;
+typedef uint64 my_thread_id;
extern void my_threadattr_global_init(void);
extern my_bool my_thread_global_init(void);
diff --git a/include/my_sys.h b/include/my_sys.h
index 2e24bfd02d3..6834bbd8dc2 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2013, Oracle and/or its affiliates.
- Copyright (c) 2010, 2016, Monty Program Ab.
+ Copyright (c) 2010, 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
@@ -60,75 +60,75 @@ typedef struct my_aio_result {
#define MY_FILE_ERROR ((size_t) -1)
/* General bitmaps for my_func's */
-#define MY_FFNF 1 /* Fatal if file not found */
-#define MY_FNABP 2 /* Fatal if not all bytes read/writen */
-#define MY_NABP 4 /* Error if not all bytes read/writen */
-#define MY_FAE 8 /* Fatal if any error */
-#define MY_WME 16 /* Write message on error */
-#define MY_WAIT_IF_FULL 32 /* Wait and try again if disk full error */
-#define MY_IGNORE_BADFD 32 /* my_sync: ignore 'bad descriptor' errors */
-#define MY_ENCRYPT 64 /* Encrypt IO_CACHE temporary files */
-#define MY_FULL_IO 512 /* For my_read - loop intil I/O is complete */
-#define MY_DONT_CHECK_FILESIZE 128 /* Option to init_io_cache() */
-#define MY_LINK_WARNING 32 /* my_redel() gives warning if links */
-#define MY_COPYTIME 64 /* my_redel() copys time */
-#define MY_DELETE_OLD 256 /* my_create_with_symlink() */
-#define MY_RESOLVE_LINK 128 /* my_realpath(); Only resolve links */
-#define MY_HOLD_ORIGINAL_MODES 128 /* my_copy() holds to file modes */
-#define MY_REDEL_MAKE_BACKUP 256
-#define MY_SEEK_NOT_DONE 32 /* my_lock may have to do a seek */
-#define MY_SHORT_WAIT 64 /* my_lock() don't wait if can't lock */
-#define MY_FORCE_LOCK 128 /* use my_lock() even if disable_locking */
-#define MY_NO_WAIT 256 /* my_lock() don't wait at all */
+#define MY_FFNF 1U /* Fatal if file not found */
+#define MY_FNABP 2U /* Fatal if not all bytes read/writen */
+#define MY_NABP 4U /* Error if not all bytes read/writen */
+#define MY_FAE 8U /* Fatal if any error */
+#define MY_WME 16U /* Write message on error */
+#define MY_WAIT_IF_FULL 32U /* Wait and try again if disk full error */
+#define MY_IGNORE_BADFD 32U /* my_sync: ignore 'bad descriptor' errors */
+#define MY_ENCRYPT 64U /* Encrypt IO_CACHE temporary files */
+#define MY_FULL_IO 512U /* For my_read - loop intil I/O is complete */
+#define MY_DONT_CHECK_FILESIZE 128U /* Option to init_io_cache() */
+#define MY_LINK_WARNING 32U /* my_redel() gives warning if links */
+#define MY_COPYTIME 64U /* my_redel() copys time */
+#define MY_DELETE_OLD 256U /* my_create_with_symlink() */
+#define MY_RESOLVE_LINK 128U /* my_realpath(); Only resolve links */
+#define MY_HOLD_ORIGINAL_MODES 128U /* my_copy() holds to file modes */
+#define MY_REDEL_MAKE_BACKUP 256U
+#define MY_SEEK_NOT_DONE 32U /* my_lock may have to do a seek */
+#define MY_SHORT_WAIT 64U /* my_lock() don't wait if can't lock */
+#define MY_FORCE_LOCK 128U /* use my_lock() even if disable_locking */
+#define MY_NO_WAIT 256U /* my_lock() don't wait at all */
/*
init_dynamic_array() has init buffer; Internal flag, not to be used by
caller.
*/
-#define MY_INIT_BUFFER_USED 256
-#define MY_ZEROFILL 32 /* my_malloc(), fill array with zero */
-#define MY_ALLOW_ZERO_PTR 64 /* my_realloc() ; zero ptr -> malloc */
-#define MY_FREE_ON_ERROR 128 /* my_realloc() ; Free old ptr on error */
-#define MY_HOLD_ON_ERROR 256 /* my_realloc() ; Return old ptr on error */
-#define MY_DONT_OVERWRITE_FILE 2048 /* my_copy: Don't overwrite file */
-#define MY_THREADSAFE 2048 /* my_seek(): lock fd mutex */
-#define MY_SYNC 4096 /* my_copy(): sync dst file */
-#define MY_SYNC_DIR 32768 /* my_create/delete/rename: sync directory */
-#define MY_SYNC_FILESIZE 65536 /* my_sync(): safe sync when file is extended */
-#define MY_THREAD_SPECIFIC 0x10000 /* my_malloc(): thread specific */
-#define MY_THREAD_MOVE 0x20000 /* realloc(); Memory can move */
-/* Tree that should delete things automaticly */
-#define MY_TREE_WITH_DELETE 0x40000
-
-#define MY_CHECK_ERROR 1 /* Params to my_end; Check open-close */
-#define MY_GIVE_INFO 2 /* Give time info about process*/
-#define MY_DONT_FREE_DBUG 4 /* Do not call DBUG_END() in my_end() */
-
-#define ME_HIGHBYTE 8 /* Shift for colours */
-#define ME_NOCUR 1 /* Don't use curses message */
-#define ME_OLDWIN 2 /* Use old window */
-#define ME_BELL 4 /* Ring bell then printing message */
-#define ME_HOLDTANG 8 /* Don't delete last keys */
-#define ME_WAITTOT 16 /* Wait for errtime secs of for a action */
-#define ME_WAITTANG 32 /* Wait for a user action */
-#define ME_NOREFRESH 64 /* Write the error message to error log */
-#define ME_NOINPUT 128 /* Dont use the input libary */
-#define ME_COLOUR1 ((1 << ME_HIGHBYTE)) /* Possibly error-colours */
-#define ME_COLOUR2 ((2 << ME_HIGHBYTE))
-#define ME_COLOUR3 ((3 << ME_HIGHBYTE))
-#define ME_JUST_INFO 1024 /**< not error but just info */
-#define ME_JUST_WARNING 2048 /**< not error but just warning */
-#define ME_FATALERROR 4096 /* Fatal statement error */
+#define MY_INIT_BUFFER_USED 256U
+#define MY_ZEROFILL 32U /* my_malloc(), fill array with zero */
+#define MY_ALLOW_ZERO_PTR 64U /* my_realloc() ; zero ptr -> malloc */
+#define MY_FREE_ON_ERROR 128U /* my_realloc() ; Free old ptr on error */
+#define MY_HOLD_ON_ERROR 256U /* my_realloc() ; Return old ptr on error */
+#define MY_DONT_OVERWRITE_FILE 2048U /* my_copy: Don't overwrite file */
+#define MY_THREADSAFE 2048U /* my_seek(): lock fd mutex */
+#define MY_SYNC 4096U /* my_copy(): sync dst file */
+#define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */
+#define MY_SYNC_FILESIZE 65536U /* my_sync(): safe sync when file is extended */
+#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */
+#define MY_THREAD_MOVE 0x20000U /* realloc(); Memory can move */
+/* Tree that should delete things automaticly */
+#define MY_TREE_WITH_DELETE 0x40000U
+
+#define MY_CHECK_ERROR 1U /* Params to my_end; Check open-close */
+#define MY_GIVE_INFO 2U /* Give time info about process*/
+#define MY_DONT_FREE_DBUG 4U /* Do not call DBUG_END() in my_end() */
+
+#define ME_HIGHBYTE 8U /* Shift for colours */
+#define ME_NOCUR 1U /* Don't use curses message */
+#define ME_OLDWIN 2U /* Use old window */
+#define ME_BELL 4U /* Ring bell then printing message */
+#define ME_HOLDTANG 8U /* Don't delete last keys */
+#define ME_WAITTOT 16U /* Wait for errtime secs of for a action */
+#define ME_WAITTANG 32U /* Wait for a user action */
+#define ME_NOREFRESH 64U /* Write the error message to error log */
+#define ME_NOINPUT 128U /* Dont use the input libary */
+#define ME_COLOUR1 ((1U << ME_HIGHBYTE)) /* Possibly error-colours */
+#define ME_COLOUR2 ((2U << ME_HIGHBYTE))
+#define ME_COLOUR3 ((3U << ME_HIGHBYTE))
+#define ME_JUST_INFO 1024U /**< not error but just info */
+#define ME_JUST_WARNING 2048U /**< not error but just warning */
+#define ME_FATALERROR 4096U /* Fatal statement error */
/* Bits in last argument to fn_format */
-#define MY_REPLACE_DIR 1 /* replace dir in name with 'dir' */
-#define MY_REPLACE_EXT 2 /* replace extension with 'ext' */
-#define MY_UNPACK_FILENAME 4 /* Unpack name (~ -> home) */
-#define MY_PACK_FILENAME 8 /* Pack name (home -> ~) */
-#define MY_RESOLVE_SYMLINKS 16 /* Resolve all symbolic links */
-#define MY_RETURN_REAL_PATH 32 /* return full path for file */
-#define MY_SAFE_PATH 64 /* Return NULL if too long path */
-#define MY_RELATIVE_PATH 128 /* name is relative to 'dir' */
-#define MY_APPEND_EXT 256 /* add 'ext' as additional extension*/
+#define MY_REPLACE_DIR 1U /* replace dir in name with 'dir' */
+#define MY_REPLACE_EXT 2U /* replace extension with 'ext' */
+#define MY_UNPACK_FILENAME 4U /* Unpack name (~ -> home) */
+#define MY_PACK_FILENAME 8U /* Pack name (home -> ~) */
+#define MY_RESOLVE_SYMLINKS 16U /* Resolve all symbolic links */
+#define MY_RETURN_REAL_PATH 32U /* return full path for file */
+#define MY_SAFE_PATH 64U /* Return NULL if too long path */
+#define MY_RELATIVE_PATH 128U /* name is relative to 'dir' */
+#define MY_APPEND_EXT 256U /* add 'ext' as additional extension*/
/* My seek flags */
@@ -143,19 +143,19 @@ typedef struct my_aio_result {
#define DFLT_INIT_HITS 3
/* root_alloc flags */
-#define MY_KEEP_PREALLOC 1
-#define MY_MARK_BLOCKS_FREE 2 /* move used to free list and reuse them */
+#define MY_KEEP_PREALLOC 1U
+#define MY_MARK_BLOCKS_FREE 2U /* move used to free list and reuse them */
/* Internal error numbers (for assembler functions) */
#define MY_ERRNO_EDOM 33
#define MY_ERRNO_ERANGE 34
/* Bits for get_date timeflag */
-#define GETDATE_DATE_TIME 1
-#define GETDATE_SHORT_DATE 2
-#define GETDATE_HHMMSSTIME 4
-#define GETDATE_GMT 8
-#define GETDATE_FIXEDLENGTH 16
+#define GETDATE_DATE_TIME 1U
+#define GETDATE_SHORT_DATE 2U
+#define GETDATE_HHMMSSTIME 4U
+#define GETDATE_GMT 8U
+#define GETDATE_FIXEDLENGTH 16U
/* Extra length needed for filename if one calls my_create_backup_name */
#define MY_BACKUP_NAME_EXTRA_LENGTH 17
diff --git a/include/my_time.h b/include/my_time.h
index 8dc1f09ba0f..90d19c8861a 100644
--- a/include/my_time.h
+++ b/include/my_time.h
@@ -1,5 +1,6 @@
/*
Copyright (c) 2004, 2011, Oracle and/or its affiliates.
+ Copyright (c) 2017, Monty Program Ab.
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
@@ -61,16 +62,16 @@ extern uchar days_in_month[];
TIME_FUZZY_DATES is used for the result will only be used for comparison
purposes. Conversion is as relaxed as possible.
*/
-#define TIME_FUZZY_DATES 1
-#define TIME_DATETIME_ONLY 2
-#define TIME_TIME_ONLY 4
+#define TIME_FUZZY_DATES 1U
+#define TIME_DATETIME_ONLY 2U
+#define TIME_TIME_ONLY 4U
#define TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */
#define TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */
#define TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */
-#define MYSQL_TIME_WARN_TRUNCATED 1
-#define MYSQL_TIME_WARN_OUT_OF_RANGE 2
-#define MYSQL_TIME_NOTE_TRUNCATED 16
+#define MYSQL_TIME_WARN_TRUNCATED 1U
+#define MYSQL_TIME_WARN_OUT_OF_RANGE 2U
+#define MYSQL_TIME_NOTE_TRUNCATED 16U
#define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|MYSQL_TIME_WARN_OUT_OF_RANGE)
#define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED)
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 9ceb49c1094..3519d7bb757 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2010 Monty Program Ab
+/* Copyright (C) 2010, 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
@@ -38,7 +38,7 @@
#define TRASH_FILL(A,B,C) do{ const size_t trash_tmp __attribute__((unused)) = (B) ; MEM_CHECK_ADDRESSABLE(A,trash_tmp);MEM_UNDEFINED(A,trash_tmp);} while (0)
#endif
#define TRASH_ALLOC(A,B) TRASH_FILL(A,B,0xA5)
-#define TRASH_FREE(A,B) TRASH_FILL(A,B,0x8F)
+#define TRASH_FREE(A,B) TRASH_FILL(A,(size_t) (B),0x8F)
#define TRASH(A,B) TRASH_FREE(A,B)
# define DBUG_ASSERT_DEFINED(x) \
diff --git a/include/myisamchk.h b/include/myisamchk.h
index 643241d84e5..40aa0b19d49 100644
--- a/include/myisamchk.h
+++ b/include/myisamchk.h
@@ -1,4 +1,5 @@
/* Copyright (C) 2006 MySQL AB
+ 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
@@ -24,13 +25,13 @@
to xxxcheck.c follows:
*/
-#define TT_USEFRM 1
-#define TT_FOR_UPGRADE 2
-#define TT_FROM_MYSQL 4
+#define TT_USEFRM 1U
+#define TT_FOR_UPGRADE 2U
+#define TT_FROM_MYSQL 4U
/* Bits set in out_flag */
-#define O_NEW_DATA 2
-#define O_DATA_LOST 4
+#define O_NEW_DATA 2U
+#define O_DATA_LOST 4U
typedef struct st_sort_key_blocks /* Used when sorting */
{
diff --git a/include/mysql/psi/mysql_idle.h b/include/mysql/psi/mysql_idle.h
index 5c72b715b7a..b623edce108 100644
--- a/include/mysql/psi/mysql_idle.h
+++ b/include/mysql/psi/mysql_idle.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2011, 2012, 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
@@ -67,7 +68,7 @@
*/
static inline struct PSI_idle_locker *
inline_mysql_start_idle_wait(PSI_idle_locker_state *state,
- const char *src_file, int src_line)
+ const char *src_file, uint src_line)
{
struct PSI_idle_locker *locker;
locker= PSI_IDLE_CALL(start_idle_wait)(state, src_file, src_line);
diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h
index 619f600a776..64531e5c35e 100644
--- a/include/mysql/psi/mysql_socket.h
+++ b/include/mysql/psi/mysql_socket.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, 2012, 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
@@ -241,7 +242,7 @@ inline_mysql_start_socket_wait(PSI_socket_locker_state *state,
MYSQL_SOCKET mysql_socket,
enum PSI_socket_operation op,
size_t byte_count,
- const char *src_file, int src_line)
+ const char *src_file, uint src_line)
{
struct PSI_socket_locker *locker;
if (mysql_socket.m_psi != NULL)
@@ -744,8 +745,7 @@ inline_mysql_socket_send
/* Instrumentation end */
if (locker != NULL)
{
- size_t bytes_written;
- bytes_written= (result > -1) ? result : 0;
+ size_t bytes_written= (result > 0) ? (size_t) result : 0;
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
}
@@ -786,8 +786,7 @@ inline_mysql_socket_recv
/* Instrumentation end */
if (locker != NULL)
{
- size_t bytes_read;
- bytes_read= (result > -1) ? result : 0;
+ size_t bytes_read= (result > 0) ? (size_t) result : 0;
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
}
@@ -828,8 +827,7 @@ inline_mysql_socket_sendto
/* Instrumentation end */
if (locker != NULL)
{
- size_t bytes_written;
- bytes_written = (result > -1) ? result : 0;
+ size_t bytes_written = (result > 0) ? (size_t) result : 0;
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_written);
}
@@ -871,8 +869,7 @@ inline_mysql_socket_recvfrom
/* Instrumentation end */
if (locker != NULL)
{
- size_t bytes_read;
- bytes_read = (result > -1) ? result : 0;
+ size_t bytes_read= (result > 0) ? (size_t) result : 0;
PSI_SOCKET_CALL(end_socket_wait)(locker, bytes_read);
}
diff --git a/include/mysql/psi/mysql_statement.h b/include/mysql/psi/mysql_statement.h
index 3d5943fa55a..05016130af7 100644
--- a/include/mysql/psi/mysql_statement.h
+++ b/include/mysql/psi/mysql_statement.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, 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
@@ -146,7 +147,7 @@ inline_mysql_start_statement(PSI_statement_locker_state *state,
PSI_statement_key key,
const char *db, uint db_len,
const CHARSET_INFO *charset,
- const char *src_file, int src_line)
+ const char *src_file, uint src_line)
{
PSI_statement_locker *locker;
locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
diff --git a/include/mysql/psi/mysql_table.h b/include/mysql/psi/mysql_table.h
index 74217a32b13..5b4b64a8e48 100644
--- a/include/mysql/psi/mysql_table.h
+++ b/include/mysql/psi/mysql_table.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2010, 2012, 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
@@ -183,7 +184,7 @@ static inline struct PSI_table_locker *
inline_mysql_start_table_lock_wait(PSI_table_locker_state *state,
struct PSI_table *psi,
enum PSI_table_lock_operation op,
- ulong flags, const char *src_file, int src_line)
+ ulong flags, const char *src_file, uint src_line)
{
if (psi != NULL)
{
diff --git a/include/mysql_com.h b/include/mysql_com.h
index ba389933b15..2cb4656ceef 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates.
- Copyright (c) 2010, 2013, Monty Program Ab
+ Copyright (c) 2010, 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
@@ -25,8 +25,8 @@
#define HOSTNAME_LENGTH 60
#define SYSTEM_CHARSET_MBMAXLEN 3
-#define NAME_CHAR_LEN 64 /* Field/table name length */
-#define USERNAME_CHAR_LENGTH 128
+#define NAME_CHAR_LEN 64U /* Field/table name length */
+#define USERNAME_CHAR_LENGTH 128U
#define NAME_LEN (NAME_CHAR_LEN*SYSTEM_CHARSET_MBMAXLEN)
#define USERNAME_LENGTH (USERNAME_CHAR_LENGTH*SYSTEM_CHARSET_MBMAXLEN)
#define DEFINER_CHAR_LENGTH (USERNAME_CHAR_LENGTH + HOSTNAME_LENGTH + 1)
@@ -149,40 +149,40 @@ enum enum_indicator_type
#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
-#define NOT_NULL_FLAG 1 /* Field can't be NULL */
-#define PRI_KEY_FLAG 2 /* Field is part of a primary key */
-#define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */
-#define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */
-#define BLOB_FLAG 16 /* Field is a blob */
-#define UNSIGNED_FLAG 32 /* Field is unsigned */
-#define ZEROFILL_FLAG 64 /* Field is zerofill */
-#define BINARY_FLAG 128 /* Field is binary */
+#define NOT_NULL_FLAG 1U /* Field can't be NULL */
+#define PRI_KEY_FLAG 2U /* Field is part of a primary key */
+#define UNIQUE_KEY_FLAG 4U /* Field is part of a unique key */
+#define MULTIPLE_KEY_FLAG 8U /* Field is part of a key */
+#define BLOB_FLAG 16U /* Field is a blob */
+#define UNSIGNED_FLAG 32U /* Field is unsigned */
+#define ZEROFILL_FLAG 64U /* Field is zerofill */
+#define BINARY_FLAG 128U /* Field is binary */
/* The following are only sent to new clients */
-#define ENUM_FLAG 256 /* field is an enum */
-#define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */
-#define TIMESTAMP_FLAG 1024 /* Field is a timestamp */
-#define SET_FLAG 2048 /* field is a set */
-#define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */
-#define ON_UPDATE_NOW_FLAG 8192 /* Field is set to NOW on UPDATE */
-#define NUM_FLAG 32768 /* Field is num (for clients) */
-#define PART_KEY_FLAG 16384 /* Intern; Part of some key */
-#define GROUP_FLAG 32768 /* Intern: Group field */
-#define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */
-#define GET_FIXED_FIELDS_FLAG (1 << 18) /* Used to get fields in item tree */
-#define FIELD_IN_PART_FUNC_FLAG (1 << 19)/* Field part of partition func */
+#define ENUM_FLAG 256U /* field is an enum */
+#define AUTO_INCREMENT_FLAG 512U /* field is a autoincrement field */
+#define TIMESTAMP_FLAG 1024U /* Field is a timestamp */
+#define SET_FLAG 2048U /* field is a set */
+#define NO_DEFAULT_VALUE_FLAG 4096U /* Field doesn't have default value */
+#define ON_UPDATE_NOW_FLAG 8192U /* Field is set to NOW on UPDATE */
+#define NUM_FLAG 32768U /* Field is num (for clients) */
+#define PART_KEY_FLAG 16384U /* Intern; Part of some key */
+#define GROUP_FLAG 32768U /* Intern: Group field */
+#define BINCMP_FLAG 131072U /* Intern: Used by sql_yacc */
+#define GET_FIXED_FIELDS_FLAG (1U << 18) /* Used to get fields in item tree */
+#define FIELD_IN_PART_FUNC_FLAG (1U << 19)/* Field part of partition func */
/**
Intern: Field in TABLE object for new version of altered table,
which participates in a newly added index.
*/
-#define FIELD_IN_ADD_INDEX (1 << 20)
-#define FIELD_IS_RENAMED (1<< 21) /* Intern: Field is being renamed */
+#define FIELD_IN_ADD_INDEX (1U << 20)
+#define FIELD_IS_RENAMED (1U << 21) /* Intern: Field is being renamed */
#define FIELD_FLAGS_STORAGE_MEDIA 22 /* Field storage media, bit 22-23 */
-#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3 << FIELD_FLAGS_STORAGE_MEDIA)
+#define FIELD_FLAGS_STORAGE_MEDIA_MASK (3U << FIELD_FLAGS_STORAGE_MEDIA)
#define FIELD_FLAGS_COLUMN_FORMAT 24 /* Field column format, bit 24-25 */
-#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3 << FIELD_FLAGS_COLUMN_FORMAT)
-#define FIELD_IS_DROPPED (1<< 26) /* Intern: Field is being dropped */
+#define FIELD_FLAGS_COLUMN_FORMAT_MASK (3U << FIELD_FLAGS_COLUMN_FORMAT)
+#define FIELD_IS_DROPPED (1U << 26) /* Intern: Field is being dropped */
#define REFRESH_GRANT (1ULL << 0) /* Refresh grant tables */
#define REFRESH_LOG (1ULL << 1) /* Start on new log file */
@@ -335,36 +335,36 @@ enum enum_indicator_type
implicitly, by the first transactional
statement, when autocommit=off.
*/
-#define SERVER_STATUS_IN_TRANS 1
-#define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */
-#define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */
-#define SERVER_QUERY_NO_GOOD_INDEX_USED 16
-#define SERVER_QUERY_NO_INDEX_USED 32
+#define SERVER_STATUS_IN_TRANS 1U
+#define SERVER_STATUS_AUTOCOMMIT 2U /* Server in auto_commit mode */
+#define SERVER_MORE_RESULTS_EXISTS 8U /* Multi query - next query exists */
+#define SERVER_QUERY_NO_GOOD_INDEX_USED 16U
+#define SERVER_QUERY_NO_INDEX_USED 32U
/**
The server was able to fulfill the clients request and opened a
read-only non-scrollable cursor for a query. This flag comes
in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands.
*/
-#define SERVER_STATUS_CURSOR_EXISTS 64
+#define SERVER_STATUS_CURSOR_EXISTS 64U
/**
This flag is sent when a read-only cursor is exhausted, in reply to
COM_STMT_FETCH command.
*/
-#define SERVER_STATUS_LAST_ROW_SENT 128
-#define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */
-#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512
+#define SERVER_STATUS_LAST_ROW_SENT 128U
+#define SERVER_STATUS_DB_DROPPED 256U /* A database was dropped */
+#define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512U
/**
Sent to the client if after a prepared statement reprepare
we discovered that the new statement returns a different
number of result set columns.
*/
-#define SERVER_STATUS_METADATA_CHANGED 1024
-#define SERVER_QUERY_WAS_SLOW 2048
+#define SERVER_STATUS_METADATA_CHANGED 1024U
+#define SERVER_QUERY_WAS_SLOW 2048U
/**
To mark ResultSet containing output parameter values.
*/
-#define SERVER_PS_OUT_PARAMS 4096
+#define SERVER_PS_OUT_PARAMS 4096U
/**
Set at the same time as SERVER_STATUS_IN_TRANS if the started
@@ -373,7 +373,7 @@ enum enum_indicator_type
to clients in OK and EOF packets, the flag indicates the
transaction status at the end of command execution.
*/
-#define SERVER_STATUS_IN_TRANS_READONLY 8192
+#define SERVER_STATUS_IN_TRANS_READONLY 8192U
/**
This status flag, when on, implies that one of the state information has
@@ -455,7 +455,7 @@ typedef struct st_net {
} NET;
-#define packet_error (~(unsigned long) 0)
+#define packet_error ~0UL
enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY,
MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG,
@@ -706,9 +706,9 @@ void my_thread_end(void);
}
#endif
-#define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */
-#define MYSQL_STMT_HEADER 4
-#define MYSQL_LONG_DATA_HEADER 6
+#define NULL_LENGTH ~0UL /* For net_store_length */
+#define MYSQL_STMT_HEADER 4U
+#define MYSQL_LONG_DATA_HEADER 6U
/*
If a float or double field have more than this number of decimals,
diff --git a/include/thr_lock.h b/include/thr_lock.h
index fb69d8a693e..e6451bf21c4 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2010, 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
@@ -76,10 +77,10 @@ enum enum_thr_lock_result { THR_LOCK_SUCCESS= 0, THR_LOCK_ABORTED= 1,
/* Priority for locks */
-#define THR_LOCK_LATE_PRIV 1 /* For locks to be merged with org lock */
-#define THR_LOCK_MERGE_PRIV 2 /* For merge tables */
+#define THR_LOCK_LATE_PRIV 1U /* For locks to be merged with org lock */
+#define THR_LOCK_MERGE_PRIV 2U /* For merge tables */
-#define THR_UNLOCK_UPDATE_STATUS 1
+#define THR_UNLOCK_UPDATE_STATUS 1U
extern ulong max_write_lock_count;
extern my_bool thr_lock_inited;
diff --git a/include/typelib.h b/include/typelib.h
index 4504bea4ff7..eba32167c4e 100644
--- a/include/typelib.h
+++ b/include/typelib.h
@@ -1,4 +1,5 @@
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -33,13 +34,13 @@ extern int find_type_or_exit(const char *x, TYPELIB *typelib,
const char *option);
#define FIND_TYPE_BASIC 0
/** makes @c find_type() require the whole name, no prefix */
-#define FIND_TYPE_NO_PREFIX (1 << 0)
+#define FIND_TYPE_NO_PREFIX (1U << 0)
/** always implicitely on, so unused, but old code may pass it */
#define FIND_TYPE_NO_OVERWRITE 0
/** makes @c find_type() accept a number. Not used either */
#define FIND_TYPE_ALLOW_NUMBER 0
/** makes @c find_type() treat ',' and '=' as terminators */
-#define FIND_TYPE_COMMA_TERM (1 << 3)
+#define FIND_TYPE_COMMA_TERM (1U << 3)
extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
diff --git a/include/violite.h b/include/violite.h
index 8be9859ceb4..6047c7c8fd4 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2012 Monty Program Ab
+ Copyright (c) 2012, 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
@@ -51,9 +51,9 @@ enum enum_vio_io_event
VIO_IO_EVENT_CONNECT
};
-#define VIO_LOCALHOST 1 /* a localhost connection */
-#define VIO_BUFFERED_READ 2 /* use buffered read */
-#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */
+#define VIO_LOCALHOST 1U /* a localhost connection */
+#define VIO_BUFFERED_READ 2U /* use buffered read */
+#define VIO_READ_BUFFER_SIZE 16384U /* size of read buffer */
#define VIO_DESCRIPTION_SIZE 30 /* size of description */
Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);