summaryrefslogtreecommitdiff
path: root/storage/myisam/ft_parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage/myisam/ft_parser.c')
-rw-r--r--storage/myisam/ft_parser.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/storage/myisam/ft_parser.c b/storage/myisam/ft_parser.c
index 4cde3834ed7..cacedaaeea0 100644
--- a/storage/myisam/ft_parser.c
+++ b/storage/myisam/ft_parser.c
@@ -106,10 +106,10 @@ my_bool ft_boolean_check_syntax_string(const uchar *str)
3 - right bracket
4 - stopword found
*/
-uchar ft_get_word(CHARSET_INFO *cs, uchar **start, uchar *end,
+uchar ft_get_word(CHARSET_INFO *cs, const uchar **start, const uchar *end,
FT_WORD *word, MYSQL_FTPARSER_BOOLEAN_INFO *param)
{
- uchar *doc=*start;
+ const uchar *doc= *start;
int ctype;
uint mwc, length;
int mbl;
@@ -201,10 +201,11 @@ ret:
return param->type;
}
-uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
- FT_WORD *word, my_bool skip_stopwords)
+uchar ft_simple_get_word(CHARSET_INFO *cs, const uchar **start,
+ const uchar *end, FT_WORD *word,
+ my_bool skip_stopwords)
{
- uchar *doc= *start;
+ const uchar *doc= *start;
uint mwc, length;
int mbl;
int ctype;
@@ -216,7 +217,7 @@ uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
{
if (doc >= end)
DBUG_RETURN(0);
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
break;
}
@@ -225,7 +226,7 @@ uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
for (word->pos= doc; doc < end; length++,
doc+= (mbl > 0 ? mbl : (mbl < 0 ? -mbl : 1)))
{
- mbl= cs->cset->ctype(cs, &ctype, (uchar*)doc, (uchar*)end);
+ mbl= cs->cset->ctype(cs, &ctype, doc, end);
if (true_word_char(ctype, *doc))
mwc= 0;
else if (!misc_word_char(*doc) || mwc)
@@ -238,7 +239,7 @@ uchar ft_simple_get_word(CHARSET_INFO *cs, uchar **start, const uchar *end,
if (skip_stopwords == FALSE ||
(length >= ft_min_word_len && length < ft_max_word_len &&
- !is_stopword((char*) word->pos, word->len)))
+ !is_stopword(word->pos, word->len)))
{
*start= doc;
DBUG_RETURN(1);
@@ -257,8 +258,9 @@ void ft_parse_init(TREE *wtree, CHARSET_INFO *cs)
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
- char *word, int word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
+ __attribute__((unused)))
{
TREE *wtree;
FT_WORD w;
@@ -286,10 +288,10 @@ static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- char *doc_arg, int doc_len)
+ const uchar *doc_arg, size_t doc_len)
{
- uchar *doc= (uchar*) doc_arg;
- uchar *end= doc + doc_len;
+ const uchar *doc= doc_arg;
+ const uchar *end= doc + doc_len;
MY_FT_PARSER_PARAM *ft_param=param->mysql_ftparam;
TREE *wtree= ft_param->wtree;
FT_WORD w;
@@ -302,7 +304,7 @@ static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
}
-int ft_parse(TREE *wtree, uchar *doc, int doclen,
+int ft_parse(TREE *wtree, const uchar *doc, int doclen,
struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
@@ -377,7 +379,7 @@ MYSQL_FTPARSER_PARAM *ftparser_call_initializer(MI_INFO *info,
mysql_add_word != 0 - parser is initialized, or no
initialization needed. */
info->ftparser_param[ftparser_nr].mysql_add_word=
- (int (*)(struct st_mysql_ftparser_param *, char *, int,
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *, size_t,
MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;