diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2017-09-19 17:45:17 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2017-09-28 17:20:46 +0000 |
commit | eba44874ca9fc317696630cb371623142289fa99 (patch) | |
tree | f67cd5dbcaf102abef2fb26f76357d14feaded04 /mysys | |
parent | de7c2e5e545df90fc9814c60a8a5a8d20f22b2c3 (diff) | |
download | mariadb-git-eba44874ca9fc317696630cb371623142289fa99.tar.gz |
MDEV-13844 : Fix Windows warnings. Fix DBUG_PRINT.
- Fix win64 pointer truncation warnings
(usually coming from misusing 0x%lx and long cast in DBUG)
- Also fix printf-format warnings
Make the above mentioned warnings fatal.
- fix pthread_join on Windows to set return value.
Diffstat (limited to 'mysys')
-rw-r--r-- | mysys/hash.c | 12 | ||||
-rw-r--r-- | mysys/list.c | 2 | ||||
-rw-r--r-- | mysys/mf_iocache.c | 32 | ||||
-rw-r--r-- | mysys/mf_keycache.c | 34 | ||||
-rw-r--r-- | mysys/my_default.c | 4 | ||||
-rw-r--r-- | mysys/my_fopen.c | 6 | ||||
-rw-r--r-- | mysys/my_fstream.c | 20 | ||||
-rw-r--r-- | mysys/my_getwd.c | 4 | ||||
-rw-r--r-- | mysys/my_init.c | 2 | ||||
-rw-r--r-- | mysys/my_lib.c | 6 | ||||
-rw-r--r-- | mysys/my_safehash.c | 4 | ||||
-rw-r--r-- | mysys/my_winthread.c | 9 | ||||
-rw-r--r-- | mysys/thr_lock.c | 44 | ||||
-rw-r--r-- | mysys/tree.c | 4 | ||||
-rw-r--r-- | mysys/typelib.c | 4 | ||||
-rw-r--r-- | mysys/wqueue.c | 14 |
16 files changed, 104 insertions, 97 deletions
diff --git a/mysys/hash.c b/mysys/hash.c index ad01afba29e..57242735d99 100644 --- a/mysys/hash.c +++ b/mysys/hash.c @@ -84,7 +84,7 @@ my_hash_init2(HASH *hash, uint growth_size, CHARSET_INFO *charset, { my_bool res; DBUG_ENTER("my_hash_init"); - DBUG_PRINT("enter",("hash: 0x%lx size: %u", (long) hash, (uint) size)); + DBUG_PRINT("enter",("hash:%p size: %u", hash, (uint) size)); hash->records=0; hash->key_offset=key_offset; @@ -144,8 +144,8 @@ static inline void my_hash_free_elements(HASH *hash) void my_hash_free(HASH *hash) { DBUG_ENTER("my_hash_free"); - DBUG_PRINT("enter",("hash: 0x%lx elements: %ld", - (long) hash, hash->records)); + DBUG_PRINT("enter",("hash:%p elements: %ld", + hash, hash->records)); my_hash_free_elements(hash); hash->free= 0; @@ -166,7 +166,7 @@ void my_hash_free(HASH *hash) void my_hash_reset(HASH *hash) { DBUG_ENTER("my_hash_reset"); - DBUG_PRINT("enter",("hash: 0x%lxd", (long) hash)); + DBUG_PRINT("enter",("hash:%p", hash)); my_hash_free_elements(hash); reset_dynamic(&hash->array); @@ -844,8 +844,8 @@ my_bool my_hash_check(HASH *hash) blength, records)) != i) { DBUG_PRINT("error", ("Record in wrong link at %d: Start %d " - "Record: 0x%lx Record-link %d", - idx, i, (long) hash_info->data, rec_link)); + "Record:%p Record-link %d", + idx, i, hash_info->data, rec_link)); error=1; } else diff --git a/mysys/list.c b/mysys/list.c index fb46120db04..2276ca72b48 100644 --- a/mysys/list.c +++ b/mysys/list.c @@ -27,7 +27,7 @@ LIST *list_add(LIST *root, LIST *element) { DBUG_ENTER("list_add"); - DBUG_PRINT("enter",("root: 0x%lx element: 0x%lx", (long) root, (long) element)); + DBUG_PRINT("enter",("root: %p element: %p", root, element)); if (root) { if (root->prev) /* If add in mid of list */ diff --git a/mysys/mf_iocache.c b/mysys/mf_iocache.c index 0c2c1da354c..a52ea2c5c40 100644 --- a/mysys/mf_iocache.c +++ b/mysys/mf_iocache.c @@ -154,8 +154,8 @@ int init_io_cache(IO_CACHE *info, File file, size_t cachesize, my_off_t pos; my_off_t end_of_file= ~(my_off_t) 0; DBUG_ENTER("init_io_cache"); - DBUG_PRINT("enter",("cache: 0x%lx type: %d pos: %ld", - (ulong) info, (int) type, (ulong) seek_offset)); + DBUG_PRINT("enter",("cache:%p type: %d pos: %llu", + info, (int) type, (ulonglong) seek_offset)); info->file= file; info->type= TYPE_NOT_SET; /* Don't set it until mutex are created */ @@ -437,8 +437,8 @@ my_bool reinit_io_cache(IO_CACHE *info, enum cache_type type, my_bool clear_cache) { DBUG_ENTER("reinit_io_cache"); - DBUG_PRINT("enter",("cache: 0x%lx type: %d seek_offset: %lu clear_cache: %d", - (ulong) info, type, (ulong) seek_offset, + DBUG_PRINT("enter",("cache:%p type: %d seek_offset: %llu clear_cache: %d", + info, type, (ulonglong) seek_offset, (int) clear_cache)); DBUG_ASSERT(type == READ_CACHE || type == WRITE_CACHE); @@ -865,10 +865,10 @@ void init_io_cache_share(IO_CACHE *read_cache, IO_CACHE_SHARE *cshare, IO_CACHE *write_cache, uint num_threads) { DBUG_ENTER("init_io_cache_share"); - DBUG_PRINT("io_cache_share", ("read_cache: 0x%lx share: 0x%lx " - "write_cache: 0x%lx threads: %u", - (long) read_cache, (long) cshare, - (long) write_cache, num_threads)); + DBUG_PRINT("io_cache_share", ("read_cache: %p share: %p " + "write_cache: %p threads: %u", + read_cache, cshare, + write_cache, num_threads)); DBUG_ASSERT(num_threads > 1); DBUG_ASSERT(read_cache->type == READ_CACHE); @@ -930,9 +930,9 @@ void remove_io_thread(IO_CACHE *cache) flush_io_cache(cache); mysql_mutex_lock(&cshare->mutex); - DBUG_PRINT("io_cache_share", ("%s: 0x%lx", + DBUG_PRINT("io_cache_share", ("%s: %p", (cache == cshare->source_cache) ? - "writer" : "reader", (long) cache)); + "writer" : "reader", cache)); /* Remove from share. */ total= --cshare->total_threads; @@ -1006,9 +1006,9 @@ static int lock_io_cache(IO_CACHE *cache, my_off_t pos) /* Enter the lock. */ mysql_mutex_lock(&cshare->mutex); cshare->running_threads--; - DBUG_PRINT("io_cache_share", ("%s: 0x%lx pos: %lu running: %u", + DBUG_PRINT("io_cache_share", ("%s: %p pos: %lu running: %u", (cache == cshare->source_cache) ? - "writer" : "reader", (long) cache, (ulong) pos, + "writer" : "reader", cache, (ulong) pos, cshare->running_threads)); if (cshare->source_cache) @@ -1145,10 +1145,10 @@ static void unlock_io_cache(IO_CACHE *cache) { IO_CACHE_SHARE *cshare= cache->share; DBUG_ENTER("unlock_io_cache"); - DBUG_PRINT("io_cache_share", ("%s: 0x%lx pos: %lu running: %u", + DBUG_PRINT("io_cache_share", ("%s: %p pos: %lu running: %u", (cache == cshare->source_cache) ? "writer" : "reader", - (long) cache, (ulong) cshare->pos_in_file, + cache, (ulong) cshare->pos_in_file, cshare->total_threads)); cshare->running_threads= cshare->total_threads; @@ -1899,7 +1899,7 @@ int my_b_flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) size_t length; my_bool append_cache= (info->type == SEQ_READ_APPEND); DBUG_ENTER("my_b_flush_io_cache"); - DBUG_PRINT("enter", ("cache: 0x%lx", (long) info)); + DBUG_PRINT("enter", ("cache: %p", info)); if (!append_cache) need_append_buffer_lock= 0; @@ -1977,7 +1977,7 @@ int end_io_cache(IO_CACHE *info) { int error=0; DBUG_ENTER("end_io_cache"); - DBUG_PRINT("enter",("cache: 0x%lx", (ulong) info)); + DBUG_PRINT("enter",("cache: %p", info)); /* Every thread must call remove_io_thread(). The last one destroys diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index 34aeb569faf..683e3edecd0 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -609,11 +609,11 @@ int init_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, keycache->waiting_for_hash_link.last_thread= NULL; keycache->waiting_for_block.last_thread= NULL; DBUG_PRINT("exit", - ("disk_blocks: %d block_root: 0x%lx hash_entries: %d\ - hash_root: 0x%lx hash_links: %d hash_link_root: 0x%lx", - keycache->disk_blocks, (long) keycache->block_root, - keycache->hash_entries, (long) keycache->hash_root, - keycache->hash_links, (long) keycache->hash_link_root)); + ("disk_blocks: %d block_root: %p hash_entries: %d\ + hash_root: %p hash_links: %d hash_link_root: %p", + keycache->disk_blocks, keycache->block_root, + keycache->hash_entries, keycache->hash_root, + keycache->hash_links, keycache->hash_link_root)); } else { @@ -963,7 +963,7 @@ static void end_simple_key_cache(SIMPLE_KEY_CACHE_CB *keycache, my_bool cleanup) { DBUG_ENTER("end_simple_key_cache"); - DBUG_PRINT("enter", ("key_cache: 0x%lx", (long) keycache)); + DBUG_PRINT("enter", ("key_cache: %p", keycache)); if (!keycache->key_cache_inited) DBUG_VOID_RETURN; @@ -4366,7 +4366,7 @@ int flush_simple_key_cache_blocks(SIMPLE_KEY_CACHE_CB *keycache, { int res= 0; DBUG_ENTER("flush_key_blocks"); - DBUG_PRINT("enter", ("keycache: 0x%lx", (long) keycache)); + DBUG_PRINT("enter", ("keycache: %p", keycache)); if (!keycache->key_cache_inited) DBUG_RETURN(0); @@ -4795,11 +4795,11 @@ void keycache_debug_log_close(void) static int fail_block(BLOCK_LINK *block) { - F_B_PRT("block->next_used: %lx\n", (ulong) block->next_used); - F_B_PRT("block->prev_used: %lx\n", (ulong) block->prev_used); - F_B_PRT("block->next_changed: %lx\n", (ulong) block->next_changed); - F_B_PRT("block->prev_changed: %lx\n", (ulong) block->prev_changed); - F_B_PRT("block->hash_link: %lx\n", (ulong) block->hash_link); + F_B_PRT("block->next_used: %p\n", block->next_used); + F_B_PRT("block->prev_used: %p\n", block->prev_used); + F_B_PRT("block->next_changed: %p\n", block->next_changed); + F_B_PRT("block->prev_changed: %p\n", block->prev_changed); + F_B_PRT("block->hash_link: %p\n", block->hash_link); F_B_PRT("block->status: %u\n", block->status); F_B_PRT("block->length: %u\n", block->length); F_B_PRT("block->offset: %u\n", block->offset); @@ -4810,9 +4810,9 @@ static int fail_block(BLOCK_LINK *block) static int fail_hlink(HASH_LINK *hlink) { - F_B_PRT("hlink->next: %lx\n", (ulong) hlink->next); - F_B_PRT("hlink->prev: %lx\n", (ulong) hlink->prev); - F_B_PRT("hlink->block: %lx\n", (ulong) hlink->block); + F_B_PRT("hlink->next: %p\n", hlink->next); + F_B_PRT("hlink->prev: %p\n", hlink->prev); + F_B_PRT("hlink->block: %p\n", hlink->block); F_B_PRT("hlink->diskpos: %lu\n", (ulong) hlink->diskpos); F_B_PRT("hlink->file: %d\n", hlink->file); return 0; /* Let the assert fail. */ @@ -5358,7 +5358,7 @@ void end_partitioned_key_cache(PARTITIONED_KEY_CACHE_CB *keycache, uint i; uint partitions= keycache->partitions; DBUG_ENTER("partitioned_end_key_cache"); - DBUG_PRINT("enter", ("key_cache: 0x%lx", (long) keycache)); + DBUG_PRINT("enter", ("key_cache: %p", keycache)); for (i= 0; i < partitions; i++) { @@ -5672,7 +5672,7 @@ int flush_partitioned_key_cache_blocks(PARTITIONED_KEY_CACHE_CB *keycache, int err= 0; ulonglong *dirty_part_map= (ulonglong *) file_extra; DBUG_ENTER("partitioned_flush_key_blocks"); - DBUG_PRINT("enter", ("keycache: 0x%lx", (long) keycache)); + DBUG_PRINT("enter", ("keycache: %p", keycache)); for (i= 0; i < partitions; i++) { diff --git a/mysys/my_default.c b/mysys/my_default.c index e7d661b33e5..37f6d2bfbbf 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -173,8 +173,8 @@ fn_expand(const char *filename, char *result_buf) char dir[FN_REFLEN]; const int flags= MY_UNPACK_FILENAME | MY_SAFE_PATH | MY_RELATIVE_PATH; DBUG_ENTER("fn_expand"); - DBUG_PRINT("enter", ("filename: %s, result_buf: 0x%lx", - filename, (unsigned long) result_buf)); + DBUG_PRINT("enter", ("filename: %s, result_buf: %p", + filename, result_buf)); if (my_getwd(dir, sizeof(dir), MYF(0))) DBUG_RETURN(3); DBUG_PRINT("debug", ("dir: %s", dir)); diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index c720e2c9168..7dde1e1b4fc 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -74,7 +74,7 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags) my_file_total_opened++; my_file_info[filedesc].type= STREAM_BY_FOPEN; mysql_mutex_unlock(&THR_LOCK_open); - DBUG_PRINT("exit",("stream: 0x%lx", (long) fd)); + DBUG_PRINT("exit",("stream: %p", fd)); DBUG_RETURN(fd); } else @@ -222,7 +222,7 @@ int my_fclose(FILE *fd, myf MyFlags) { int err,file; DBUG_ENTER("my_fclose"); - DBUG_PRINT("my",("stream: 0x%lx MyFlags: %lu", (long) fd, MyFlags)); + DBUG_PRINT("my",("stream: %p MyFlags: %lu", fd, MyFlags)); mysql_mutex_lock(&THR_LOCK_open); file= my_fileno(fd); @@ -292,7 +292,7 @@ FILE *my_fdopen(File Filedes, const char *name, int Flags, myf MyFlags) mysql_mutex_unlock(&THR_LOCK_open); } - DBUG_PRINT("exit",("stream: 0x%lx", (long) fd)); + DBUG_PRINT("exit",("stream: %p", fd)); DBUG_RETURN(fd); } /* my_fdopen */ diff --git a/mysys/my_fstream.c b/mysys/my_fstream.c index de752fa149f..bfcf24bfa2e 100644 --- a/mysys/my_fstream.c +++ b/mysys/my_fstream.c @@ -46,8 +46,8 @@ size_t my_fread(FILE *stream, uchar *Buffer, size_t Count, myf MyFlags) { size_t readbytes; DBUG_ENTER("my_fread"); - DBUG_PRINT("my",("stream: 0x%lx Buffer: 0x%lx Count: %u MyFlags: %lu", - (long) stream, (long) Buffer, (uint) Count, MyFlags)); + DBUG_PRINT("my",("stream: %p Buffer %p Count: %u MyFlags: %lu", + stream, Buffer, (uint) Count, MyFlags)); if ((readbytes= fread(Buffer, sizeof(char), Count, stream)) != Count) { @@ -94,8 +94,8 @@ size_t my_fwrite(FILE *stream, const uchar *Buffer, size_t Count, myf MyFlags) uint errors; #endif DBUG_ENTER("my_fwrite"); - DBUG_PRINT("my",("stream: 0x%lx Buffer: 0x%lx Count: %u MyFlags: %lu", - (long) stream, (long) Buffer, (uint) Count, MyFlags)); + DBUG_PRINT("my",("stream:%p Buffer:%p Count: %u MyFlags: %lu", + stream, Buffer, (uint) Count, MyFlags)); #if !defined(NO_BACKGROUND) && defined(USE_MY_STREAM) errors=0; @@ -163,8 +163,8 @@ my_off_t my_fseek(FILE *stream, my_off_t pos, int whence, myf MyFlags __attribute__((unused))) { DBUG_ENTER("my_fseek"); - DBUG_PRINT("my",("stream: 0x%lx pos: %lu whence: %d MyFlags: %lu", - (long) stream, (long) pos, whence, MyFlags)); + DBUG_PRINT("my",("stream:%p pos: %llu whence: %d MyFlags: %lu", + stream, (ulonglong) pos, whence, MyFlags)); DBUG_RETURN(fseek(stream, (off_t) pos, whence) ? MY_FILEPOS_ERROR : (my_off_t) ftell(stream)); } /* my_seek */ @@ -174,11 +174,11 @@ my_off_t my_fseek(FILE *stream, my_off_t pos, int whence, my_off_t my_ftell(FILE *stream, myf MyFlags __attribute__((unused))) { - off_t pos; + long long pos; DBUG_ENTER("my_ftell"); - DBUG_PRINT("my",("stream: 0x%lx MyFlags: %lu", (long) stream, MyFlags)); - pos=ftell(stream); - DBUG_PRINT("exit",("ftell: %lu",(ulong) pos)); + DBUG_PRINT("my",("stream:%p MyFlags: %lu", stream, MyFlags)); + pos=IF_WIN(_ftelli64(stream),ftell(stream)); + DBUG_PRINT("exit",("ftell: %lld",pos)); DBUG_RETURN((my_off_t) pos); } /* my_ftell */ diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index bfa28f1d372..46710e79f62 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -48,8 +48,8 @@ int my_getwd(char * buf, size_t size, myf MyFlags) { char * pos; DBUG_ENTER("my_getwd"); - DBUG_PRINT("my",("buf: 0x%lx size: %u MyFlags %lu", - (long) buf, (uint) size, MyFlags)); + DBUG_PRINT("my",("buf:%p size: %u MyFlags %lu", + buf, (uint) size, MyFlags)); if (size < 1) DBUG_RETURN(-1); diff --git a/mysys/my_init.c b/mysys/my_init.c index 84489a994e3..86775275f23 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -253,8 +253,6 @@ void my_parameter_handler(const wchar_t * expression, const wchar_t * function, const wchar_t * file, unsigned int line, uintptr_t pReserved) { - DBUG_PRINT("my",("Expression: %s function: %s file: %s, line: %d", - expression, function, file, line)); __debugbreak(); } diff --git a/mysys/my_lib.c b/mysys/my_lib.c index abc7b8a3161..d5f54f00b85 100644 --- a/mysys/my_lib.c +++ b/mysys/my_lib.c @@ -221,7 +221,7 @@ MY_DIR *my_dir(const char *path, myf MyFlags) long handle; #endif DBUG_ENTER("my_dir"); - DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags)); + DBUG_PRINT("my",("path: '%s' MyFlags: %d",path,MyFlags)); /* Put LIB-CHAR as last path-character if not there */ tmp_file=tmp_path; @@ -347,8 +347,8 @@ MY_STAT *my_stat(const char *path, MY_STAT *stat_area, myf my_flags) { int m_used; DBUG_ENTER("my_stat"); - DBUG_PRINT("my", ("path: '%s' stat_area: 0x%lx MyFlags: %lu", path, - (long) stat_area, my_flags)); + DBUG_PRINT("my", ("path: '%s' stat_area: %p MyFlags: %lu", path, + stat_area, my_flags)); if ((m_used= (stat_area == NULL))) if (!(stat_area= (MY_STAT *) my_malloc(sizeof(MY_STAT), my_flags))) diff --git a/mysys/my_safehash.c b/mysys/my_safehash.c index c34f3c456cd..e50c5105875 100644 --- a/mysys/my_safehash.c +++ b/mysys/my_safehash.c @@ -166,7 +166,7 @@ uchar *safe_hash_search(SAFE_HASH *hash, const uchar *key, uint length, result= def; else result= ((SAFE_HASH_ENTRY*) result)->data; - DBUG_PRINT("exit",("data: 0x%lx", (long) result)); + DBUG_PRINT("exit",("data: %p", result)); DBUG_RETURN(result); } @@ -197,7 +197,7 @@ my_bool safe_hash_set(SAFE_HASH *hash, const uchar *key, uint length, SAFE_HASH_ENTRY *entry; my_bool error= 0; DBUG_ENTER("safe_hash_set"); - DBUG_PRINT("enter",("key: %.*s data: 0x%lx", length, key, (long) data)); + DBUG_PRINT("enter",("key: %.*s data: %p", length, key, data)); mysql_rwlock_wrlock(&hash->mutex); entry= (SAFE_HASH_ENTRY*) my_hash_search(&hash->hash, key, length); diff --git a/mysys/my_winthread.c b/mysys/my_winthread.c index 31385fad360..f3335621c38 100644 --- a/mysys/my_winthread.c +++ b/mysys/my_winthread.c @@ -121,6 +121,15 @@ int pthread_join(pthread_t thread, void **value_ptr) goto error_return; } + if (!GetExitCodeThread(handle, &ret)) + { + errno= EINVAL; + goto error_return; + } + + if (value_ptr) + *value_ptr= (void *)(size_t)ret; + CloseHandle(handle); return 0; diff --git a/mysys/thr_lock.c b/mysys/thr_lock.c index 25113670015..5cf81bcc93e 100644 --- a/mysys/thr_lock.c +++ b/mysys/thr_lock.c @@ -760,9 +760,9 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout) PSI_TABLE_LOCK, lock_type); mysql_mutex_lock(&lock->mutex); - DBUG_PRINT("lock",("data: 0x%lx thread: 0x%lx lock: 0x%lx type: %d", - (long) data, (ulong) data->owner->thread_id, - (long) lock, (int) lock_type)); + DBUG_PRINT("lock",("data:%p thread:%lu lock:%p type: %d", + data, (ulong) data->owner->thread_id, + lock, (int) lock_type)); check_locks(lock,(uint) lock_type <= (uint) TL_READ_NO_INSERT ? "enter read_lock" : "enter write_lock", lock_type, 0); if ((int) lock_type <= (int) TL_READ_NO_INSERT) @@ -797,7 +797,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout) See Bug#42147 for more information. */ - DBUG_PRINT("lock",("write locked 1 by thread: 0x%lx", + DBUG_PRINT("lock",("write locked 1 by thread:%lu", (ulong) lock->write.data->owner->thread_id)); if (thr_lock_owner_equal(data->owner, lock->write.data->owner) || (lock->write.data->type <= TL_WRITE_DELAYED && @@ -942,8 +942,8 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout) ! lock->read_no_write_count) || has_old_lock(lock->write.data, data->owner)) { - DBUG_PRINT("info", ("write_wait.data: 0x%lx old_type: %d", - (ulong) lock->write_wait.data, + DBUG_PRINT("info", ("write_wait.data: %p old_type: %d", + lock->write_wait.data, lock->write.data->type)); (*lock->write.last)=data; /* Add to running fifo */ @@ -956,13 +956,13 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout) statistic_increment(locks_immediate,&THR_LOCK_lock); goto end; } - DBUG_PRINT("lock",("write locked 2 by thread: 0x%lx", + DBUG_PRINT("lock",("write locked 2 by thread: %lu", (ulong) lock->write.data->owner->thread_id)); } else { - DBUG_PRINT("info", ("write_wait.data: 0x%lx", - (ulong) lock->write_wait.data)); + DBUG_PRINT("info", ("write_wait.data:%p", + lock->write_wait.data)); if (!lock->write_wait.data) { /* no scheduled write locks */ my_bool concurrent_insert= 0; @@ -992,7 +992,7 @@ thr_lock(THR_LOCK_DATA *data, THR_LOCK_INFO *owner, ulong lock_wait_timeout) goto end; } } - DBUG_PRINT("lock",("write locked 3 by thread: 0x%lx type: %d", + DBUG_PRINT("lock",("write locked 3 by thread:%lu type: %d", (ulong) lock->read.data->owner->thread_id, data->type)); } @@ -1058,8 +1058,8 @@ static inline void free_all_read_locks(THR_LOCK *lock, lock->read_no_write_count++; } /* purecov: begin inspected */ - DBUG_PRINT("lock",("giving read lock to thread: 0x%lx", - (ulong) data->owner->thread_id)); + DBUG_PRINT("lock",("giving read lock to thread: %lu", + (ulong)data->owner->thread_id)); /* purecov: end */ data->cond=0; /* Mark thread free */ mysql_cond_signal(cond); @@ -1077,7 +1077,7 @@ void thr_unlock(THR_LOCK_DATA *data, uint unlock_flags) THR_LOCK *lock=data->lock; enum thr_lock_type lock_type=data->type; DBUG_ENTER("thr_unlock"); - DBUG_PRINT("lock",("data: %p thread: 0x%lx lock: %p", + DBUG_PRINT("lock",("data: %p thread: %lu lock: %p", data, (ulong) data->owner->thread_id, lock)); mysql_mutex_lock(&lock->mutex); @@ -1171,7 +1171,7 @@ static void wake_up_waiters(THR_LOCK *lock) (*lock->check_status)(data->status_param)) data->type=TL_WRITE; /* Upgrade lock */ /* purecov: begin inspected */ - DBUG_PRINT("lock",("giving write lock of type %d to thread: 0x%lx", + DBUG_PRINT("lock",("giving write lock of type %d to thread: %lu", data->type, (ulong) data->owner->thread_id)); /* purecov: end */ { @@ -1280,7 +1280,7 @@ thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner, { THR_LOCK_DATA **pos, **end, **first_lock; DBUG_ENTER("thr_multi_lock"); - DBUG_PRINT("lock",("data: 0x%lx count: %d", (long) data, count)); + DBUG_PRINT("lock",("data: %p count: %d", data, count)); if (count > 1) sort_locks(data,count); @@ -1301,8 +1301,8 @@ thr_multi_lock(THR_LOCK_DATA **data, uint count, THR_LOCK_INFO *owner, DBUG_RETURN(result); } #ifdef MAIN - printf("Thread: %s Got lock: 0x%lx type: %d\n",my_thread_name(), - (long) pos[0]->lock, pos[0]->type); fflush(stdout); + printf("Thread: %s Got lock:%p type: %d\n",my_thread_name(), + pos[0]->lock, pos[0]->type); fflush(stdout); #endif } DEBUG_SYNC_C("thr_multi_lock_after_thr_lock"); @@ -1401,21 +1401,21 @@ void thr_multi_unlock(THR_LOCK_DATA **data,uint count, uint unlock_flags) { THR_LOCK_DATA **pos,**end; DBUG_ENTER("thr_multi_unlock"); - DBUG_PRINT("lock",("data: 0x%lx count: %d flags: %u", (long) data, count, + DBUG_PRINT("lock",("data: %p count: %d flags: %u", data, count, unlock_flags)); for (pos=data,end=data+count; pos < end ; pos++) { #ifdef MAIN - printf("Thread: %s Rel lock: 0x%lx type: %d\n", - my_thread_name(), (long) pos[0]->lock, pos[0]->type); + printf("Thread: %s Rel lock: %p type: %d\n", + my_thread_name(), pos[0]->lock, pos[0]->type); fflush(stdout); #endif if ((*pos)->type != TL_UNLOCK) thr_unlock(*pos, unlock_flags); else { - DBUG_PRINT("lock",("Free lock: data: %p thread: 0x%lx lock: %p", + DBUG_PRINT("lock",("Free lock: data: %p thread:%lu lock: %p", *pos, (ulong) (*pos)->owner->thread_id, (*pos)->lock)); } @@ -1689,7 +1689,7 @@ void thr_print_locks(void) { THR_LOCK *lock=(THR_LOCK*) list->data; mysql_mutex_lock(&lock->mutex); - printf("lock: 0x%lx:",(ulong) lock); + printf("lock:%p:", lock); if ((lock->write_wait.data || lock->read_wait.data) && (! lock->read.data && ! lock->write.data)) printf(" WARNING: "); diff --git a/mysys/tree.c b/mysys/tree.c index 5eaeb30037d..c71925df7db 100644 --- a/mysys/tree.c +++ b/mysys/tree.c @@ -90,7 +90,7 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, myf my_flags) { DBUG_ENTER("init_tree"); - DBUG_PRINT("enter",("tree: 0x%lx size: %d", (long) tree, size)); + DBUG_PRINT("enter",("tree: %p size: %d", tree, size)); if (default_alloc_size < DEFAULT_ALLOC_SIZE) default_alloc_size= DEFAULT_ALLOC_SIZE; @@ -139,7 +139,7 @@ void init_tree(TREE *tree, size_t default_alloc_size, size_t memory_limit, static void free_tree(TREE *tree, myf free_flags) { DBUG_ENTER("free_tree"); - DBUG_PRINT("enter",("tree: 0x%lx", (long) tree)); + DBUG_PRINT("enter",("tree: %p", tree)); if (tree->root) /* If initialized */ { diff --git a/mysys/typelib.c b/mysys/typelib.c index 96842b1a3ad..a256c26f048 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -88,7 +88,7 @@ static int find_type_eol(const char **x, const TYPELIB *typelib, uint flags, const char *j; CHARSET_INFO *cs= &my_charset_latin1; DBUG_ENTER("find_type_eol"); - DBUG_PRINT("enter",("x: '%s' lib: 0x%lx", *x, (long) typelib)); + DBUG_PRINT("enter",("x: '%s' lib: %p", *x, typelib)); DBUG_ASSERT(!(flags & ~(FIND_TYPE_NO_PREFIX | FIND_TYPE_COMMA_TERM))); @@ -200,7 +200,7 @@ my_ulonglong find_typeset(char *x, TYPELIB *lib, int *err) int find; char *i; DBUG_ENTER("find_set"); - DBUG_PRINT("enter",("x: '%s' lib: 0x%lx", x, (long) lib)); + DBUG_PRINT("enter",("x: '%s' lib: %p", x, lib)); if (!lib->count) { diff --git a/mysys/wqueue.c b/mysys/wqueue.c index 1dafc03b935..8bc28111655 100644 --- a/mysys/wqueue.c +++ b/mysys/wqueue.c @@ -224,17 +224,17 @@ void wqueue_add_and_wait(WQUEUE *wqueue, { DBUG_ENTER("wqueue_add_and_wait"); DBUG_PRINT("enter", - ("thread: 0x%lx cond: 0x%lx mutex: 0x%lx", - (ulong) thread, (ulong) &thread->suspend, (ulong) lock)); + ("thread: %p cond: %p mutex: %p", + thread, &thread->suspend, lock)); wqueue_add_to_queue(wqueue, thread); do { - DBUG_PRINT("info", ("wait... cond: 0x%lx mutex: 0x%lx", - (ulong) &thread->suspend, (ulong) lock)); + DBUG_PRINT("info", ("wait... cond: %p mutex: %p", + &thread->suspend, lock)); mysql_cond_wait(&thread->suspend, lock); - DBUG_PRINT("info", ("wait done cond: 0x%lx mutex: 0x%lx next: 0x%lx", - (ulong) &thread->suspend, (ulong) lock, - (ulong) thread->next)); + DBUG_PRINT("info", ("wait done cond: %p mutex: %p next: %p", + &thread->suspend, lock, + thread->next)); } while (thread->next); DBUG_VOID_RETURN; |