Skip to content

Commit 66905f6

Browse files
committed
Fix several compile warnings on Windows
1 parent 7668a79 commit 66905f6

File tree

7 files changed

+27
-16
lines changed

7 files changed

+27
-16
lines changed

mysys/stacktrace.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,18 @@ void my_write_core(int sig)
483483

484484
#else /* __WIN__*/
485485

486+
#ifdef _MSC_VER
487+
/* Silence warning in OS header dbghelp.h */
488+
#pragma warning(push)
489+
#pragma warning(disable : 4091)
490+
#endif
491+
486492
#include <dbghelp.h>
493+
494+
#ifdef _MSC_VER
495+
#pragma warning(pop)
496+
#endif
497+
487498
#include <tlhelp32.h>
488499
#include <my_sys.h>
489500
#if _MSC_VER

sql/item_sum.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2218,10 +2218,10 @@ bool Item_sum_bit::remove_as_window(ulonglong value)
22182218
if (!bit_counters[i])
22192219
{
22202220
// Don't attempt to remove values that were never added.
2221-
DBUG_ASSERT((value & (1 << i)) == 0);
2221+
DBUG_ASSERT((value & (1ULL << i)) == 0);
22222222
continue;
22232223
}
2224-
bit_counters[i]-= (value & (1 << i)) ? 1 : 0;
2224+
bit_counters[i]-= (value & (1ULL << i)) ? 1 : 0;
22252225
}
22262226

22272227
// Prevent overflow;
@@ -2235,7 +2235,7 @@ bool Item_sum_bit::add_as_window(ulonglong value)
22352235
DBUG_ASSERT(as_window_function);
22362236
for (int i= 0; i < NUM_BIT_COUNTERS; i++)
22372237
{
2238-
bit_counters[i]+= (value & (1 << i)) ? 1 : 0;
2238+
bit_counters[i]+= (value & (1ULL << i)) ? 1 : 0;
22392239
}
22402240
// Prevent overflow;
22412241
num_values_added = std::max(num_values_added, num_values_added + 1);
@@ -2306,7 +2306,7 @@ void Item_sum_and::set_bits_from_counters()
23062306
{
23072307
// We've only added values of 1 for this bit.
23082308
if (bit_counters[i] == num_values_added)
2309-
value|= (1 << i);
2309+
value|= (1ULL << i);
23102310
}
23112311
bits= value & reset_bits;
23122312
}
@@ -3490,9 +3490,9 @@ Item_func_group_concat::fix_fields(THD *thd, Item **ref)
34903490
result.set_charset(collation.collation);
34913491
result_field= 0;
34923492
null_value= 1;
3493-
max_length= thd->variables.group_concat_max_len
3493+
max_length= (uint32)(thd->variables.group_concat_max_len
34943494
/ collation.collation->mbminlen
3495-
* collation.collation->mbmaxlen;
3495+
* collation.collation->mbmaxlen);
34963496

34973497
uint32 offset;
34983498
if (separator->needs_conversion(separator->length(), separator->charset(),

sql/sql_plugin.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3302,14 +3302,14 @@ uchar* sys_var_pluginvar::real_value_ptr(THD *thd, enum_var_type type)
33023302
{
33033303
switch (plugin_var->flags & PLUGIN_VAR_TYPEMASK) {
33043304
case PLUGIN_VAR_BOOL:
3305-
thd->sys_var_tmp.my_bool_value= option.def_value;
3305+
thd->sys_var_tmp.my_bool_value= (my_bool)option.def_value;
33063306
return (uchar*) &thd->sys_var_tmp.my_bool_value;
33073307
case PLUGIN_VAR_INT:
3308-
thd->sys_var_tmp.int_value= option.def_value;
3308+
thd->sys_var_tmp.int_value= (int)option.def_value;
33093309
return (uchar*) &thd->sys_var_tmp.int_value;
33103310
case PLUGIN_VAR_LONG:
33113311
case PLUGIN_VAR_ENUM:
3312-
thd->sys_var_tmp.long_value= option.def_value;
3312+
thd->sys_var_tmp.long_value= (long)option.def_value;
33133313
return (uchar*) &thd->sys_var_tmp.long_value;
33143314
case PLUGIN_VAR_LONGLONG:
33153315
case PLUGIN_VAR_SET:

sql/sql_select.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6017,7 +6017,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
60176017
{
60186018
TABLE *table= s->table;
60196019
double sel= table->cond_selectivity;
6020-
double table_records= table->stat_records();
6020+
double table_records= (double)table->stat_records();
60216021
dbl_records= table_records * sel;
60226022
return dbl_records;
60236023
}
@@ -6043,7 +6043,7 @@ double matching_candidates_in_table(JOIN_TAB *s, bool with_found_constraint,
60436043
if (s->table->quick_condition_rows != s->found_records)
60446044
records= s->table->quick_condition_rows;
60456045

6046-
dbl_records= records;
6046+
dbl_records= (double)records;
60476047
return dbl_records;
60486048
}
60496049

sql/sys_vars.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5206,7 +5206,7 @@ int default_regex_flags_pcre(const THD *thd)
52065206
int i, res;
52075207
for (i= res= 0; default_regex_flags_to_pcre[i]; i++)
52085208
{
5209-
if (src & (1 << i))
5209+
if (src & (1ULL << i))
52105210
res|= default_regex_flags_to_pcre[i];
52115211
}
52125212
return res;

storage/innobase/btr/btr0scrub.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ btr_scrub_lock_dict_func(ulint space, bool lock_to_close_table,
143143
"WARNING: %s:%u waited %lu seconds for"
144144
" dict_sys lock, space: %lu"
145145
" lock_to_close_table: %u\n",
146-
file, line, now - start, space,
146+
file, line, (unsigned long)(now - start), space,
147147
lock_to_close_table);
148148

149149
last = now;

storage/sequence/sequence.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ class ha_seq: public handler
9595
ha_rows records_in_range(uint inx, key_range *min_key,
9696
key_range *max_key);
9797

98-
double scan_time() { return nvalues(); }
99-
double read_time(uint index, uint ranges, ha_rows rows) { return rows; }
100-
double keyread_time(uint index, uint ranges, ha_rows rows) { return rows; }
98+
double scan_time() { return (double)nvalues(); }
99+
double read_time(uint index, uint ranges, ha_rows rows) { return (double)rows; }
100+
double keyread_time(uint index, uint ranges, ha_rows rows) { return (double)rows; }
101101

102102
private:
103103
void set(uchar *buf);

0 commit comments

Comments
 (0)