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 /include/my_sys.h | |
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 'include/my_sys.h')
-rw-r--r-- | include/my_sys.h | 142 |
1 files changed, 71 insertions, 71 deletions
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 |