Skip to content

Commit

Permalink
Bug #42144: plugin_load fails
Browse files Browse the repository at this point in the history
Reverted the ulong->uint diff
Re-applied the first diff.
The original commit message follows:

enum plugin system variables are ulong internally, not int.
On systems where long is not the same as an int it causes
problems. 
Fixed by correct typecasting. Removed the test from the 
experimental list.

--BZR--
revision-id: [email protected]
property-branch-nick: fix-5.1-bugteam
testament3-sha1: 81fb2eec0cd294ec63bd319cea91e797a39acd11
  • Loading branch information
gkodinov committed Aug 4, 2010
1 parent bd3b040 commit 6115c7a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion include/mysql/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \
#name, comment, check, update, &varname, def, min, max, blk }

#define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned int) = { \
DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib }

Expand Down
10 changes: 5 additions & 5 deletions mysys/my_getopt.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,13 +664,13 @@ static int setval(const struct my_option *opts, void *value, char *argument,
Accept an integer representation of the enumerated item.
*/
char *endptr;
uint arg= (uint) strtoul(argument, &endptr, 10);
ulong arg= strtoul(argument, &endptr, 10);
if (*endptr || arg >= opts->typelib->count)
return EXIT_ARGUMENT_INVALID;
*(uint*)result_pos= arg;
*((ulong*) result_pos)= arg;
}
else
*(uint*)result_pos= type - 1;
*((ulong*) result_pos)= type - 1;
}
break;
case GET_SET:
Expand Down Expand Up @@ -1008,7 +1008,7 @@ static void init_one_value(const struct my_option *option, void *variable,
*((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
break;
case GET_ENUM:
*((uint*) variable)= (uint) value;
*((ulong*) variable)= (ulong) value;
break;
case GET_UINT:
*((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
Expand Down Expand Up @@ -1248,7 +1248,7 @@ void my_print_variables(const struct my_option *options)
}
break;
case GET_ENUM:
printf("%s\n", get_type(optp->typelib, *(uint*) value));
printf("%s\n", get_type(optp->typelib, *(ulong*) value));
break;
case GET_STR:
case GET_STR_ALLOC: /* fall through */
Expand Down
8 changes: 4 additions & 4 deletions sql/sql_plugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3030,12 +3030,12 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
Allocate temporary space for the value of the tristate.
This option will have a limited lifetime and is not used beyond
server initialization.
GET_ENUM value is unsigned integer.
GET_ENUM value is a unsigned long integer.
*/
options[0].value= options[1].value= (uchar **)alloc_root(mem_root,
sizeof(uint));
*((uint*) options[0].value)= *((uint*) options[1].value)=
(uint) options[0].def_value;
sizeof(ulong));
*((ulong*) options[0].value)= *((ulong*) options[1].value)=
(ulong) options[0].def_value;

options+= 2;

Expand Down
2 changes: 1 addition & 1 deletion storage/example/ha_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ int ha_example::create(const char *name, TABLE *table_arg,
struct st_mysql_storage_engine example_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };

static uint srv_enum_var= 0;
static ulong srv_enum_var= 0;
static ulong srv_ulong_var= 0;

const char *enum_var_names[]=
Expand Down

0 comments on commit 6115c7a

Please sign in to comment.