diff options
author | unknown <vvaintroub/Wlad@vaio.> | 2008-01-11 15:45:18 +0100 |
---|---|---|
committer | unknown <vvaintroub/Wlad@vaio.> | 2008-01-11 15:45:18 +0100 |
commit | 45500a70f09767cd0d3d973610c1289b60dc94c8 (patch) | |
tree | 5097719cb90f7f8d37f6dc504d6085a83afef342 | |
parent | 266fde77b283237fa2dd6db0f97fb68289fe0c21 (diff) | |
download | mariadb-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
-rwxr-xr-x | CMakeLists.txt | 3 | ||||
-rw-r--r-- | storage/maria/ma_blockrec.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.c | 18 | ||||
-rw-r--r-- | storage/maria/ma_pagecache.c | 2 | ||||
-rw-r--r-- | storage/maria/ma_recovery.c | 9 | ||||
-rw-r--r-- | win/configure.js | 17 |
6 files changed, 37 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e4ec57a53cf..4e82ecdd615 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,9 @@ IF(WITH_FEDERATED_STORAGE_ENGINE) ENDIF(WITH_FEDERATED_STORAGE_ENGINE) IF(WITH_MARIA_STORAGE_ENGINE) ADD_DEFINITIONS(-DWITH_MARIA_STORAGE_ENGINE) + IF(WITH_MARIA_TMP_TABLES) + ADD_DEFINITIONS(-DUSE_MARIA_FOR_TMP_TABLES) + ENDIF(WITH_MARIA_TMP_TABLES) SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_maria_plugin") ENDIF(WITH_MARIA_STORAGE_ENGINE) diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index f806d80e23a..00c5511e9d3 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -4998,7 +4998,7 @@ restart_bitmap_scan: if (pattern > 0 && pattern <= 4) { /* Found head page; Read it */ - ulong page; + pgcache_page_no_t page; info->scan.bitmap_pos= data; info->scan.bits= bits; info->scan.bit_pos= bit_pos; diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 4f6c18583da..04d991df9b5 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -1576,8 +1576,7 @@ static void translog_new_page_header(TRANSLOG_ADDRESS *horizon, have such "random" for this purpose and it will not interfere with higher level pseudo random value generator */ - uint16 tmp_time= time(NULL); - ptr[0]= tmp_time & 0xFF; + ptr[0]= (uchar)time(NULL); ptr+= TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE; } { @@ -2611,7 +2610,7 @@ static my_bool translog_page_validator(uchar *page, uchar *page_pos; TRANSLOG_FILE *data= (TRANSLOG_FILE *) data_ptr; #ifndef DBUG_OFF - uint32 offset= page_no * TRANSLOG_PAGE_SIZE; + pgcache_page_no_t offset= page_no * TRANSLOG_PAGE_SIZE; #endif DBUG_ENTER("translog_page_validator"); @@ -4759,26 +4758,26 @@ static uchar *translog_put_LSN_diff(LSN base_lsn, LSN lsn, uchar *dst) Note we store this high uchar first to ensure that first uchar has 0 in the 3 upper bits. */ - dst[0]= diff >> 8; - dst[1]= (diff & 0xFF); + dst[0]= (uchar)(diff >> 8); + dst[1]= (uchar)(diff & 0xFF); } else if (diff <= 0x3FFFFFL) { dst-= 3; - dst[0]= 0x40 | (diff >> 16); + dst[0]= (uchar)(0x40 | (diff >> 16)); int2store(dst + 1, diff & 0xFFFF); } else if (diff <= 0x3FFFFFFFL) { dst-= 4; - dst[0]= 0x80 | (diff >> 24); + dst[0]= (uchar)(0x80 | (diff >> 24)); int3store(dst + 1, diff & 0xFFFFFFL); } else if (diff <= LL(0x3FFFFFFFFF)) { dst-= 5; - dst[0]= 0xC0 | (diff >> 32); + dst[0]= (uchar)(0xC0 | (diff >> 32)); int4store(dst + 1, diff & 0xFFFFFFFFL); } else @@ -4874,7 +4873,8 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst) base_offset+= LL(0x100000000); } file_no= LSN_FILE_NO(base_lsn) - first_byte; - rec_offset= base_offset - diff; + DBUG_ASSERT(base_offset - diff <= UINT_MAX); + rec_offset= (uint32)(base_offset - diff); break; } default: diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index b8482f17c27..0ffd0ae2242 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -3229,7 +3229,7 @@ my_bool pagecache_delete_pages(PAGECACHE *pagecache, enum pagecache_page_lock lock, my_bool flush) { - ulong page_end; + pgcache_page_no_t page_end; DBUG_ENTER("pagecache_delete_pages"); DBUG_ASSERT(page_count > 0); 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)) diff --git a/win/configure.js b/win/configure.js index e4825ba8924..f3a30ec9686 100644 --- a/win/configure.js +++ b/win/configure.js @@ -32,6 +32,7 @@ try var default_comment = "Source distribution"; var default_port = GetValue(configureIn, "MYSQL_TCP_PORT_DEFAULT"); var actual_port = 0; + var with_maria_tmp_tables = -1; var configfile = fso.CreateTextFile("win\\configure.data", true); for (i=0; i < args.Count(); i++) @@ -45,13 +46,23 @@ try case "WITH_FEDERATED_STORAGE_ENGINE": case "WITH_INNOBASE_STORAGE_ENGINE": case "WITH_PARTITION_STORAGE_ENGINE": - case "WITH_MARIA_STORAGE_ENGINE": case "__NT__": case "CYBOZU": case "EMBED_MANIFESTS": case "WITH_EMBEDDED_SERVER": configfile.WriteLine("SET (" + args.Item(i) + " TRUE)"); break; + case "WITH_MARIA_STORAGE_ENGINE": + configfile.WriteLine("SET (" + args.Item(i) + " TRUE)"); + if(with_maria_tmp_tables == -1) + { + with_maria_tmp_tables = 1; + } + break; + case "WITH_MARIA_TMP_TABLES": + with_maria_tmp_tables = ( parts.length == 1 || + parts[1] == "YES" || parts[1] == "TRUE"); + break; case "MYSQL_SERVER_SUFFIX": case "MYSQLD_EXE_SUFFIX": configfile.WriteLine("SET (" + parts[0] + " \"" @@ -65,6 +76,10 @@ try break; } } + if (with_maria_tmp_tables == 1) + { + configfile.WriteLine("SET (WITH_MARIA_TMP_TABLES TRUE)"); + } if (actual_port == 0) { // if we actually defaulted (as opposed to the pathological case of |