Commit 45500a70 authored by unknown's avatar unknown

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
parent 266fde77
...@@ -77,6 +77,9 @@ IF(WITH_FEDERATED_STORAGE_ENGINE) ...@@ -77,6 +77,9 @@ IF(WITH_FEDERATED_STORAGE_ENGINE)
ENDIF(WITH_FEDERATED_STORAGE_ENGINE) ENDIF(WITH_FEDERATED_STORAGE_ENGINE)
IF(WITH_MARIA_STORAGE_ENGINE) IF(WITH_MARIA_STORAGE_ENGINE)
ADD_DEFINITIONS(-DWITH_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") SET (mysql_plugin_defs "${mysql_plugin_defs},builtin_maria_plugin")
ENDIF(WITH_MARIA_STORAGE_ENGINE) ENDIF(WITH_MARIA_STORAGE_ENGINE)
......
...@@ -4998,7 +4998,7 @@ restart_bitmap_scan: ...@@ -4998,7 +4998,7 @@ restart_bitmap_scan:
if (pattern > 0 && pattern <= 4) if (pattern > 0 && pattern <= 4)
{ {
/* Found head page; Read it */ /* Found head page; Read it */
ulong page; pgcache_page_no_t page;
info->scan.bitmap_pos= data; info->scan.bitmap_pos= data;
info->scan.bits= bits; info->scan.bits= bits;
info->scan.bit_pos= bit_pos; info->scan.bit_pos= bit_pos;
......
...@@ -1576,8 +1576,7 @@ static void translog_new_page_header(TRANSLOG_ADDRESS *horizon, ...@@ -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 have such "random" for this purpose and it will not interfere with
higher level pseudo random value generator higher level pseudo random value generator
*/ */
uint16 tmp_time= time(NULL); ptr[0]= (uchar)time(NULL);
ptr[0]= tmp_time & 0xFF;
ptr+= TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE; ptr+= TRANSLOG_PAGE_SIZE / DISK_DRIVE_SECTOR_SIZE;
} }
{ {
...@@ -2611,7 +2610,7 @@ static my_bool translog_page_validator(uchar *page, ...@@ -2611,7 +2610,7 @@ static my_bool translog_page_validator(uchar *page,
uchar *page_pos; uchar *page_pos;
TRANSLOG_FILE *data= (TRANSLOG_FILE *) data_ptr; TRANSLOG_FILE *data= (TRANSLOG_FILE *) data_ptr;
#ifndef DBUG_OFF #ifndef DBUG_OFF
uint32 offset= page_no * TRANSLOG_PAGE_SIZE; pgcache_page_no_t offset= page_no * TRANSLOG_PAGE_SIZE;
#endif #endif
DBUG_ENTER("translog_page_validator"); DBUG_ENTER("translog_page_validator");
...@@ -4759,26 +4758,26 @@ static uchar *translog_put_LSN_diff(LSN base_lsn, LSN lsn, uchar *dst) ...@@ -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 Note we store this high uchar first to ensure that first uchar has
0 in the 3 upper bits. 0 in the 3 upper bits.
*/ */
dst[0]= diff >> 8; dst[0]= (uchar)(diff >> 8);
dst[1]= (diff & 0xFF); dst[1]= (uchar)(diff & 0xFF);
} }
else if (diff <= 0x3FFFFFL) else if (diff <= 0x3FFFFFL)
{ {
dst-= 3; dst-= 3;
dst[0]= 0x40 | (diff >> 16); dst[0]= (uchar)(0x40 | (diff >> 16));
int2store(dst + 1, diff & 0xFFFF); int2store(dst + 1, diff & 0xFFFF);
} }
else if (diff <= 0x3FFFFFFFL) else if (diff <= 0x3FFFFFFFL)
{ {
dst-= 4; dst-= 4;
dst[0]= 0x80 | (diff >> 24); dst[0]= (uchar)(0x80 | (diff >> 24));
int3store(dst + 1, diff & 0xFFFFFFL); int3store(dst + 1, diff & 0xFFFFFFL);
} }
else if (diff <= LL(0x3FFFFFFFFF)) else if (diff <= LL(0x3FFFFFFFFF))
{ {
dst-= 5; dst-= 5;
dst[0]= 0xC0 | (diff >> 32); dst[0]= (uchar)(0xC0 | (diff >> 32));
int4store(dst + 1, diff & 0xFFFFFFFFL); int4store(dst + 1, diff & 0xFFFFFFFFL);
} }
else else
...@@ -4874,7 +4873,8 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst) ...@@ -4874,7 +4873,8 @@ static uchar *translog_get_LSN_from_diff(LSN base_lsn, uchar *src, uchar *dst)
base_offset+= LL(0x100000000); base_offset+= LL(0x100000000);
} }
file_no= LSN_FILE_NO(base_lsn) - first_byte; 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; break;
} }
default: default:
......
...@@ -3229,7 +3229,7 @@ my_bool pagecache_delete_pages(PAGECACHE *pagecache, ...@@ -3229,7 +3229,7 @@ my_bool pagecache_delete_pages(PAGECACHE *pagecache,
enum pagecache_page_lock lock, enum pagecache_page_lock lock,
my_bool flush) my_bool flush)
{ {
ulong page_end; pgcache_page_no_t page_end;
DBUG_ENTER("pagecache_delete_pages"); DBUG_ENTER("pagecache_delete_pages");
DBUG_ASSERT(page_count > 0); DBUG_ASSERT(page_count > 0);
......
...@@ -2840,15 +2840,20 @@ static LSN parse_checkpoint_record(LSN lsn) ...@@ -2840,15 +2840,20 @@ static LSN parse_checkpoint_record(LSN lsn)
/* dirty pages */ /* dirty pages */
nb_dirty_pages= uint8korr(ptr); 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; ptr+= 8;
tprint(tracef, "%lu dirty pages\n", (ulong) nb_dirty_pages); 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), offsetof(struct st_dirty_page, file_and_page_id),
sizeof(((struct st_dirty_page *)NULL)->file_and_page_id), sizeof(((struct st_dirty_page *)NULL)->file_and_page_id),
NULL, NULL, 0)) NULL, NULL, 0))
return LSN_ERROR; return LSN_ERROR;
dirty_pages_pool= 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), sizeof(struct st_dirty_page),
MYF(MY_WME)); MYF(MY_WME));
if (unlikely(dirty_pages_pool == NULL)) if (unlikely(dirty_pages_pool == NULL))
......
...@@ -32,6 +32,7 @@ try ...@@ -32,6 +32,7 @@ try
var default_comment = "Source distribution"; var default_comment = "Source distribution";
var default_port = GetValue(configureIn, "MYSQL_TCP_PORT_DEFAULT"); var default_port = GetValue(configureIn, "MYSQL_TCP_PORT_DEFAULT");
var actual_port = 0; var actual_port = 0;
var with_maria_tmp_tables = -1;
var configfile = fso.CreateTextFile("win\\configure.data", true); var configfile = fso.CreateTextFile("win\\configure.data", true);
for (i=0; i < args.Count(); i++) for (i=0; i < args.Count(); i++)
...@@ -45,13 +46,23 @@ try ...@@ -45,13 +46,23 @@ try
case "WITH_FEDERATED_STORAGE_ENGINE": case "WITH_FEDERATED_STORAGE_ENGINE":
case "WITH_INNOBASE_STORAGE_ENGINE": case "WITH_INNOBASE_STORAGE_ENGINE":
case "WITH_PARTITION_STORAGE_ENGINE": case "WITH_PARTITION_STORAGE_ENGINE":
case "WITH_MARIA_STORAGE_ENGINE":
case "__NT__": case "__NT__":
case "CYBOZU": case "CYBOZU":
case "EMBED_MANIFESTS": case "EMBED_MANIFESTS":
case "WITH_EMBEDDED_SERVER": case "WITH_EMBEDDED_SERVER":
configfile.WriteLine("SET (" + args.Item(i) + " TRUE)"); configfile.WriteLine("SET (" + args.Item(i) + " TRUE)");
break; 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 "MYSQL_SERVER_SUFFIX":
case "MYSQLD_EXE_SUFFIX": case "MYSQLD_EXE_SUFFIX":
configfile.WriteLine("SET (" + parts[0] + " \"" configfile.WriteLine("SET (" + parts[0] + " \""
...@@ -65,6 +76,10 @@ try ...@@ -65,6 +76,10 @@ try
break; break;
} }
} }
if (with_maria_tmp_tables == 1)
{
configfile.WriteLine("SET (WITH_MARIA_TMP_TABLES TRUE)");
}
if (actual_port == 0) if (actual_port == 0)
{ {
// if we actually defaulted (as opposed to the pathological case of // if we actually defaulted (as opposed to the pathological case of
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment