cleanup: s/const CHARSET_INFO/CHARSET_INFO/

as CHARSET_INFO is already const, using const on it
is redundant and results in compiler warnings (on Windows)
This commit is contained in:
Sergei Golubchik 2014-11-19 09:13:38 +01:00
parent 0d30423900
commit 2ae7541bcf
20 changed files with 33 additions and 34 deletions

View File

@ -44,7 +44,7 @@ extern "C" {
typedef uint my_hash_value_type; typedef uint my_hash_value_type;
typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool); typedef uchar *(*my_hash_get_key)(const uchar *,size_t*,my_bool);
typedef my_hash_value_type (*my_hash_function)(const CHARSET_INFO *, typedef my_hash_value_type (*my_hash_function)(CHARSET_INFO *,
const uchar *, size_t); const uchar *, size_t);
typedef void (*my_hash_free_key)(void *); typedef void (*my_hash_free_key)(void *);
typedef my_bool (*my_hash_walk_action)(void *,void *); typedef my_bool (*my_hash_walk_action)(void *,void *);
@ -78,7 +78,7 @@ uchar *my_hash_search(const HASH *info, const uchar *key, size_t length);
uchar *my_hash_search_using_hash_value(const HASH *info, uchar *my_hash_search_using_hash_value(const HASH *info,
my_hash_value_type hash_value, my_hash_value_type hash_value,
const uchar *key, size_t length); const uchar *key, size_t length);
my_hash_value_type my_hash_sort(const CHARSET_INFO *cs, my_hash_value_type my_hash_sort(CHARSET_INFO *cs,
const uchar *key, size_t length); const uchar *key, size_t length);
#define my_calc_hash(A, B, C) my_hash_sort((A)->charset, B, C) #define my_calc_hash(A, B, C) my_hash_sort((A)->charset, B, C)
uchar *my_hash_first(const HASH *info, const uchar *key, size_t length, uchar *my_hash_first(const HASH *info, const uchar *key, size_t length,

View File

@ -40,7 +40,7 @@ static void movelink(HASH_LINK *array,uint pos,uint next_link,uint newlink);
static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key, static int hashcmp(const HASH *hash, HASH_LINK *pos, const uchar *key,
size_t length); size_t length);
my_hash_value_type my_hash_sort(const CHARSET_INFO *cs, const uchar *key, my_hash_value_type my_hash_sort(CHARSET_INFO *cs, const uchar *key,
size_t length) size_t length)
{ {
ulong nr1= 1, nr2= 4; ulong nr1= 1, nr2= 4;

View File

@ -5517,7 +5517,7 @@ void Field_time::sql_type(String &res) const
res.set_ascii(STRING_WITH_LEN("time")); res.set_ascii(STRING_WITH_LEN("time"));
return; return;
} }
const CHARSET_INFO *cs= res.charset(); CHARSET_INFO *cs= res.charset();
res.length(cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(), res.length(cs->cset->snprintf(cs, (char*) res.ptr(), res.alloced_length(),
"time(%d)", decimals())); "time(%d)", decimals()));
} }

View File

@ -1583,7 +1583,7 @@ public:
enum Derivation derivation(void) const { return DERIVATION_NUMERIC; } enum Derivation derivation(void) const { return DERIVATION_NUMERIC; }
uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; } uint repertoire(void) const { return MY_REPERTOIRE_NUMERIC; }
CHARSET_INFO *charset(void) const { return &my_charset_numeric; } CHARSET_INFO *charset(void) const { return &my_charset_numeric; }
const CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; } CHARSET_INFO *sort_charset(void) const { return &my_charset_bin; }
bool binary() const { return true; } bool binary() const { return true; }
enum Item_result cmp_type () const { return TIME_RESULT; } enum Item_result cmp_type () const { return TIME_RESULT; }
uint is_equal(Create_field *new_field); uint is_equal(Create_field *new_field);

View File

@ -988,7 +988,7 @@ static void make_sortkey(register Sort_param *param,
switch (sort_field->result_type) { switch (sort_field->result_type) {
case STRING_RESULT: case STRING_RESULT:
{ {
const CHARSET_INFO *cs=item->collation.collation; CHARSET_INFO *cs=item->collation.collation;
char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' '); char fill_char= ((cs->state & MY_CS_BINSORT) ? (char) 0 : ' ');
if (maybe_null) if (maybe_null)
@ -1863,8 +1863,8 @@ static uint
sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length, sortlength(THD *thd, SORT_FIELD *sortorder, uint s_length,
bool *multi_byte_charset) bool *multi_byte_charset)
{ {
reg2 uint length; uint length;
const CHARSET_INFO *cs; CHARSET_INFO *cs;
*multi_byte_charset= 0; *multi_byte_charset= 0;
length=0; length=0;

View File

@ -3041,7 +3041,7 @@ String *Item_func_space::val_str(String *str)
{ {
uint tot_length; uint tot_length;
longlong count= args[0]->val_int(); longlong count= args[0]->val_int();
const CHARSET_INFO *cs= collation.collation; CHARSET_INFO *cs= collation.collation;
if (args[0]->null_value) if (args[0]->null_value)
goto err; // string and/or delim are null goto err; // string and/or delim are null

View File

@ -523,7 +523,7 @@ public:
return cached_field_type == MYSQL_TYPE_STRING ? return cached_field_type == MYSQL_TYPE_STRING ?
STRING_RESULT : TIME_RESULT; STRING_RESULT : TIME_RESULT;
} }
const CHARSET_INFO *charset_for_protocol() const CHARSET_INFO *charset_for_protocol() const
{ {
/* /*
Can return TIME, DATE, DATETIME or VARCHAR depending on arguments. Can return TIME, DATE, DATETIME or VARCHAR depending on arguments.

View File

@ -793,7 +793,7 @@ void MDL_map::init()
} }
my_hash_value_type mdl_hash_function(const CHARSET_INFO *cs, my_hash_value_type mdl_hash_function(CHARSET_INFO *cs,
const uchar *key, size_t length) const uchar *key, size_t length)
{ {
MDL_key *mdl_key= (MDL_key*) (key - offsetof(MDL_key, m_ptr)); MDL_key *mdl_key= (MDL_key*) (key - offsetof(MDL_key, m_ptr));

View File

@ -416,7 +416,7 @@ private:
private: private:
MDL_key(const MDL_key &); /* not implemented */ MDL_key(const MDL_key &); /* not implemented */
MDL_key &operator=(const MDL_key &); /* not implemented */ MDL_key &operator=(const MDL_key &); /* not implemented */
friend my_hash_value_type mdl_hash_function(const CHARSET_INFO *, friend my_hash_value_type mdl_hash_function(CHARSET_INFO *,
const uchar *, size_t); const uchar *, size_t);
}; };

View File

@ -11284,8 +11284,7 @@ static bool find_mpvio_user(MPVIO_EXT *mpvio)
} }
static bool static bool
read_client_connect_attrs(char **ptr, char *end, read_client_connect_attrs(char **ptr, char *end, CHARSET_INFO *from_cs)
const CHARSET_INFO *from_cs)
{ {
size_t length; size_t length;
char *ptr_save= *ptr; char *ptr_save= *ptr;

View File

@ -207,7 +207,7 @@ void Explain_query::print_explain_json(select_result_sink *output, bool is_analy
writer.end_object(); writer.end_object();
const CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
List<Item> item_list; List<Item> item_list;
String *buf= &writer.output; String *buf= &writer.output;
item_list.push_back(new Item_string(buf->ptr(), buf->length(), cs)); item_list.push_back(new Item_string(buf->ptr(), buf->length(), cs));
@ -416,7 +416,7 @@ int Explain_union::print_explain(Explain_query *query,
uint8 explain_flags, uint8 explain_flags,
bool is_analyze) bool is_analyze)
{ {
//const CHARSET_INFO *cs= system_charset_info; //CHARSET_INFO *cs= system_charset_info;
char table_name_buffer[SAFE_NAME_LEN]; char table_name_buffer[SAFE_NAME_LEN];
/* print all UNION children, in order */ /* print all UNION children, in order */
@ -762,7 +762,7 @@ void Explain_table_access::push_extra(enum explain_extra_tag extra_tag)
void Explain_table_access::fill_key_str(String *key_str, bool is_json) const void Explain_table_access::fill_key_str(String *key_str, bool is_json) const
{ {
const CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
bool is_hj= (type == JT_HASH || type == JT_HASH_NEXT || bool is_hj= (type == JT_HASH || type == JT_HASH_NEXT ||
type == JT_HASH_RANGE || type == JT_HASH_INDEX_MERGE); type == JT_HASH_RANGE || type == JT_HASH_INDEX_MERGE);
const char *hash_key_prefix= "#hash#"; const char *hash_key_prefix= "#hash#";
@ -882,7 +882,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
uint select_id, const char *select_type, uint select_id, const char *select_type,
bool using_temporary, bool using_filesort) bool using_temporary, bool using_filesort)
{ {
//const CHARSET_INFO *cs= system_charset_info; //CHARSET_INFO *cs= system_charset_info;
List<Item> item_list; List<Item> item_list;
Item *item_null= new Item_null(); Item *item_null= new Item_null();

View File

@ -195,7 +195,7 @@ static int cmp_rec_and_tuple_prune(part_column_list_val *val,
item New converted item item New converted item
*/ */
Item* convert_charset_partition_constant(Item *item, const CHARSET_INFO *cs) Item* convert_charset_partition_constant(Item *item, CHARSET_INFO *cs)
{ {
THD *thd= current_thd; THD *thd= current_thd;
Name_resolution_context *context= &thd->lex->current_select->context; Name_resolution_context *context= &thd->lex->current_select->context;
@ -2222,7 +2222,7 @@ static int add_column_list_values(File fptr, partition_info *part_info,
else else
{ {
String *res; String *res;
const CHARSET_INFO *field_cs; CHARSET_INFO *field_cs;
bool need_cs_check= FALSE; bool need_cs_check= FALSE;
Item_result result_type= STRING_RESULT; Item_result result_type= STRING_RESULT;
@ -4292,7 +4292,7 @@ bool mysql_unpack_partition(THD *thd,
{ {
bool result= TRUE; bool result= TRUE;
partition_info *part_info; partition_info *part_info;
const CHARSET_INFO *old_character_set_client= CHARSET_INFO *old_character_set_client=
thd->variables.character_set_client; thd->variables.character_set_client;
LEX *old_lex= thd->lex; LEX *old_lex= thd->lex;
LEX lex; LEX lex;

View File

@ -23289,7 +23289,7 @@ void JOIN_TAB::save_explain_data(Explain_table_access *eta, table_map prefix_tab
bool distinct, JOIN_TAB *first_top_tab) bool distinct, JOIN_TAB *first_top_tab)
{ {
int quick_type; int quick_type;
const CHARSET_INFO *cs= system_charset_info; CHARSET_INFO *cs= system_charset_info;
JOIN_TAB *tab= this; JOIN_TAB *tab= this;
THD *thd=join->thd; THD *thd=join->thd;

View File

@ -35,9 +35,9 @@ typedef struct st_mem_root MEM_ROOT;
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs); int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
inline uint32 copy_and_convert(char *to, uint32 to_length, inline uint32 copy_and_convert(char *to, uint32 to_length,
const CHARSET_INFO *to_cs, CHARSET_INFO *to_cs,
const char *from, uint32 from_length, const char *from, uint32 from_length,
const CHARSET_INFO *from_cs, uint *errors) CHARSET_INFO *from_cs, uint *errors)
{ {
return my_convert(to, to_length, to_cs, from, from_length, from_cs, errors); return my_convert(to, to_length, to_cs, from, from_length, from_cs, errors);
} }
@ -575,11 +575,11 @@ class StringBuffer : public String
public: public:
StringBuffer() : String(buff, buff_sz, &my_charset_bin) { length(0); } StringBuffer() : String(buff, buff_sz, &my_charset_bin) { length(0); }
explicit StringBuffer(const CHARSET_INFO *cs) : String(buff, buff_sz, cs) explicit StringBuffer(CHARSET_INFO *cs) : String(buff, buff_sz, cs)
{ {
length(0); length(0);
} }
StringBuffer(const char *str, size_t length, const CHARSET_INFO *cs) StringBuffer(const char *str, size_t length, CHARSET_INFO *cs)
: String(buff, buff_sz, cs) : String(buff, buff_sz, cs)
{ {
set(str, length, cs); set(str, length, cs);

View File

@ -1709,7 +1709,7 @@ MY_UNICASE_INFO my_caseinfo_cp932=
my_caseinfo_pages_cp932 my_caseinfo_pages_cp932
}; };
static int my_strnncoll_cp932_internal(const CHARSET_INFO *cs, static int my_strnncoll_cp932_internal(CHARSET_INFO *cs,
const uchar **a_res, size_t a_length, const uchar **a_res, size_t a_length,
const uchar **b_res, size_t b_length) const uchar **b_res, size_t b_length)
{ {

View File

@ -63,7 +63,7 @@ size_t my_casedn_str_mb(CHARSET_INFO * cs, char *str)
static inline MY_UNICASE_CHARACTER* static inline MY_UNICASE_CHARACTER*
get_case_info_for_ch(const CHARSET_INFO *cs, uint page, uint offs) get_case_info_for_ch(CHARSET_INFO *cs, uint page, uint offs)
{ {
MY_UNICASE_CHARACTER *p; MY_UNICASE_CHARACTER *p;
return cs->caseinfo && (p= cs->caseinfo->page[page]) ? &p[offs] : NULL; return cs->caseinfo && (p= cs->caseinfo->page[page]) ? &p[offs] : NULL;

View File

@ -1079,7 +1079,7 @@ static MY_UNICASE_INFO my_caseinfo_sjis=
}; };
static int my_strnncoll_sjis_internal(const CHARSET_INFO *cs, static int my_strnncoll_sjis_internal(CHARSET_INFO *cs,
const uchar **a_res, size_t a_length, const uchar **a_res, size_t a_length,
const uchar **b_res, size_t b_length) const uchar **b_res, size_t b_length)
{ {

View File

@ -618,7 +618,7 @@ ret:
*/ */
static size_t static size_t
my_strnxfrm_tis620(const CHARSET_INFO *cs, my_strnxfrm_tis620(CHARSET_INFO *cs,
uchar *dst, size_t dstlen, uint nweights, uchar *dst, size_t dstlen, uint nweights,
const uchar *src, size_t srclen, uint flags) const uchar *src, size_t srclen, uint flags)
{ {

View File

@ -20714,7 +20714,7 @@ static int my_strnncoll_uca(CHARSET_INFO *cs,
static inline int static inline int
my_space_weight(const CHARSET_INFO *cs) /* W3-TODO */ my_space_weight(CHARSET_INFO *cs) /* W3-TODO */
{ {
return cs->uca->level[0].weights[0][0x20 * cs->uca->level[0].lengths[0]]; return cs->uca->level[0].weights[0][0x20 * cs->uca->level[0].lengths[0]];
} }

View File

@ -1753,7 +1753,7 @@ struct charset_info_st my_charset_utf16_bin=
static int static int
my_utf16le_uni(const CHARSET_INFO *cs __attribute__((unused)), my_utf16le_uni(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t *pwc, const uchar *s, const uchar *e) my_wc_t *pwc, const uchar *s, const uchar *e)
{ {
my_wc_t lo; my_wc_t lo;
@ -1783,7 +1783,7 @@ my_utf16le_uni(const CHARSET_INFO *cs __attribute__((unused)),
static int static int
my_uni_utf16le(const CHARSET_INFO *cs __attribute__((unused)), my_uni_utf16le(CHARSET_INFO *cs __attribute__((unused)),
my_wc_t wc, uchar *s, uchar *e) my_wc_t wc, uchar *s, uchar *e)
{ {
uint32 first, second, total; uint32 first, second, total;
@ -1813,7 +1813,7 @@ my_uni_utf16le(const CHARSET_INFO *cs __attribute__((unused)),
static size_t static size_t
my_lengthsp_utf16le(const CHARSET_INFO *cs __attribute__((unused)), my_lengthsp_utf16le(CHARSET_INFO *cs __attribute__((unused)),
const char *ptr, size_t length) const char *ptr, size_t length)
{ {
const char *end= ptr + length; const char *end= ptr + length;