summaryrefslogtreecommitdiff
path: root/storage/maria/ma_recovery.c
diff options
context:
space:
mode:
authorunknown <vvaintroub/Wlad@vaio.>2008-01-11 15:45:18 +0100
committerunknown <vvaintroub/Wlad@vaio.>2008-01-11 15:45:18 +0100
commit45500a70f09767cd0d3d973610c1289b60dc94c8 (patch)
tree5097719cb90f7f8d37f6dc504d6085a83afef342 /storage/maria/ma_recovery.c
parent266fde77b283237fa2dd6db0f97fb68289fe0c21 (diff)
downloadmariadb-git-45500a70f09767cd0d3d973610c1289b60dc94c8.tar.gz
Fix windows warnings using correct datatypes if possible
and casts if not. Add optional WITH_MARIA_TMP_TABLES parameter to configure.js. This parameter defaults to true, if WITH_MARIA_STORAGE_ENGINE is present. CMakeLists.txt: Add WITH_MARIA_TMP_TABLES config parameter. storage/maria/ma_blockrec.c: Fix windows warning - use the correct datatype. storage/maria/ma_loghandler.c: Fix windows warnings by adding casts. storage/maria/ma_pagecache.c: Fix windows warning - use the correct datatype. storage/maria/ma_recovery.c: Fix windows warning by adding casts. win/configure.js: Add WITH_MARIA_TMP_TABLES. If WITH_MARIA_STORAGE_ENGINE is present, it defaults to TRUE. To unset, pass WITH_MARIA_TMP_TABLES=FALSE to configure.js
Diffstat (limited to 'storage/maria/ma_recovery.c')
-rw-r--r--storage/maria/ma_recovery.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c
index b4222def24b..2d97d97f9da 100644
--- a/storage/maria/ma_recovery.c
+++ b/storage/maria/ma_recovery.c
@@ -2840,15 +2840,20 @@ static LSN parse_checkpoint_record(LSN lsn)
/* dirty pages */
nb_dirty_pages= uint8korr(ptr);
+
+ /* Ensure casts later will not loose significant bits. */
+ DBUG_ASSERT((nb_dirty_pages <= SIZE_T_MAX/sizeof(struct st_dirty_page))
+ && (nb_dirty_pages <= ULONG_MAX));
+
ptr+= 8;
tprint(tracef, "%lu dirty pages\n", (ulong) nb_dirty_pages);
- if (hash_init(&all_dirty_pages, &my_charset_bin, nb_dirty_pages,
+ if (hash_init(&all_dirty_pages, &my_charset_bin, (ulong)nb_dirty_pages,
offsetof(struct st_dirty_page, file_and_page_id),
sizeof(((struct st_dirty_page *)NULL)->file_and_page_id),
NULL, NULL, 0))
return LSN_ERROR;
dirty_pages_pool=
- (struct st_dirty_page *)my_malloc(nb_dirty_pages *
+ (struct st_dirty_page *)my_malloc((size_t)nb_dirty_pages *
sizeof(struct st_dirty_page),
MYF(MY_WME));
if (unlikely(dirty_pages_pool == NULL))