maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #01639
[Branch ~maria-captains/maria/5.1] Rev 2770: Fixes after comments from last push:
------------------------------------------------------------
revno: 2770
committer: Michael Widenius <monty@xxxxxxxxxxxx>
branch nick: maria-5.1
timestamp: Mon 2009-11-30 15:36:06 +0200
message:
Fixes after comments from last push:
- Removed some not needed casts
- Change plugin.h to be 'binary compatible' with old versions
- Added mysql_ft_size_t typedef to plugin.h to make it trivial to change string lengths to size_t on next ABI change
- Made some fixes suggested by Kristian to make things more portable and future safe (when it comes to strict aliasing)
modified:
include/ft_global.h
include/mysql/plugin.h
include/mysql/plugin.h.pp
mysql-test/t/information_schema.test
sql/sp_head.cc
sql/sql_select.cc
sql/table.cc
storage/maria/ma_ft_boolean_search.c
storage/maria/ma_ft_nlq_search.c
storage/maria/ma_ft_parser.c
storage/maria/ma_ftdefs.h
storage/maria/maria_ftdump.c
storage/myisam/ft_boolean_search.c
storage/myisam/ft_nlq_search.c
storage/myisam/ft_parser.c
storage/myisam/myisam_ftdump.c
--
lp:maria
https://code.launchpad.net/~maria-captains/maria/5.1
Your team Maria developers is subscribed to branch lp:maria.
To unsubscribe from this branch go to https://code.launchpad.net/~maria-captains/maria/5.1/+edit-subscription.
=== modified file 'include/ft_global.h'
--- include/ft_global.h 2007-06-27 14:49:12 +0000
+++ include/ft_global.h 2009-11-30 13:36:06 +0000
@@ -76,6 +76,8 @@
extern const HA_KEYSEG ft_keysegs[FT_SEGS];
+typedef union {int32 i; float f;} FT_WEIGTH;
+
#ifdef __cplusplus
}
#endif
=== modified file 'include/mysql/plugin.h'
--- include/mysql/plugin.h 2009-11-29 23:08:56 +0000
+++ include/mysql/plugin.h 2009-11-30 13:36:06 +0000
@@ -564,19 +564,22 @@
nothing. See enum_ftparser_mode above.
*/
+/* TODO: Change the following int to size_t at next ABI update */
+typedef int mysql_ft_size_t;
+
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- const unsigned char *doc, size_t doc_len);
+ const unsigned char *doc, mysql_ft_size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- const unsigned char *word, size_t word_len,
+ const unsigned char *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
struct charset_info_st *cs;
- char *doc;
- int length;
- int flags;
+ const unsigned char *doc;
+ mysql_ft_size_t length;
+ unsigned int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
=== modified file 'include/mysql/plugin.h.pp'
--- include/mysql/plugin.h.pp 2009-11-29 23:08:56 +0000
+++ include/mysql/plugin.h.pp 2009-11-30 13:36:06 +0000
@@ -70,19 +70,20 @@
char prev;
char *quot;
} MYSQL_FTPARSER_BOOLEAN_INFO;
+typedef int mysql_ft_size_t;
typedef struct st_mysql_ftparser_param
{
int (*mysql_parse)(struct st_mysql_ftparser_param *,
- const unsigned char *doc, size_t doc_len);
+ const unsigned char *doc, mysql_ft_size_t doc_len);
int (*mysql_add_word)(struct st_mysql_ftparser_param *,
- const unsigned char *word, size_t word_len,
+ const unsigned char *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
void *ftparser_state;
void *mysql_ftparam;
struct charset_info_st *cs;
- char *doc;
- int length;
- int flags;
+ const unsigned char *doc;
+ mysql_ft_size_t length;
+ unsigned int flags;
enum enum_ftparser_mode mode;
} MYSQL_FTPARSER_PARAM;
struct st_mysql_ftparser
=== modified file 'mysql-test/t/information_schema.test'
--- mysql-test/t/information_schema.test 2009-11-29 23:08:56 +0000
+++ mysql-test/t/information_schema.test 2009-11-30 13:36:06 +0000
@@ -5,7 +5,7 @@
# on the presence of the log tables (which are CSV-based).
--source include/have_csv.inc
-# Check that innodb/xtradb is incompiled in as result depends on it
+# Check that InnoDB/XtraDB was compiled in as result depends on it
-- source include/have_innodb.inc
# Save the initial number of concurrent sessions
=== modified file 'sql/sp_head.cc'
--- sql/sp_head.cc 2009-11-29 23:08:56 +0000
+++ sql/sp_head.cc 2009-11-30 13:36:06 +0000
@@ -1924,7 +1924,7 @@
if (spvar->mode == sp_param_out)
{
Item_null *null_item= new Item_null();
- Item *tmp_item= (Item*) null_item;
+ Item *tmp_item= null_item;
if (!null_item ||
nctx->set_variable(thd, i, &tmp_item))
=== modified file 'sql/sql_select.cc'
--- sql/sql_select.cc 2009-11-29 23:08:56 +0000
+++ sql/sql_select.cc 2009-11-30 13:36:06 +0000
@@ -3586,7 +3586,7 @@
{
if (!field->eq(item->field))
{
- Item *tmp_item= (Item*) item;
+ Item *tmp_item= item;
add_key_field(key_fields, *and_level, cond_func, field,
TRUE, &tmp_item, 1, usable_tables,
sargables);
=== modified file 'sql/table.cc'
--- sql/table.cc 2009-11-29 23:08:56 +0000
+++ sql/table.cc 2009-11-30 13:36:06 +0000
@@ -2077,7 +2077,7 @@
else
{
char *str;
- const char **tmp = (const char**) (char*) buf;
+ const char **tmp = (const char**) buf;
str=(char *) (buf+a_length);
fix_type_pointers(&tmp, save_names, 1, &str);
}
=== modified file 'storage/maria/ma_ft_boolean_search.c'
--- storage/maria/ma_ft_boolean_search.c 2009-11-29 23:08:56 +0000
+++ storage/maria/ma_ft_boolean_search.c 2009-11-30 13:36:06 +0000
@@ -180,7 +180,7 @@
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,7 +282,7 @@
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *query, size_t len)
+ const uchar *query, mysql_ft_size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
@@ -299,7 +299,7 @@
}
-static int _ftb_parse_query(FTB *ftb, uchar *query, uint len,
+static int _ftb_parse_query(FTB *ftb, uchar *query, size_t len,
struct st_mysql_ftparser *parser)
{
MYSQL_FTPARSER_PARAM *param;
@@ -321,7 +321,7 @@
param->mysql_add_word= ftb_query_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (char*) query;
+ param->doc= query;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_FULL_BOOLEAN_INFO;
@@ -539,8 +539,8 @@
FT_INFO * maria_ft_init_boolean_search(MARIA_HA *info, uint keynr,
- uchar *query,
- uint query_len, CHARSET_INFO *cs)
+ uchar *query, size_t query_len,
+ CHARSET_INFO *cs)
{
FTB *ftb;
FTB_EXPR *ftbe;
@@ -615,8 +615,9 @@
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t word_len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
FT_WORD *w= (FT_WORD *)phrase_param->document->data;
@@ -647,7 +648,8 @@
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *document, size_t len)
+ const uchar *document,
+ mysql_ft_size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -678,8 +680,8 @@
-1 is returned if error occurs.
*/
-static int _ftb_check_phrase(FTB *ftb, const uchar *document, uint len,
- FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
+static int _ftb_check_phrase(FTB *ftb, const uchar *document, size_t len,
+ FTB_EXPR *ftbe, struct st_mysql_ftparser *parser)
{
MY_FTB_PHRASE_PARAM ftb_param;
MYSQL_FTPARSER_PARAM *param;
@@ -699,7 +701,7 @@
param->mysql_add_word= ftb_phrase_add_word;
param->mysql_ftparam= (void *)&ftb_param;
param->cs= ftb->charset;
- param->doc= (char *) document;
+ param->doc= document;
param->length= len;
param->flags= 0;
param->mode= MYSQL_FTPARSER_WITH_STOPWORDS;
@@ -872,8 +874,9 @@
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -933,7 +936,7 @@
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc, size_t len)
+ const uchar *doc, mysql_ft_size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -997,7 +1000,7 @@
{
if (!ftsi.pos)
continue;
- param->doc= (char *)ftsi.pos;
+ param->doc= ftsi.pos;
param->length= ftsi.len;
if (unlikely(parser->parse(param)))
return 0;
=== modified file 'storage/maria/ma_ft_nlq_search.c'
--- storage/maria/ma_ft_nlq_search.c 2009-11-29 23:08:56 +0000
+++ storage/maria/ma_ft_nlq_search.c 2009-11-30 13:36:06 +0000
@@ -51,6 +51,7 @@
double tmp_weight;
} FT_SUPERDOC;
+
static int FT_SUPERDOC_cmp(void* cmp_arg __attribute__((unused)),
FT_SUPERDOC *p1, FT_SUPERDOC *p2)
{
@@ -63,7 +64,7 @@
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int32 subkeys;
+ FT_WEIGTH subkeys;
int r;
uint doc_cnt;
FT_SUPERDOC sdoc, *sptr;
@@ -91,9 +92,9 @@
/* Skip rows inserted by current inserted */
for (r= _ma_search(info, &key, SEARCH_FIND, key_root) ;
!r &&
- (subkeys=ft_sintXkorr(info->last_key.data +
- info->last_key.data_length +
- info->last_key.ref_length - extra)) > 0 &&
+ (subkeys.i= ft_sintXkorr(info->last_key.data +
+ info->last_key.data_length +
+ info->last_key.ref_length - extra)) > 0 &&
info->cur_row.lastpos >= info->state->data_file_length ;
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root))
;
@@ -112,7 +113,7 @@
key.data+1, key.data_length-1, 0, 0))
break;
- if (subkeys<0)
+ if (subkeys.i < 0)
{
if (doc_cnt)
DBUG_RETURN(1); /* index is corrupted */
@@ -128,7 +129,8 @@
goto do_skip;
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
- tmp_weight=*(float*) (char*) &subkeys;
+ /* The weight we read was actually a float */
+ tmp_weight= subkeys.f;
#else
#error
#endif
@@ -163,9 +165,9 @@
else
r= _ma_search(info, &info->last_key, SEARCH_BIGGER, key_root);
do_skip:
- while ((subkeys=ft_sintXkorr(info->last_key.data +
- info->last_key.data_length +
- info->last_key.ref_length - extra)) > 0 &&
+ while ((subkeys.i= ft_sintXkorr(info->last_key.data +
+ info->last_key.data_length +
+ info->last_key.ref_length - extra)) > 0 &&
!r && info->cur_row.lastpos >= info->state->data_file_length)
r= _ma_search_next(info, &info->last_key, SEARCH_BIGGER, key_root);
@@ -206,7 +208,7 @@
FT_INFO *maria_ft_init_nlq_search(MARIA_HA *info, uint keynr, uchar *query,
- uint query_len, uint flags, uchar *record)
+ size_t query_len, uint flags, uchar *record)
{
TREE wtree;
ALL_IN_ONE aio;
=== modified file 'storage/maria/ma_ft_parser.c'
--- storage/maria/ma_ft_parser.c 2009-11-29 23:08:56 +0000
+++ storage/maria/ma_ft_parser.c 2009-11-30 13:36:06 +0000
@@ -260,7 +260,7 @@
static int maria_ft_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
__attribute__((unused)))
{
@@ -290,7 +290,8 @@
static int maria_ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc_arg, size_t doc_len)
+ const uchar *doc_arg,
+ mysql_ft_size_t doc_len)
{
const uchar *doc= doc_arg;
const uchar *end= doc + doc_len;
@@ -306,8 +307,8 @@
}
-int maria_ft_parse(TREE *wtree, uchar *doc, int doclen,
- struct st_mysql_ftparser *parser,
+int maria_ft_parse(TREE *wtree, uchar *doc, size_t doclen,
+ struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *param, MEM_ROOT *mem_root)
{
MY_FT_PARSER_PARAM my_param;
@@ -320,7 +321,7 @@
param->mysql_add_word= maria_ft_add_word;
param->mysql_ftparam= &my_param;
param->cs= wtree->custom_arg;
- param->doc= (char *) doc;
+ param->doc= doc;
param->length= doclen;
param->mode= MYSQL_FTPARSER_SIMPLE_MODE;
DBUG_RETURN(parser->parse(param));
@@ -380,8 +381,8 @@
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 *, const uchar *, size_t,
- MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *,
+ mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
=== modified file 'storage/maria/ma_ftdefs.h'
--- storage/maria/ma_ftdefs.h 2009-11-29 23:08:56 +0000
+++ storage/maria/ma_ftdefs.h 2009-11-30 13:36:06 +0000
@@ -122,15 +122,17 @@
uint _ma_ft_segiterator(FT_SEG_ITERATOR *);
void maria_ft_parse_init(TREE *, CHARSET_INFO *);
-int maria_ft_parse(TREE *, uchar *, int, struct st_mysql_ftparser *parser,
+int maria_ft_parse(TREE *, uchar *, size_t, struct st_mysql_ftparser *parser,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
FT_WORD * maria_ft_linearize(TREE *, MEM_ROOT *);
FT_WORD * _ma_ft_parserecord(MARIA_HA *, uint, const uchar *, MEM_ROOT *);
uint _ma_ft_parse(TREE *, MARIA_HA *, uint, const uchar *,
MYSQL_FTPARSER_PARAM *, MEM_ROOT *);
-FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, uint, uint, uchar *);
-FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, uint, CHARSET_INFO *);
+FT_INFO *maria_ft_init_nlq_search(MARIA_HA *, uint, uchar *, size_t, uint,
+ uchar *);
+FT_INFO *maria_ft_init_boolean_search(MARIA_HA *, uint, uchar *, size_t,
+ CHARSET_INFO *);
extern const struct _ft_vft _ma_ft_vft_nlq;
int maria_ft_nlq_read_next(FT_INFO *, char *);
=== modified file 'storage/maria/maria_ftdump.c'
--- storage/maria/maria_ftdump.c 2009-11-29 23:08:56 +0000
+++ storage/maria/maria_ftdump.c 2009-11-30 13:36:06 +0000
@@ -53,7 +53,7 @@
int main(int argc,char *argv[])
{
- int error=0, subkeys;
+ int error=0;
uint keylen, keylen2=0, inx, doc_cnt=0;
float weight= 1.0;
double gws, min_gws=0, avg_gws=0;
@@ -112,11 +112,12 @@
while (!(error=maria_rnext(info,NULL,inx)))
{
+ FT_WEIGTH subkeys;
keylen=*(info->lastkey_buff);
- subkeys=ft_sintXkorr(info->lastkey_buff + keylen + 1);
- if (subkeys >= 0)
- weight=*(float*) (char*) &subkeys;
+ subkeys.i= ft_sintXkorr(info->lastkey_buff + keylen + 1);
+ if (subkeys.i >= 0)
+ weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey_buff+1);
@@ -153,14 +154,15 @@
keylen2=keylen;
doc_cnt=0;
}
- doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
+ doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
}
if (dump)
{
- if (subkeys>=0)
+ if (subkeys.i >= 0)
printf("%9lx %20.7f %s\n", (long) info->cur_row.lastpos,weight,buf);
else
- printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys,buf);
+ printf("%9lx => %17d %s\n",(long) info->cur_row.lastpos,-subkeys.i,
+ buf);
}
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total);
=== modified file 'storage/myisam/ft_boolean_search.c'
--- storage/myisam/ft_boolean_search.c 2009-11-29 23:08:56 +0000
+++ storage/myisam/ft_boolean_search.c 2009-11-30 13:36:06 +0000
@@ -180,7 +180,7 @@
static int ftb_query_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *info)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
@@ -282,7 +282,7 @@
static int ftb_parse_query_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *query, size_t len)
+ const uchar *query, mysql_ft_size_t len)
{
MY_FTB_PARAM *ftb_param= param->mysql_ftparam;
MYSQL_FTPARSER_BOOLEAN_INFO info;
@@ -616,7 +616,7 @@
static int ftb_phrase_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
{
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -648,7 +648,8 @@
static int ftb_check_phrase_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *document, size_t len)
+ const uchar *document,
+ mysql_ft_size_t len)
{
FT_WORD word;
MY_FTB_PHRASE_PARAM *phrase_param= param->mysql_ftparam;
@@ -874,8 +875,9 @@
static int ftb_find_relevance_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t len,
- MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info __attribute__((unused)))
+ const uchar *word, mysql_ft_size_t len,
+ MYSQL_FTPARSER_BOOLEAN_INFO
+ *boolean_info __attribute__((unused)))
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
@@ -935,7 +937,7 @@
static int ftb_find_relevance_parse(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc, size_t len)
+ const uchar *doc, mysql_ft_size_t len)
{
MY_FTB_FIND_PARAM *ftb_param= param->mysql_ftparam;
FT_INFO *ftb= ftb_param->ftb;
=== modified file 'storage/myisam/ft_nlq_search.c'
--- storage/myisam/ft_nlq_search.c 2009-11-29 23:08:56 +0000
+++ storage/myisam/ft_nlq_search.c 2009-11-30 13:36:06 +0000
@@ -63,7 +63,7 @@
static int walk_and_match(FT_WORD *word, uint32 count, ALL_IN_ONE *aio)
{
- int32 subkeys;
+ FT_WEIGTH subkeys;
int r;
uint keylen, doc_cnt;
FT_SUPERDOC sdoc, *sptr;
@@ -91,7 +91,7 @@
/* Skip rows inserted by current inserted */
for (r=_mi_search(info, keyinfo, keybuff, keylen, SEARCH_FIND, key_root) ;
!r &&
- (subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
+ (subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
info->lastpos >= info->state->data_file_length ;
r= _mi_search_next(info, keyinfo, info->lastkey,
info->lastkey_length, SEARCH_BIGGER, key_root))
@@ -108,7 +108,7 @@
info->lastkey_length-extra-1, keybuff+1,keylen-1,0,0))
break;
- if (subkeys<0)
+ if (subkeys.i < 0)
{
if (doc_cnt)
DBUG_RETURN(1); /* index is corrupted */
@@ -125,7 +125,7 @@
}
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
/* The weight we read was actually a float */
- tmp_weight=*(float*) (char*) &subkeys;
+ tmp_weight= subkeys.f;
#else
#error
#endif
@@ -162,7 +162,7 @@
r=_mi_search(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
do_skip:
- while ((subkeys=ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
+ while ((subkeys.i= ft_sintXkorr(info->lastkey+info->lastkey_length-extra)) > 0 &&
!r && info->lastpos >= info->state->data_file_length)
r= _mi_search_next(info, keyinfo, info->lastkey, info->lastkey_length,
SEARCH_BIGGER, key_root);
=== modified file 'storage/myisam/ft_parser.c'
--- storage/myisam/ft_parser.c 2009-11-29 23:08:56 +0000
+++ storage/myisam/ft_parser.c 2009-11-30 13:36:06 +0000
@@ -258,7 +258,7 @@
static int ft_add_word(MYSQL_FTPARSER_PARAM *param,
- const uchar *word, size_t word_len,
+ const uchar *word, mysql_ft_size_t word_len,
MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info
__attribute__((unused)))
{
@@ -288,7 +288,7 @@
static int ft_parse_internal(MYSQL_FTPARSER_PARAM *param,
- const uchar *doc_arg, size_t doc_len)
+ const uchar *doc_arg, mysql_ft_size_t doc_len)
{
const uchar *doc= doc_arg;
const uchar *end= doc + doc_len;
@@ -379,8 +379,8 @@
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 *, const uchar *, size_t,
- MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
+ (int (*)(struct st_mysql_ftparser_param *, const uchar *,
+ mysql_ft_size_t, MYSQL_FTPARSER_BOOLEAN_INFO *)) 1;
if (parser->init && parser->init(&info->ftparser_param[ftparser_nr]))
return 0;
}
=== modified file 'storage/myisam/myisam_ftdump.c'
--- storage/myisam/myisam_ftdump.c 2009-11-29 23:08:56 +0000
+++ storage/myisam/myisam_ftdump.c 2009-11-30 13:36:06 +0000
@@ -53,7 +53,7 @@
int main(int argc,char *argv[])
{
- int error=0, subkeys;
+ int error=0;
uint keylen, keylen2=0, inx, doc_cnt=0;
float weight= 1.0;
double gws, min_gws=0, avg_gws=0;
@@ -109,11 +109,12 @@
while (!(error=mi_rnext(info,NULL,inx)))
{
+ FT_WEIGTH subkeys;
keylen=*(info->lastkey);
- subkeys=ft_sintXkorr(info->lastkey+keylen+1);
- if (subkeys >= 0)
- weight= *(float*) (char*) &subkeys;
+ subkeys.i =ft_sintXkorr(info->lastkey+keylen+1);
+ if (subkeys.i >= 0)
+ weight= subkeys.f;
#ifdef HAVE_SNPRINTF
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
@@ -150,14 +151,14 @@
keylen2=keylen;
doc_cnt=0;
}
- doc_cnt+= (subkeys >= 0 ? 1 : -subkeys);
+ doc_cnt+= (subkeys.i >= 0 ? 1 : -subkeys.i);
}
if (dump)
{
- if (subkeys>=0)
+ if (subkeys.i >= 0)
printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf);
else
- printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf);
+ printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys.i,buf);
}
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total);