Commit 86016aeb authored by unknown's avatar unknown

Fixes for windows compilation bugs

(After review of cs georg:1.1800 by Monty)


VC++Files/libmysqld/libmysqld.dsp:
  removed ha_isammrg.cpp (doesn't exist anymore)
VC++Files/mysqldemb/mysqldemb.dsp:
  removed ha_isammrg.cpp (doesn't exist anymore)
extra/comp_err.c:
  renamed DATADIR to DATADIRECTORY (DATADIR is a windows internal
  enumeration type)
innobase/ut/ut0ut.c:
  gettimeofday is not available under Windows. Added conditional define
  which uses GetLocalTime for windows
libmysql/libmysql.c:
  fixed prototype for setup_one_fetch_function which differed from
  function declaration.
  Fixed not supported unsigned __int64 to double conversion
sql/field.h:
  fixed typecast error (windows)
sql/item_sum.cc:
  fixed typecast errors (windows)
sql/key.cc:
  fixed typecast errors (windows)
sql/opt_range.cc:
  fixed not supported unsigned __int64 to double conversion
sql/sql_acl.cc:
  fixed typecast errors (windows)
sql/table.cc:
  fixed typecast errors (windows)
parent 99b8a16e
...@@ -228,10 +228,6 @@ SOURCE=..\sql\ha_innodb.cpp ...@@ -228,10 +228,6 @@ SOURCE=..\sql\ha_innodb.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\sql\ha_isammrg.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\ha_myisam.cpp SOURCE=..\sql\ha_myisam.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -169,10 +169,6 @@ SOURCE=..\sql\ha_innodb.cpp ...@@ -169,10 +169,6 @@ SOURCE=..\sql\ha_innodb.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\sql\ha_isammrg.cpp
# End Source File
# Begin Source File
SOURCE=..\sql\ha_myisam.cpp SOURCE=..\sql\ha_myisam.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -41,7 +41,7 @@ static char *HEADERFILE= (char*) "mysqld_error.h"; ...@@ -41,7 +41,7 @@ static char *HEADERFILE= (char*) "mysqld_error.h";
static char *NAMEFILE= (char*) "mysqld_ername.h"; static char *NAMEFILE= (char*) "mysqld_ername.h";
static char *STATEFILE= (char*) "sql_state.h"; static char *STATEFILE= (char*) "sql_state.h";
static char *TXTFILE= (char*) "../sql/share/errmsg.txt"; static char *TXTFILE= (char*) "../sql/share/errmsg.txt";
static char *DATADIR= (char*) "../sql/share/"; static char *DATADIRECTORY= (char*) "../sql/share/";
static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace"; static char *default_dbug_option= (char*) "d:t:O,/tmp/comp_err.trace";
/* Header for errmsg.sys files */ /* Header for errmsg.sys files */
...@@ -112,8 +112,8 @@ static struct my_option my_long_options[]= ...@@ -112,8 +112,8 @@ static struct my_option my_long_options[]=
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"in_file", 'F', "Input file", (gptr *) & TXTFILE, (gptr *) & TXTFILE, {"in_file", 'F', "Input file", (gptr *) & TXTFILE, (gptr *) & TXTFILE,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"out_dir", 'D', "Output base directory", (gptr *) & DATADIR, {"out_dir", 'D', "Output base directory", (gptr *) & DATADIRECTORY,
(gptr *) & DATADIR, (gptr *) & DATADIRECTORY,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"out_file", 'O', "Output filename (errmsg.sys)", (gptr *) & OUTFILE, {"out_file", 'O', "Output filename (errmsg.sys)", (gptr *) & OUTFILE,
(gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, (gptr *) & OUTFILE, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
...@@ -281,7 +281,7 @@ static int create_sys_files(struct languages *lang_head, ...@@ -281,7 +281,7 @@ static int create_sys_files(struct languages *lang_head,
DBUG_RETURN(1); DBUG_RETURN(1);
} }
outfile_end= strxmov(outfile, DATADIR, outfile_end= strxmov(outfile, DATADIRECTORY,
tmp_lang->lang_long_name, NullS); tmp_lang->lang_long_name, NullS);
if (!my_stat(outfile, &stat_info,MYF(0))) if (!my_stat(outfile, &stat_info,MYF(0)))
{ {
......
...@@ -82,10 +82,17 @@ ut_usectime( ...@@ -82,10 +82,17 @@ ut_usectime(
ulint* sec, /* out: seconds since the Epoch */ ulint* sec, /* out: seconds since the Epoch */
ulint* ms) /* out: microseconds since the Epoch+*sec */ ulint* ms) /* out: microseconds since the Epoch+*sec */
{ {
#ifdef __WIN__
SYSTEMTIME st;
GetLocalTime(&st);
*sec = (ulint) st.wSecond;
*ms = (ulint) st.wMilliseconds;
#else
struct timeval tv; struct timeval tv;
gettimeofday(&tv,NULL); gettimeofday(&tv,NULL);
*sec = (ulint) tv.tv_sec; *sec = (ulint) tv.tv_sec;
*ms = (ulint) tv.tv_usec; *ms = (ulint) tv.tv_usec;
#endif
} }
/************************************************************** /**************************************************************
......
...@@ -1740,7 +1740,7 @@ static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row); ...@@ -1740,7 +1740,7 @@ static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row);
STMT_ATTR_UPDATE_MAX_LENGTH attribute is set. STMT_ATTR_UPDATE_MAX_LENGTH attribute is set.
*/ */
static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data); static void stmt_update_metadata(MYSQL_STMT *stmt, MYSQL_ROWS *data);
static bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field); static my_bool setup_one_fetch_function(MYSQL_BIND *bind, MYSQL_FIELD *field);
/* /*
Maximum sizes of MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME Maximum sizes of MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, MYSQL_TYPE_DATETIME
...@@ -3718,7 +3718,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, ...@@ -3718,7 +3718,7 @@ static void fetch_float_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field,
longlongstore(buffer, data); longlongstore(buffer, data);
} }
*param->error= value != (param->is_unsigned ? *param->error= value != (param->is_unsigned ?
(double) (*(ulonglong*) buffer) : ulonglong2double(*(ulonglong*) buffer) :
(double) (*(longlong*) buffer)); (double) (*(longlong*) buffer));
break; break;
case MYSQL_TYPE_FLOAT: case MYSQL_TYPE_FLOAT:
......
...@@ -1228,7 +1228,7 @@ class Field_bit :public Field { ...@@ -1228,7 +1228,7 @@ class Field_bit :public Field {
int cmp(const char *a, const char *b) int cmp(const char *a, const char *b)
{ return cmp_binary(a, b); } { return cmp_binary(a, b); }
int key_cmp(const byte *a, const byte *b) int key_cmp(const byte *a, const byte *b)
{ return cmp_binary(a, b); } { return cmp_binary((char *) a, (char *) b); }
int key_cmp(const byte *str, uint length); int key_cmp(const byte *str, uint length);
int cmp_offset(uint row_offset); int cmp_offset(uint row_offset);
void get_key_image(char *buff, uint length, imagetype type); void get_key_image(char *buff, uint length, imagetype type);
......
...@@ -1234,7 +1234,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2) ...@@ -1234,7 +1234,7 @@ int composite_key_cmp(void* arg, byte* key1, byte* key2)
{ {
Field* f = *field; Field* f = *field;
int len = *lengths++; int len = *lengths++;
int res = f->cmp(key1, key2); int res = f->cmp((char *) key1, (char *) key2);
if (res) if (res)
return res; return res;
key1 += len; key1 += len;
...@@ -1688,7 +1688,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1, ...@@ -1688,7 +1688,7 @@ int group_concat_key_cmp_with_distinct(void* arg, byte* key1,
{ {
int res; int res;
uint offset= (uint) (field->ptr - record); uint offset= (uint) (field->ptr - record);
if ((res= field->cmp(key1 + offset, key2 + offset))) if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset)))
return res; return res;
} }
} }
...@@ -1722,7 +1722,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2) ...@@ -1722,7 +1722,7 @@ int group_concat_key_cmp_with_order(void* arg, byte* key1, byte* key2)
{ {
int res; int res;
uint offset= (uint) (field->ptr - record); uint offset= (uint) (field->ptr - record);
if ((res= field->cmp(key1 + offset, key2 + offset))) if ((res= field->cmp((char *) key1 + offset, (char *) key2 + offset)))
return (*order_item)->asc ? res : -res; return (*order_item)->asc ? res : -res;
} }
} }
......
...@@ -135,7 +135,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length) ...@@ -135,7 +135,7 @@ void key_copy(byte *to_key, byte *from_record, KEY *key_info, uint key_length)
{ {
key_length-= HA_KEY_BLOB_LENGTH; key_length-= HA_KEY_BLOB_LENGTH;
length= min(key_length, key_part->length); length= min(key_length, key_part->length);
key_part->field->get_key_image(to_key, length, Field::itRAW); key_part->field->get_key_image((char *) to_key, length, Field::itRAW);
to_key+= HA_KEY_BLOB_LENGTH; to_key+= HA_KEY_BLOB_LENGTH;
} }
else else
...@@ -217,7 +217,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info, ...@@ -217,7 +217,7 @@ void key_restore(byte *to_record, byte *from_key, KEY *key_info,
{ {
key_length-= HA_KEY_BLOB_LENGTH; key_length-= HA_KEY_BLOB_LENGTH;
length= min(key_length, key_part->length); length= min(key_length, key_part->length);
key_part->field->set_key_image(from_key, length); key_part->field->set_key_image((char *) from_key, length);
from_key+= HA_KEY_BLOB_LENGTH; from_key+= HA_KEY_BLOB_LENGTH;
} }
else else
......
...@@ -1891,7 +1891,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records) ...@@ -1891,7 +1891,7 @@ double get_sweep_read_cost(const PARAM *param, ha_rows records)
else else
{ {
double n_blocks= double n_blocks=
ceil((double)param->table->file->data_file_length / IO_SIZE); ceil(ulonglong2double(param->table->file->data_file_length) / IO_SIZE);
double busy_blocks= double busy_blocks=
n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, rows2double(records))); n_blocks * (1.0 - pow(1.0 - 1.0/n_blocks, rows2double(records)));
if (busy_blocks < 1.0) if (busy_blocks < 1.0)
......
...@@ -1494,12 +1494,12 @@ static bool update_user_table(THD *thd, const char *host, const char *user, ...@@ -1494,12 +1494,12 @@ static bool update_user_table(THD *thd, const char *host, const char *user,
DBUG_RETURN(1); /* purecov: deadcode */ DBUG_RETURN(1); /* purecov: deadcode */
table->field[0]->store(host,(uint) strlen(host), system_charset_info); table->field[0]->store(host,(uint) strlen(host), system_charset_info);
table->field[1]->store(user,(uint) strlen(user), system_charset_info); table->field[1]->store(user,(uint) strlen(user), system_charset_info);
key_copy(user_key, table->record[0], table->key_info, key_copy((byte *) user_key, table->record[0], table->key_info,
table->key_info->key_length); table->key_info->key_length);
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS); table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
if (table->file->index_read_idx(table->record[0], 0, if (table->file->index_read_idx(table->record[0], 0,
user_key, table->key_info->key_length, (byte *) user_key, table->key_info->key_length,
HA_READ_KEY_EXACT)) HA_READ_KEY_EXACT))
{ {
my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH), my_message(ER_PASSWORD_NO_MATCH, ER(ER_PASSWORD_NO_MATCH),
......
...@@ -305,7 +305,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -305,7 +305,7 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
if (!(record= (char *) alloc_root(&outparam->mem_root, if (!(record= (char *) alloc_root(&outparam->mem_root,
rec_buff_length * records))) rec_buff_length * records)))
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
share->default_values= record; share->default_values= (byte *) record;
if (my_pread(file,(byte*) record, (uint) share->reclength, if (my_pread(file,(byte*) record, (uint) share->reclength,
(ulong) (uint2korr(head+6)+ (ulong) (uint2korr(head+6)+
((uint2korr(head+14) == 0xffff ? ((uint2korr(head+14) == 0xffff ?
...@@ -320,9 +320,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat, ...@@ -320,9 +320,9 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
} }
else else
{ {
outparam->record[0]= record+ rec_buff_length; outparam->record[0]= (byte *) record+ rec_buff_length;
if (records > 2) if (records > 2)
outparam->record[1]= record+ rec_buff_length*2; outparam->record[1]= (byte *) record+ rec_buff_length*2;
else else
outparam->record[1]= outparam->record[0]; // Safety outparam->record[1]= outparam->record[0]; // Safety
} }
......
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