Commit 8d1480f7 authored by miguel@hegel.local's avatar miguel@hegel.local

Windows fixes for VC++ compiler compability

parent ee627d25
...@@ -83,7 +83,7 @@ int main(int argc,char *argv[]) ...@@ -83,7 +83,7 @@ int main(int argc,char *argv[])
{ {
char *end; char *end;
inx= strtoll(argv[1], &end, 10); inx= (uint) strtoll(argv[1], &end, 10);
if (*end) if (*end)
usage(); usage();
} }
......
...@@ -30,11 +30,26 @@ ulonglong my_getsystime() ...@@ -30,11 +30,26 @@ ulonglong my_getsystime()
clock_gettime(CLOCK_REALTIME, &tp); clock_gettime(CLOCK_REALTIME, &tp);
return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100; return (ulonglong)tp.tv_sec*10000000+(ulonglong)tp.tv_nsec/100;
#elif defined(__WIN__) #elif defined(__WIN__)
/* TODO: use GetSystemTimeAsFileTime here or #define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
QueryPerformanceCounter/QueryPerformanceFrequency */ static __int64 offset=0, freq;
struct _timeb tb; LARGE_INTEGER t_cnt;
_ftime(&tb); if (!offset)
return (ulonglong)tb.time*10000000+(ulonglong)tb.millitm*10000; {
/* 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__) #elif defined(__NETWARE__)
NXTime_t tm; NXTime_t tm;
NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm); NXGetTime(NX_SINCE_1970, NX_NSECONDS, &tm);
......
...@@ -1490,7 +1490,7 @@ int handler::compare_key(key_range *range) ...@@ -1490,7 +1490,7 @@ int handler::compare_key(key_range *range)
if (!range) if (!range)
return 0; // No max 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 < end;
key+= store_length, key_part++) key+= store_length, key_part++)
{ {
......
...@@ -697,8 +697,7 @@ longlong Item_func_srid::val_int() ...@@ -697,8 +697,7 @@ longlong Item_func_srid::val_int()
DBUG_ASSERT(fixed == 1); DBUG_ASSERT(fixed == 1);
String *swkb= args[0]->val_str(&value); String *swkb= args[0]->val_str(&value);
Geometry_buffer buffer; Geometry_buffer buffer;
Geometry *geom;
null_value= (!swkb || null_value= (!swkb ||
!Geometry::create_from_wkb(&buffer, !Geometry::create_from_wkb(&buffer,
swkb->ptr() + SRID_SIZE, swkb->ptr() + SRID_SIZE,
......
...@@ -2825,9 +2825,9 @@ String *Item_func_uuid::val_str(String *str) ...@@ -2825,9 +2825,9 @@ String *Item_func_uuid::val_str(String *str)
uuid_time=tv; uuid_time=tv;
pthread_mutex_unlock(&LOCK_uuid_generator); pthread_mutex_unlock(&LOCK_uuid_generator);
uint32 time_low= tv & 0xFFFFFFFF; uint32 time_low= (uint32) (tv & 0xFFFFFFFF);
uint16 time_mid= (tv >> 32) & 0xFFFF; uint16 time_mid= (uint16) ((tv >> 32) & 0xFFFF);
uint16 time_hi_and_version= (tv >> 48) | UUID_VERSION; uint16 time_hi_and_version= (uint16) ((tv >> 48) | UUID_VERSION);
str->realloc(UUID_LENGTH+1); str->realloc(UUID_LENGTH+1);
str->length(UUID_LENGTH); str->length(UUID_LENGTH);
......
...@@ -2612,12 +2612,12 @@ int QUICK_SELECT::get_next() ...@@ -2612,12 +2612,12 @@ int QUICK_SELECT::get_next()
if (!(range= it++)) if (!(range= it++))
DBUG_RETURN(HA_ERR_END_OF_FILE); // All ranges used 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.length= range->min_length;
start_key.flag= ((range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY : start_key.flag= ((range->flag & NEAR_MIN) ? HA_READ_AFTER_KEY :
(range->flag & EQ_RANGE) ? (range->flag & EQ_RANGE) ?
HA_READ_KEY_EXACT : HA_READ_KEY_OR_NEXT); 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; end_key.length= range->max_length;
/* /*
We use READ_AFTER_KEY here because if we are reading on a key 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, ...@@ -121,7 +121,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
runs without --log-update or --log-bin). runs without --log-update or --log-bin).
*/ */
int log_on= DELAYED_LOG_UPDATE | DELAYED_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; uint value_count;
ulong counter = 1; ulong counter = 1;
ulonglong id; ulonglong id;
......
...@@ -1668,8 +1668,8 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, ...@@ -1668,8 +1668,8 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables,
and from local list if it is not the same and from local list if it is not the same
*/ */
select_lex.table_list.first= ((&select_lex != all_selects_list) ? select_lex.table_list.first= ((&select_lex != all_selects_list) ?
(gptr) (*local_first)->next : (byte*) (*local_first)->next :
(gptr) tables); (byte*) tables);
(*global_first)->next= 0; (*global_first)->next= 0;
return tables; return tables;
} }
...@@ -1698,10 +1698,10 @@ TABLE_LIST *st_lex::link_first_table_back(TABLE_LIST *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 we do not touch local table 'next' field => we need just
put the table in the list put the table in the list
*/ */
select_lex.table_list.first= (gptr) local_first; select_lex.table_list.first= (byte*) local_first;
} }
else else
select_lex.table_list.first= (gptr) global_first; select_lex.table_list.first= (byte*) global_first;
return global_first; return global_first;
} }
......
...@@ -2601,11 +2601,11 @@ unsent_create_error: ...@@ -2601,11 +2601,11 @@ unsent_create_error:
if ((result=new select_insert(tables->table,&lex->field_list, if ((result=new select_insert(tables->table,&lex->field_list,
lex->duplicates))) lex->duplicates)))
/* Skip first table, which is the table we are inserting in */ /* 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; lex->select_lex.resolve_mode= SELECT_LEX::NOMATTER_MODE;
res=handle_select(thd,lex,result); res=handle_select(thd,lex,result);
/* revert changes for SP */ /* 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; lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
if (thd->net.report_error) if (thd->net.report_error)
res= -1; res= -1;
...@@ -4362,7 +4362,6 @@ static void remove_escape(char *name) ...@@ -4362,7 +4362,6 @@ static void remove_escape(char *name)
bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc) bool add_to_list(THD *thd, SQL_LIST &list,Item *item,bool asc)
{ {
ORDER *order; ORDER *order;
Item **item_ptr;
DBUG_ENTER("add_to_list"); DBUG_ENTER("add_to_list");
if (!(order = (ORDER *) thd->alloc(sizeof(ORDER)))) if (!(order = (ORDER *) thd->alloc(sizeof(ORDER))))
DBUG_RETURN(1); DBUG_RETURN(1);
......
...@@ -1147,11 +1147,11 @@ static int mysql_test_insert_select(Prepared_statement *stmt, ...@@ -1147,11 +1147,11 @@ static int mysql_test_insert_select(Prepared_statement *stmt,
TABLE_LIST *first_local_table= TABLE_LIST *first_local_table=
(TABLE_LIST *)lex->select_lex.table_list.first; (TABLE_LIST *)lex->select_lex.table_list.first;
/* Skip first table, which is the table we are inserting in */ /* 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; lex->select_lex.resolve_mode= SELECT_LEX::NOMATTER_MODE;
res= select_like_statement_test(stmt, tables); res= select_like_statement_test(stmt, tables);
/* revert changes*/ /* 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; lex->select_lex.resolve_mode= SELECT_LEX::INSERT_MODE;
return res; return res;
} }
......
...@@ -112,7 +112,6 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, ...@@ -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 *lex_select_save= thd_arg->lex->current_select;
SELECT_LEX *sl, *first_select; SELECT_LEX *sl, *first_select;
select_result *tmp_result; select_result *tmp_result;
ORDER *tmp_order;
DBUG_ENTER("st_select_lex_unit::prepare"); DBUG_ENTER("st_select_lex_unit::prepare");
/* /*
...@@ -215,7 +214,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, ...@@ -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; union_result->tmp_table_param.field_count= types.elements;
if (!(table= create_tmp_table(thd_arg, if (!(table= create_tmp_table(thd_arg,
&union_result->tmp_table_param, types, &union_result->tmp_table_param, types,
(ORDER*) 0, union_distinct, 1, (ORDER*) 0, (bool) union_distinct, 1,
(first_select_in_union()->options | (first_select_in_union()->options |
thd_arg->options | thd_arg->options |
TMP_TABLE_ALL_COLUMNS), TMP_TABLE_ALL_COLUMNS),
......
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