summaryrefslogtreecommitdiff
path: root/storage/innobase/os
diff options
context:
space:
mode:
authorCalvin Sun <calvin.sun@oracle.com>2010-10-27 23:18:59 -0500
committerCalvin Sun <calvin.sun@oracle.com>2010-10-27 23:18:59 -0500
commit16feea410975e17c3cf24f8af92a3f32e8c24ba1 (patch)
tree559bda7002402eb6a71ca9de6a4674e2d302d859 /storage/innobase/os
parent4bf273c8f19b619f36e7f8cb1188c08cbce8a196 (diff)
downloadmariadb-git-16feea410975e17c3cf24f8af92a3f32e8c24ba1.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. This is for built-in InnoDB. rb://415 Approved by: Inaam
Diffstat (limited to 'storage/innobase/os')
-rw-r--r--storage/innobase/os/os0file.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
index f269cd39673..566c50381e7 100644
--- a/storage/innobase/os/os0file.c
+++ b/storage/innobase/os/os0file.c
@@ -2207,7 +2207,10 @@ os_file_read(
ibool retry;
ulint i;
+ /* 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;
@@ -2324,7 +2327,10 @@ os_file_read_no_error_handling(
ibool retry;
ulint i;
+ /* 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;
@@ -2447,7 +2453,10 @@ os_file_write(
ulint n_retries = 0;
ulint err;
- 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++;
@@ -3245,14 +3254,16 @@ os_aio_array_reserve_slot(
ulint len) /* in: length of the block to read or write */
{
os_aio_slot_t* slot;
+ ulint i;
#ifdef WIN_ASYNC_IO
OVERLAPPED* control;
+ ut_a((len & 0xFFFFFFFFUL) == len);
#elif defined(POSIX_ASYNC_IO)
struct aiocb* control;
#endif
- ulint i;
+
loop:
os_mutex_enter(array->mutex);
@@ -3517,6 +3528,9 @@ os_aio(
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);
@@ -3765,16 +3779,18 @@ os_aio_windows_handle(
/* retry failed read/write operation synchronously.
No need to hold array->mutex. */
+ 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;