mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Windows fixes for VC++ compiler compability
This commit is contained in:
parent
ee627d2510
commit
8d1480f7c5
11 changed files with 38 additions and 26 deletions
|
@ -83,7 +83,7 @@ int main(int argc,char *argv[])
|
|||
|
||||
{
|
||||
char *end;
|
||||
inx= strtoll(argv[1], &end, 10);
|
||||
inx= (uint) strtoll(argv[1], &end, 10);
|
||||
if (*end)
|
||||
usage();
|
||||
}
|
||||
|
|
|
@ -30,11 +30,26 @@ ulonglong my_getsystime()
|
|||
clock_gettime(CLOCK_REALTIME, &tp);
|
||||
return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
|
||||
#elif defined(__WIN__)
|
||||
/* TODO: use GetSystemTimeAsFileTime here or
|
||||
QueryPerformanceCounter/QueryPerformanceFrequency */
|
||||
struct _timeb tb;
|
||||
_ftime(&tb);
|
||||
return (ulonglong)tb.time*10000000+(ulonglong)tb.millitm*10000;
|
||||
#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
|
||||
static __int64 offset=0, freq;
|
||||
LARGE_INTEGER t_cnt;
|
||||
if (!offset)
|
||||
{
|
||||
/* strictly speaking there should be a mutex to protect
|
||||
initialization section. But my_getsystime() is called from
|
||||
UUID() code, and UUID() calls are serialized with a mutex anyway
|
||||
*/
|
||||
LARGE_INTEGER li;
|
||||
FILETIME ft;
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
li.LowPart=ft.dwLowDateTime;
|
||||
li.HighPart=ft.dwHighDateTime;
|
||||
offset=li.QuadPart-OFFSET_TO_EPOC;
|
||||
QueryPerformanceFrequency(&li);
|
||||
freq=li.QuadPart;
|
||||
}
|
||||
QueryPerformanceCounter(&t_cnt);
|
||||
return t_cnt.QuadPart/freq*10000000+t_cnt.QuadPart%freq*10000000/freq+offset;
|
||||
#elif defined(__NETWARE__)
|
||||
NXTime_t tm;
|
||||
NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm);
|
||||
|
|
|
@ -1490,7 +1490,7 @@ int handler::compare_key(key_range *range)
|
|||
if (!range)
|
||||
return 0; // No max range
|
||||
|
||||
for (const char *key=range->key, *end=key+range->length;
|
||||
for (const char *key= (const char*) range->key, *end=key+range->length;
|
||||
key < end;
|
||||
key+= store_length, key_part++)
|
||||
{
|
||||
|
|
|
@ -697,8 +697,7 @@ longlong Item_func_srid::val_int()
|
|||
DBUG_ASSERT(fixed == 1);
|
||||
String *swkb= args[0]->val_str(&value);
|
||||
Geometry_buffer buffer;
|
||||
Geometry *geom;
|
||||
|
||||
|
||||
null_value= (!swkb ||
|
||||
!Geometry::create_from_wkb(&buffer,
|
||||
swkb->ptr() + SRID_SIZE,
|
||||
|
|
|
@ -2825,9 +2825,9 @@ String *Item_func_uuid::val_str(String *str)
|
|||
uuid_time=tv;
|
||||
pthread_mutex_unlock(&LOCK_uuid_generator);
|
||||
|
||||
uint32 time_low= tv & 0xFFFFFFFF;
|
||||
uint16 time_mid= (tv >> 32) & 0xFFFF;
|
||||
uint16 time_hi_and_version= (tv >> 48) | UUID_VERSION;
|
||||
uint32 time_low= (uint32) (tv & 0xFFFFFFFF);
|
||||
uint16 time_mid= (uint16) ((tv >> 32) & 0xFFFF);
|
||||
uint16 time_hi_and_version= (uint16) ((tv >> 48) | UUID_VERSION);
|
||||
|
||||
str->realloc(UUID_LENGTH+1);
|
||||
str->length(UUID_LENGTH);
|
||||
|
|
|
@ -2612,12 +2612,12 @@ int QUICK_SELECT::get_next()
|
|||
if (!(range= it++))
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE); // All ranges used
|
||||
|
||||
start_key.key= range->min_key;
|
||||
start_key.key= (const byte*) range->min_key;
|
||||
start_key.length= range->min_length;
|
||||
start_key.flag= ((range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
|
||||
(range->flag & EQ_RANGE) ?
|
||||
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT);
|
||||
end_key.key= range->max_key;
|
||||
end_key.key= (const byte*) range->max_key;
|
||||
end_key.length= range->max_length;
|
||||
/*
|
||||
We use READ_AFTER_KEY here because if we are reading on a key
|
||||
|
|
|
@ -121,7 +121,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
|
|||
runs without --log-update or --log-bin).
|
||||
*/
|
||||
int log_on= DELAYED_LOG_UPDATE | DELAYED_LOG_BIN ;
|
||||
bool transactional_table, log_delayed, bulk_insert;
|
||||
bool transactional_table, log_delayed;
|
||||
uint value_count;
|
||||
ulong counter = 1;
|
||||
ulonglong id;
|
||||
|
|
|
@ -1668,8 +1668,8 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables,
|
|||
and from local list if it is not the same
|
||||
*/
|
||||
select_lex.table_list.first= ((&select_lex != all_selects_list) ?
|
||||
(gptr) (*local_first)->next :
|
||||
(gptr) tables);
|
||||
(byte*) (*local_first)->next :
|
||||
(byte*) tables);
|
||||
(*global_first)->next= 0;
|
||||
return tables;
|
||||
}
|
||||
|
@ -1698,10 +1698,10 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *tables,
|
|||
we do not touch local table 'next' field => we need just
|
||||
put the table in the list
|
||||
*/
|
||||
select_lex.table_list.first= (gptr) local_first;
|
||||
select_lex.table_list.first= (byte*) local_first;
|
||||
}
|
||||
else
|
||||
select_lex.table_list.first= (gptr) global_first;
|
||||
select_lex.table_list.first= (byte*) global_first;
|
||||
return global_first;
|
||||
}
|
||||
|
||||
|
|
|
@ -2601,11 +2601,11 @@ unsent_create_error:
|
|||
if ((result=new select_insert(tables->table,&lex->field_list,
|
||||
lex->duplicates)))
|
||||
/* Skip first table, which is the table we are inserting in */
|
||||
lex->select_lex.table_list.first= (gptr) first_local_table->next;
|
||||
lex->select_lex.table_list.first= (byte*) first_local_table->next;
|
||||
lex->select_lex.resolve_mode= SELECT_LEX::NOMATTER_MODE;
|
||||
res=handle_select(thd,lex,result);
|
||||
/* revert changes for SP */
|
||||
lex->select_lex.table_list.first= (gptr) first_local_table;
|
||||
lex->select_lex.table_list.first= (byte*) first_local_table;
|
||||
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
|
||||
if (thd->net.report_error)
|
||||
res= -1;
|
||||
|
@ -4362,7 +4362,6 @@ static void remove_escape(char *name)
|
|||
bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
|
||||
{
|
||||
ORDER *order;
|
||||
Item **item_ptr;
|
||||
DBUG_ENTER("add_to_list");
|
||||
if (!(order = (ORDER *) thd->alloc(sizeof(ORDER))))
|
||||
DBUG_RETURN(1);
|
||||
|
|
|
@ -1147,11 +1147,11 @@ static int mysql_test_insert_select(Prepared_statement *stmt,
|
|||
TABLE_LIST *first_local_table=
|
||||
(TABLE_LIST *)lex->select_lex.table_list.first;
|
||||
/* Skip first table, which is the table we are inserting in */
|
||||
lex->select_lex.table_list.first= (gptr) first_local_table->next;
|
||||
lex->select_lex.table_list.first= (uchar*) first_local_table->next;
|
||||
lex->select_lex.resolve_mode= SELECT_LEX::NOMATTER_MODE;
|
||||
res= select_like_statement_test(stmt, tables);
|
||||
/* revert changes*/
|
||||
lex->select_lex.table_list.first= (gptr) first_local_table;
|
||||
lex->select_lex.table_list.first= (uchar*) first_local_table;
|
||||
lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,6 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
SELECT_LEX *lex_select_save= thd_arg->lex->current_select;
|
||||
SELECT_LEX *sl, *first_select;
|
||||
select_result *tmp_result;
|
||||
ORDER *tmp_order;
|
||||
DBUG_ENTER("st_select_lex_unit::prepare");
|
||||
|
||||
/*
|
||||
|
@ -215,7 +214,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
|
|||
union_result->tmp_table_param.field_count= types.elements;
|
||||
if (!(table= create_tmp_table(thd_arg,
|
||||
&union_result->tmp_table_param, types,
|
||||
(ORDER*) 0, union_distinct, 1,
|
||||
(ORDER*) 0, (bool) union_distinct, 1,
|
||||
(first_select_in_union()->options |
|
||||
thd_arg->options |
|
||||
TMP_TABLE_ALL_COLUMNS),
|
||||
|
|
Loading…
Reference in a new issue