Commit d108c80e authored by Davi Arnaut's avatar Davi Arnaut

Fix type mismatch. Table names are represented as LEX_STRING

objects whose length is stored in a size_t type.
parent ad081387
...@@ -370,8 +370,8 @@ bool LOGGER::is_log_table_enabled(uint log_table_type) ...@@ -370,8 +370,8 @@ bool LOGGER::is_log_table_enabled(uint log_table_type)
/* Check if a given table is opened log table */ /* Check if a given table is opened log table */
int check_if_log_table(uint db_len, const char *db, uint table_name_len, int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
const char *table_name, uint check_if_opened) const char *table_name, bool check_if_opened)
{ {
if (db_len == 5 && if (db_len == 5 &&
!(lower_case_table_names ? !(lower_case_table_names ?
......
...@@ -499,8 +499,8 @@ public: ...@@ -499,8 +499,8 @@ public:
}; };
int check_if_log_table(uint db_len, const char *db, uint table_name_len, int check_if_log_table(size_t db_len, const char *db, size_t table_name_len,
const char *table_name, uint check_if_opened); const char *table_name, bool check_if_opened);
class Log_to_csv_event_handler: public Log_event_handler class Log_to_csv_event_handler: public Log_event_handler
{ {
......
...@@ -2777,9 +2777,10 @@ bool check_db_name(LEX_STRING *org_name) ...@@ -2777,9 +2777,10 @@ bool check_db_name(LEX_STRING *org_name)
*/ */
bool check_table_name(const char *name, uint length) bool check_table_name(const char *name, size_t length)
{ {
uint name_length= 0; // name length in symbols // name length in symbols
size_t name_length= 0;
const char *end= name+length; const char *end= name+length;
if (!length || length > NAME_LEN) if (!length || length > NAME_LEN)
return 1; return 1;
...@@ -2809,16 +2810,17 @@ bool check_table_name(const char *name, uint length) ...@@ -2809,16 +2810,17 @@ bool check_table_name(const char *name, uint length)
name_length++; name_length++;
} }
#if defined(USE_MB) && defined(USE_MB_IDENT) #if defined(USE_MB) && defined(USE_MB_IDENT)
return (last_char_is_space || name_length > NAME_CHAR_LEN) ; return last_char_is_space || (name_length > NAME_CHAR_LEN);
#else #else
return 0; return FALSE;
#endif #endif
} }
bool check_column_name(const char *name) bool check_column_name(const char *name)
{ {
uint name_length= 0; // name length in symbols // name length in symbols
size_t name_length= 0;
bool last_char_is_space= TRUE; bool last_char_is_space= TRUE;
while (*name) while (*name)
...@@ -2845,7 +2847,7 @@ bool check_column_name(const char *name) ...@@ -2845,7 +2847,7 @@ bool check_column_name(const char *name)
name_length++; name_length++;
} }
/* Error if empty or too long column name */ /* Error if empty or too long column name */
return last_char_is_space || (uint) name_length > NAME_CHAR_LEN; return last_char_is_space || (name_length > NAME_CHAR_LEN);
} }
......
...@@ -2001,7 +2001,7 @@ void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form); ...@@ -2001,7 +2001,7 @@ void update_create_info_from_table(HA_CREATE_INFO *info, TABLE *form);
bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase); bool check_and_convert_db_name(LEX_STRING *db, bool preserve_lettercase);
bool check_db_name(LEX_STRING *db); bool check_db_name(LEX_STRING *db);
bool check_column_name(const char *name); bool check_column_name(const char *name);
bool check_table_name(const char *name, uint length); bool check_table_name(const char *name, size_t length);
int rename_file_ext(const char * from,const char * to,const char * ext); int rename_file_ext(const char * from,const char * to,const char * ext);
char *get_field(MEM_ROOT *mem, Field *field); char *get_field(MEM_ROOT *mem, Field *field);
bool get_field(MEM_ROOT *mem, Field *field, class String *res); bool get_field(MEM_ROOT *mem, Field *field, class String *res);
......
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