diff options
author | Calvin Sun <calvin.sun@oracle.com> | 2010-10-28 00:34:53 -0500 |
---|---|---|
committer | Calvin Sun <calvin.sun@oracle.com> | 2010-10-28 00:34:53 -0500 |
commit | c441f79acf7847e7be68b98678ab7846cc6de0ab (patch) | |
tree | 23a1f0f0914e75b751ef73e3b9a30b8b2ec0942f /storage/innobase/os | |
parent | b5819779f8585a95e445cd628f6b78798f08d1bc (diff) | |
download | mariadb-git-c441f79acf7847e7be68b98678ab7846cc6de0ab.tar.gz |
Bug#52062: Compiler warning in os0file.c on windows 64-bit
On Windows, the parameter for number of bytes passed into WriteFile()
and ReadFile() is DWORD. Casting is needed to silence the warning on
64-bit Windows.
Also, adding several asserts to ensure the variable for number of bytes
is no more than 32 bits, even on 64-bit Windows.
rb://415
Approved by: Inaam
Diffstat (limited to 'storage/innobase/os')
-rw-r--r-- | storage/innobase/os/os0file.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index 3d1577fe3ca..93d2f72746d 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -2400,7 +2400,10 @@ os_file_read_func( ulint i; #endif /* !UNIV_HOTBACKUP */ + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2526,7 +2529,10 @@ os_file_read_no_error_handling_func( ulint i; #endif /* !UNIV_HOTBACKUP */ + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_reads++; os_bytes_read_since_printout += n; @@ -2658,7 +2664,10 @@ os_file_write_func( ulint i; #endif /* !UNIV_HOTBACKUP */ - ut_a((offset & 0xFFFFFFFF) == offset); + /* On 64-bit Windows, ulint is 64 bits. But offset and n should be + no more than 32 bits. */ + ut_a((offset & 0xFFFFFFFFUL) == offset); + ut_a((n & 0xFFFFFFFFUL) == n); os_n_file_writes++; @@ -3621,6 +3630,10 @@ os_aio_array_reserve_slot( ulint slots_per_seg; ulint local_seg; +#ifdef WIN_ASYNC_IO + ut_a((len & 0xFFFFFFFFUL) == len); +#endif + /* No need of a mutex. Only reading constant fields */ slots_per_seg = array->n_slots / array->n_segments; @@ -3996,6 +4009,9 @@ os_aio_func( ut_ad(n % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0); ut_ad(os_aio_validate()); +#ifdef WIN_ASYNC_IO + ut_ad((n & 0xFFFFFFFFUL) == n); +#endif wake_later = mode & OS_AIO_SIMULATED_WAKE_LATER; mode = mode & (~OS_AIO_SIMULATED_WAKE_LATER); @@ -4271,16 +4287,18 @@ os_aio_windows_handle( __FILE__, __LINE__); #endif + ut_a((slot->len & 0xFFFFFFFFUL) == slot->len); + switch (slot->type) { case OS_FILE_WRITE: ret = WriteFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; case OS_FILE_READ: ret = ReadFile(slot->file, slot->buf, - slot->len, &len, + (DWORD) slot->len, &len, &(slot->control)); break; |