1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

Fix type mismatch. Table names are represented as LEX_STRING

objects whose length is stored in a size_t type.
This commit is contained in:
Davi Arnaut
2010-05-27 18:28:24 -03:00
parent 3cc56cb5ad
commit a3d61b0bb2
4 changed files with 14 additions and 12 deletions

View File

@@ -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;
if (!length || length > NAME_LEN)
return 1;
@@ -2809,18 +2810,19 @@ bool check_table_name(const char *name, uint length)
name_length++;
}
#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
return 0;
return FALSE;
#endif
}
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;
while (*name)
{
#if defined(USE_MB) && defined(USE_MB_IDENT)
@@ -2845,7 +2847,7 @@ bool check_column_name(const char *name)
name_length++;
}
/* 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);
}