summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-03 19:01:30 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-03 19:01:30 +0300
commit5eeb6488cf3973c3821aef10d40ed221985f9190 (patch)
treeea6251ab5067de2f16859c5fba5e0da34d11b2f2
parent60ab046abc82f75a174bf2ed19ef631a1a2e059a (diff)
downloadmariadb-git-5eeb6488cf3973c3821aef10d40ed221985f9190.tar.gz
Bug #42144: plugin_load fails
The enum system variables were handled inconsistently as ints, unsigned int and unsigned long on various places. This caused problems on platforms on which sizeof(int) != sizeof(long). Fixed by homogenizing the type of the enum variables to unsigned int, since it's size compatible with the C enum type. Removed the test from the experimental list.
-rw-r--r--include/mysql/plugin.h2
-rw-r--r--mysql-test/collections/default.experimental1
-rw-r--r--mysys/my_getopt.c24
-rw-r--r--sql/sql_plugin.cc4
-rw-r--r--storage/example/ha_example.cc2
5 files changed, 18 insertions, 15 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h
index 55ef6070f85..c2ca8a0f94e 100644
--- a/include/mysql/plugin.h
+++ b/include/mysql/plugin.h
@@ -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 long) = { \
+DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned int) = { \
PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \
#name, comment, check, update, &varname, def, typelib }
diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental
index f84337660ea..d47523ad945 100644
--- a/mysql-test/collections/default.experimental
+++ b/mysql-test/collections/default.experimental
@@ -14,7 +14,6 @@ funcs_2.ndb_charset # joro : NDB tests marked as experiment
main.ctype_gbk_binlog @solaris # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
main.func_str @solaris # joro: Bug#40928
-main.plugin_load @solaris # Bug#42144
main.sp @solaris # joro : Bug#54138
main.outfile_loaddata @solaris # joro : Bug #46895
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index b0e7175d0b9..6ed4189a69a 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -656,17 +656,21 @@ static int setval(const struct my_option *opts, void *value, char *argument,
return EXIT_OUT_OF_MEMORY;
break;
case GET_ENUM:
- if (((*(int*)result_pos)=
- find_type(argument, opts->typelib, 2) - 1) < 0)
{
- /*
- Accept an integer representation of the enumerated item.
- */
- char *endptr;
- unsigned int arg= (unsigned int) strtol(argument, &endptr, 10);
- if (*endptr || arg >= opts->typelib->count)
- return EXIT_ARGUMENT_INVALID;
- *(int*)result_pos= arg;
+ int type= find_type(argument, opts->typelib, 2);
+ if (type < 1)
+ {
+ /*
+ Accept an integer representation of the enumerated item.
+ */
+ char *endptr;
+ uint arg= (uint) strtoul(argument, &endptr, 10);
+ if (*endptr || arg >= opts->typelib->count)
+ return EXIT_ARGUMENT_INVALID;
+ *(uint*)result_pos= arg;
+ }
+ else
+ *(uint*)result_pos= type - 1;
}
break;
case GET_SET:
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 7383d59a1d9..6eed702e5ec 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -3030,10 +3030,10 @@ 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 an integer.
+ GET_ENUM value is unsigned integer.
*/
options[0].value= options[1].value= (uchar **)alloc_root(mem_root,
- sizeof(int));
+ sizeof(uint));
*((uint*) options[0].value)= *((uint*) options[1].value)=
(uint) options[0].def_value;
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 2a4fe538c85..402be70efab 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -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 ulong srv_enum_var= 0;
+static uint srv_enum_var= 0;
static ulong srv_ulong_var= 0;
const char *enum_var_names[]=