diff options
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index d50fb22a154..d73782dd94e 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -5726,7 +5726,7 @@ void Item_func_get_system_var::update_null_value() bool Item_func_get_system_var::fix_length_and_dec() { - char *cptr; + const char *cptr; maybe_null= TRUE; max_length= 0; @@ -5760,9 +5760,12 @@ bool Item_func_get_system_var::fix_length_and_dec() case SHOW_CHAR: case SHOW_CHAR_PTR: mysql_mutex_lock(&LOCK_global_system_variables); - cptr= var->show_type() == SHOW_CHAR ? - (char*) var->value_ptr(current_thd, var_type, &component) : - *(char**) var->value_ptr(current_thd, var_type, &component); + cptr= var->show_type() == SHOW_CHAR ? + reinterpret_cast<const char*>(var->value_ptr(current_thd, var_type, + &component)) : + *reinterpret_cast<const char* const*>(var->value_ptr(current_thd, + var_type, + &component)); if (cptr) max_length= (uint32)system_charset_info->cset->numchars(system_charset_info, cptr, @@ -5775,7 +5778,10 @@ bool Item_func_get_system_var::fix_length_and_dec() case SHOW_LEX_STRING: { mysql_mutex_lock(&LOCK_global_system_variables); - LEX_STRING *ls= ((LEX_STRING*)var->value_ptr(current_thd, var_type, &component)); + const LEX_STRING *ls= + reinterpret_cast<const LEX_STRING*>(var->value_ptr(current_thd, + var_type, + &component)); max_length= (uint32)system_charset_info->cset->numchars(system_charset_info, ls->str, ls->str + ls->length); |