From c1545bec1e0d9bea337f3810e84d721195e5a016 Mon Sep 17 00:00:00 2001
From: Davi Arnaut <davi.arnaut@oracle.com>
Date: Sat, 24 Jul 2010 09:24:44 -0300
Subject: [PATCH] Bug#42733: Type-punning warnings when compiling MySQL

Post-merge fix: remove remaining casts which are now
unnecessary and are actually causing warnings.
---
 client/mysqltest.cc                           |  7 +--
 sql/gen_lex_hash.cc                           |  9 +--
 storage/myisam/myisam_ftdump.c                |  2 +-
 storage/ndb/include/util/ndb_opts.h           | 22 ++++----
 storage/ndb/src/cw/cpcd/main.cpp              | 12 ++--
 storage/ndb/src/kernel/vm/Configuration.cpp   | 16 +++---
 storage/ndb/src/mgmclient/main.cpp            |  4 +-
 storage/ndb/src/mgmsrv/main.cpp               | 14 ++---
 storage/ndb/test/ndbapi/testIndexStat.cpp     | 26 ++++-----
 storage/ndb/test/ndbapi/test_event_merge.cpp  | 34 +++++------
 .../test/ndbapi/test_event_multi_table.cpp    |  2 +-
 storage/ndb/test/run-test/main.cpp            | 36 ++++++------
 storage/ndb/test/src/NDBT_Test.cpp            | 20 +++----
 storage/ndb/test/tools/connect.cpp            |  6 +-
 storage/ndb/tools/delete_all.cpp              |  8 +--
 storage/ndb/tools/desc.cpp                    |  8 +--
 storage/ndb/tools/drop_index.cpp              |  2 +-
 storage/ndb/tools/drop_tab.cpp                |  2 +-
 storage/ndb/tools/listTables.cpp              | 12 ++--
 storage/ndb/tools/ndb_config.cpp              | 22 ++++----
 storage/ndb/tools/restore/restore_main.cpp    | 56 +++++++++----------
 storage/ndb/tools/select_all.cpp              | 26 ++++-----
 storage/ndb/tools/select_count.cpp            |  6 +-
 storage/ndb/tools/waiter.cpp                  |  8 +--
 tests/thread_test.c                           | 28 +++++-----
 25 files changed, 194 insertions(+), 194 deletions(-)

diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 3b4c593922b..20f0f6d3164 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -5954,8 +5954,8 @@ static struct my_option my_long_options[] =
    GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"result-format-version", OPT_RESULT_FORMAT_VERSION,
    "Version of the result file format to use",
-   (uchar**) &opt_result_format_version,
-   (uchar**) &opt_result_format_version, 0,
+   &opt_result_format_version,
+   &opt_result_format_version, 0,
    GET_INT, REQUIRED_ARG, 1, 1, 2, 0, 0, 0},
   {"server-arg", 'A', "Send option value to embedded server as a parameter.",
    0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -5998,8 +5998,7 @@ static struct my_option my_long_options[] =
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"connect_timeout", OPT_CONNECT_TIMEOUT,
    "Number of seconds before connection timeout.",
-   (uchar**) &opt_connect_timeout,
-   (uchar**) &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
+   &opt_connect_timeout, &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG,
    120, 0, 3600 * 12, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/sql/gen_lex_hash.cc b/sql/gen_lex_hash.cc
index 5a0904f87b9..178b038a6cd 100644
--- a/sql/gen_lex_hash.cc
+++ b/sql/gen_lex_hash.cc
@@ -87,7 +87,8 @@ So, we can read full search-structure as 32-bit word
 #include "mysql_version.h"
 #include "lex.h"
 
-const char *default_dbug_option="d:t:o,/tmp/gen_lex_hash.trace";
+static char default_dbug_option[]= "d:t:o,/tmp/gen_lex_hash.trace";
+static char *dbug_option= default_dbug_option;
 
 struct my_option my_long_options[] =
 {
@@ -95,8 +96,8 @@ struct my_option my_long_options[] =
   {"debug", '#', "This is a non-debug version. Catch this and exit",
    0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #else
-  {"debug", '#', "Output debug log", (uchar**) &default_dbug_option,
-   (uchar**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
+  {"debug", '#', "Output debug log", &dbug_option,
+   &dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
 #endif
   {"help", '?', "Display help and exit",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
@@ -368,7 +369,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
     usage(0);
     exit(0);
   case '#':
-    DBUG_PUSH(argument ? argument : default_dbug_option);
+    DBUG_PUSH(argument ? argument : dbug_option);
     break;
   }
   return 0;
diff --git a/storage/myisam/myisam_ftdump.c b/storage/myisam/myisam_ftdump.c
index 4718abc3481..1c534fe8d02 100644
--- a/storage/myisam/myisam_ftdump.c
+++ b/storage/myisam/myisam_ftdump.c
@@ -46,7 +46,7 @@ static struct my_option my_long_options[] =
   {"stats", 's', "Report global stats.",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
   {"verbose", 'v', "Be verbose.",
-   (uchar**) &verbose, (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+   &verbose, &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
 
diff --git a/storage/ndb/include/util/ndb_opts.h b/storage/ndb/include/util/ndb_opts.h
index f18bb9646cc..59d9eaf4d33 100644
--- a/storage/ndb/include/util/ndb_opts.h
+++ b/storage/ndb/include/util/ndb_opts.h
@@ -58,40 +58,40 @@ const char *opt_debug= 0;
     "Set connect string for connecting to ndb_mgmd. " \
     "Syntax: \"[nodeid=<id>;][host=]<hostname>[:<port>]\". " \
     "Overrides specifying entries in NDB_CONNECTSTRING and my.cnf", \
-    (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
+    &opt_ndb_connectstring, &opt_ndb_connectstring, \
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
   { "ndb-mgmd-host", OPT_NDB_MGMD, \
     "Set host and port for connecting to ndb_mgmd. " \
     "Syntax: <hostname>[:<port>].", \
-    (uchar**) &opt_ndb_mgmd, (uchar**) &opt_ndb_mgmd, 0, \
+    &opt_ndb_mgmd, &opt_ndb_mgmd, 0, \
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
   { "ndb-nodeid", OPT_NDB_NODEID, \
     "Set node id for this node.", \
-    (uchar**) &opt_ndb_nodeid, (uchar**) &opt_ndb_nodeid, 0, \
+    &opt_ndb_nodeid, &opt_ndb_nodeid, 0, \
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
   { "ndb-shm", OPT_NDB_SHM,\
     "Allow optimizing using shared memory connections when available",\
-    (uchar**) &opt_ndb_shm, (uchar**) &opt_ndb_shm, 0,\
+    &opt_ndb_shm, &opt_ndb_shm, 0,\
     GET_BOOL, NO_ARG, OPT_NDB_SHM_DEFAULT, 0, 0, 0, 0, 0 },\
   {"ndb-optimized-node-selection", OPT_NDB_OPTIMIZED_NODE_SELECTION,\
     "Select nodes for transactions in a more optimal way",\
-    (uchar**) &opt_ndb_optimized_node_selection,\
-    (uchar**) &opt_ndb_optimized_node_selection, 0,\
+    &opt_ndb_optimized_node_selection,\
+    &opt_ndb_optimized_node_selection, 0,\
     GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},\
   { "connect-string", OPT_NDB_CONNECTSTRING, "same as --ndb-connectstring",\
-    (uchar**) &opt_ndb_connectstring, (uchar**) &opt_ndb_connectstring, \
+    &opt_ndb_connectstring, &opt_ndb_connectstring, \
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },\
   { "core-file", OPT_WANT_CORE, "Write core on errors.",\
-    (uchar**) &opt_core, (uchar**) &opt_core, 0,\
+    &opt_core, &opt_core, 0,\
     GET_BOOL, NO_ARG, OPT_WANT_CORE_DEFAULT, 0, 0, 0, 0, 0},\
   {"character-sets-dir", OPT_CHARSETS_DIR,\
-     "Directory where character sets are.", (uchar**) &charsets_dir,\
-     (uchar**) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
+     "Directory where character sets are.", &charsets_dir,\
+     &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}\
 
 #ifndef DBUG_OFF
 #define NDB_STD_OPTS(prog_name) \
   { "debug", '#', "Output debug log. Often this is 'd:t:o,filename'.", \
-    (uchar**) &opt_debug, (uchar**) &opt_debug, \
+    &opt_debug, &opt_debug, \
     0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0 }, \
   NDB_STD_OPTS_COMMON
 #else
diff --git a/storage/ndb/src/cw/cpcd/main.cpp b/storage/ndb/src/cw/cpcd/main.cpp
index d5c31d610cb..b750c00bc2a 100644
--- a/storage/ndb/src/cw/cpcd/main.cpp
+++ b/storage/ndb/src/cw/cpcd/main.cpp
@@ -39,22 +39,22 @@ static const char *user = 0;
 static struct my_option my_long_options[] =
 {
   { "work-dir", 'w', "Work directory",
-    (uchar**) &work_dir, (uchar**) &work_dir,  0,
+    &work_dir, &work_dir,  0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "port", 'p', "TCP port to listen on",
-    (uchar**) &port, (uchar**) &port, 0,
+    &port, &port, 0,
     GET_INT, REQUIRED_ARG, CPCD_DEFAULT_TCP_PORT, 0, 0, 0, 0, 0 }, 
   { "syslog", 'S', "Log events to syslog",
-    (uchar**) &use_syslog, (uchar**) &use_syslog, 0,
+    &use_syslog, &use_syslog, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "logfile", 'L', "File to log events to",
-    (uchar**) &logfile, (uchar**) &logfile, 0,
+    &logfile, &logfile, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "debug", 'D', "Enable debug mode",
-    (uchar**) &debug, (uchar**) &debug, 0,
+    &debug, &debug, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "user", 'u', "Run as user",
-    (uchar**) &user, (uchar**) &user, 0,
+    &user, &user, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/src/kernel/vm/Configuration.cpp b/storage/ndb/src/kernel/vm/Configuration.cpp
index 72770d35cde..f1e608738e3 100644
--- a/storage/ndb/src/kernel/vm/Configuration.cpp
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp
@@ -74,35 +74,35 @@ static struct my_option my_long_options[] =
   { "initial", OPT_INITIAL,
     "Perform initial start of ndbd, including cleaning the file system. "
     "Consult documentation before using this",
-    (uchar**) &_initial, (uchar**) &_initial, 0,
+    &_initial, &_initial, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "nostart", 'n',
     "Don't start ndbd immediately. Ndbd will await command from ndb_mgmd",
-    (uchar**) &_no_start, (uchar**) &_no_start, 0,
+    &_no_start, &_no_start, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "daemon", 'd', "Start ndbd as daemon (default)",
-    (uchar**) &_daemon, (uchar**) &_daemon, 0,
+    &_daemon, &_daemon, 0,
     GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
   { "nodaemon", OPT_NODAEMON,
     "Do not start ndbd as daemon, provided for testing purposes",
-    (uchar**) &_no_daemon, (uchar**) &_no_daemon, 0,
+    &_no_daemon, &_no_daemon, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "foreground", OPT_FOREGROUND,
     "Run real ndbd in foreground, provided for debugging purposes"
     " (implies --nodaemon)",
-    (uchar**) &_foreground, (uchar**) &_foreground, 0,
+    &_foreground, &_foreground, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "nowait-nodes", OPT_NOWAIT_NODES, 
     "Nodes that will not be waited for during start",
-    (uchar**) &_nowait_nodes, (uchar**) &_nowait_nodes, 0,
+    &_nowait_nodes, &_nowait_nodes, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "initial-start", OPT_INITIAL_START, 
     "Perform initial start",
-    (uchar**) &_initialstart, (uchar**) &_initialstart, 0,
+    &_initialstart, &_initialstart, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "bind-address", OPT_NOWAIT_NODES, 
     "Local bind address",
-    (uchar**) &_bind_address, (uchar**) &_bind_address, 0,
+    &_bind_address, &_bind_address, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/src/mgmclient/main.cpp b/storage/ndb/src/mgmclient/main.cpp
index 980530953ad..7049bdd12e0 100644
--- a/storage/ndb/src/mgmclient/main.cpp
+++ b/storage/ndb/src/mgmclient/main.cpp
@@ -73,11 +73,11 @@ static struct my_option my_long_options[] =
   NDB_STD_OPTS("ndb_mgm"),
   { "execute", 'e',
     "execute command and exit", 
-    (uchar**) &opt_execute_str, (uchar**) &opt_execute_str, 0,
+    &opt_execute_str, &opt_execute_str, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "try-reconnect", 't',
     "Specify number of tries for connecting to ndb_mgmd (0 = infinite)", 
-    (uchar**) &_try_reconnect, (uchar**) &_try_reconnect, 0,
+    &_try_reconnect, &_try_reconnect, 0,
     GET_UINT, REQUIRED_ARG, 3, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/src/mgmsrv/main.cpp b/storage/ndb/src/mgmsrv/main.cpp
index 26198a44a23..e0d9a550cd2 100644
--- a/storage/ndb/src/mgmsrv/main.cpp
+++ b/storage/ndb/src/mgmsrv/main.cpp
@@ -142,29 +142,29 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_mgmd"),
   { "config-file", 'f', "Specify cluster configuration file",
-    (uchar**) &opt_config_filename, (uchar**) &opt_config_filename, 0,
+    &opt_config_filename, &opt_config_filename, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "print-full-config", 'P', "Print full config and exit",
-    (uchar**) &g_print_full_config, (uchar**) &g_print_full_config, 0,
+    &g_print_full_config, &g_print_full_config, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "daemon", 'd', "Run ndb_mgmd in daemon mode (default)",
-    (uchar**) &opt_daemon, (uchar**) &opt_daemon, 0,
+    &opt_daemon, &opt_daemon, 0,
     GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 },
   { "interactive", OPT_INTERACTIVE,
     "Run interactive. Not supported but provided for testing purposes",
-    (uchar**) &opt_interactive, (uchar**) &opt_interactive, 0,
+    &opt_interactive, &opt_interactive, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-nodeid-checks", OPT_NO_NODEID_CHECKS,
     "Do not provide any node id checks", 
-    (uchar**) &g_no_nodeid_checks, (uchar**) &g_no_nodeid_checks, 0,
+    &g_no_nodeid_checks, &g_no_nodeid_checks, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "nodaemon", OPT_NO_DAEMON,
     "Don't run as daemon, but don't read from stdin",
-    (uchar**) &opt_non_interactive, (uchar**) &opt_non_interactive, 0,
+    &opt_non_interactive, &opt_non_interactive, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "mycnf", 256,
     "Read cluster config from my.cnf",
-    (uchar**) &opt_mycnf, (uchar**) &opt_mycnf, 0,
+    &opt_mycnf, &opt_mycnf, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/test/ndbapi/testIndexStat.cpp b/storage/ndb/test/ndbapi/testIndexStat.cpp
index 559fade3132..3b3e593081b 100644
--- a/storage/ndb/test/ndbapi/testIndexStat.cpp
+++ b/storage/ndb/test/ndbapi/testIndexStat.cpp
@@ -1297,43 +1297,43 @@ my_long_options[] =
 {
   NDB_STD_OPTS("testIndexStat"),
   { "loglevel", 1001, "Logging level in this program 0-3 (default 0)",
-    (uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0,
+    &g_opts.loglevel, &g_opts.loglevel, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "seed", 1002, "Random seed (0=loop number, default -1=random)",
-    (uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0,
+    &g_opts.seed, &g_opts.seed, 0,
     GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 },
   { "loop", 1003, "Number of test loops (default 1, 0=forever)",
-    (uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0,
+    &g_opts.loop, &g_opts.loop, 0,
     GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 },
   { "rows", 1004, "Number of rows (default 100000)",
-    (uchar **)&g_opts.rows, (uchar **)&g_opts.rows, 0,
+    &g_opts.rows, &g_opts.rows, 0,
     GET_UINT, REQUIRED_ARG, 100000, 0, 0, 0, 0, 0 },
   { "ops", 1005, "Number of index scans per loop (default 1000)",
-    (uchar **)&g_opts.ops, (uchar **)&g_opts.ops, 0,
+    &g_opts.ops, &g_opts.ops, 0,
     GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 },
   { "dupkeys", 1006, "Pct records per key (min 100, default 1000)",
-    (uchar **)&g_opts.dupkeys, (uchar **)&g_opts.dupkeys, 0,
+    &g_opts.dupkeys, &g_opts.dupkeys, 0,
     GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 },
   { "scanpct", 1007, "Preferred max pct of total rows per scan (default 5)",
-    (uchar **)&g_opts.scanpct, (uchar **)&g_opts.scanpct, 0,
+    &g_opts.scanpct, &g_opts.scanpct, 0,
     GET_UINT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 },
   { "nullkeys", 1008, "Pct nulls in each key attribute (default 10)",
-    (uchar **)&g_opts.nullkeys, (uchar **)&g_opts.nullkeys, 0,
+    &g_opts.nullkeys, &g_opts.nullkeys, 0,
     GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
   { "eqscans", 1009, "Pct scans for partial/full equality (default 50)",
-    (uchar **)&g_opts.eqscans, (uchar **)&g_opts.eqscans, 0,
+    &g_opts.eqscans, &g_opts.eqscans, 0,
     GET_UINT, REQUIRED_ARG, 50, 0, 0, 0, 0, 0 },
   { "dupscans", 1010, "Pct scans using same bounds (default 10)",
-    (uchar **)&g_opts.dupscans, (uchar **)&g_opts.dupscans, 0,
+    &g_opts.dupscans, &g_opts.dupscans, 0,
     GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
   { "keeptable", 1011, "Use existing table and data if any and do not drop",
-    (uchar **)&g_opts.keeptable, (uchar **)&g_opts.keeptable, 0,
+    &g_opts.keeptable, &g_opts.keeptable, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-extra-checks", 1012, "Omit expensive consistency checks",
-    (uchar **)&g_opts.nochecks, (uchar **)&g_opts.nochecks, 0,
+    &g_opts.nochecks, &g_opts.nochecks, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "abort-on-error", 1013, "Dump core on any error",
-    (uchar **)&g_opts.abort, (uchar **)&g_opts.abort, 0,
+    &g_opts.abort, &g_opts.abort, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0,
     0, 0, 0,
diff --git a/storage/ndb/test/ndbapi/test_event_merge.cpp b/storage/ndb/test/ndbapi/test_event_merge.cpp
index d40b985adc2..c4109a23119 100644
--- a/storage/ndb/test/ndbapi/test_event_merge.cpp
+++ b/storage/ndb/test/ndbapi/test_event_merge.cpp
@@ -2184,57 +2184,57 @@ my_long_options[] =
 {
   NDB_STD_OPTS("test_event_merge"),
   { "abort-on-error", 1001, "Do abort() on any error",
-    (uchar **)&g_opts.abort_on_error, (uchar **)&g_opts.abort_on_error, 0,
+    &g_opts.abort_on_error, &g_opts.abort_on_error, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "loglevel", 1002, "Logging level in this program 0-3 (default 0)",
-    (uchar **)&g_opts.loglevel, (uchar **)&g_opts.loglevel, 0,
+    &g_opts.loglevel, &g_opts.loglevel, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "loop", 1003, "Number of test loops (default 5, 0=forever)",
-    (uchar **)&g_opts.loop, (uchar **)&g_opts.loop, 0,
+    &g_opts.loop, &g_opts.loop, 0,
     GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 },
   { "maxops", 1004, "Approx number of PK operations per table (default 1000)",
-    (uchar **)&g_opts.maxops, (uchar **)&g_opts.maxops, 0,
+    &g_opts.maxops, &g_opts.maxops, 0,
     GET_UINT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 },
   { "maxpk", 1005, "Number of different PK values (default 10, max 1000)",
-    (uchar **)&g_opts.maxpk, (uchar **)&g_opts.maxpk, 0,
+    &g_opts.maxpk, &g_opts.maxpk, 0,
     GET_UINT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
   { "maxtab", 1006, "Number of tables (default 10, max 100)",
-    (uchar **)&g_opts.maxtab, (uchar **)&g_opts.maxtab, 0,
+    &g_opts.maxtab, &g_opts.maxtab, 0,
     GET_INT, REQUIRED_ARG, 10, 0, 0, 0, 0, 0 },
   { "no-blobs", 1007, "Omit blob attributes (5.0: true)",
-    (uchar **)&g_opts.no_blobs, (uchar **)&g_opts.no_blobs, 0,
+    &g_opts.no_blobs, &g_opts.no_blobs, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-implicit-nulls", 1008, "Insert must include all attrs"
                                " i.e. no implicit NULLs",
-    (uchar **)&g_opts.no_implicit_nulls, (uchar **)&g_opts.no_implicit_nulls, 0,
+    &g_opts.no_implicit_nulls, &g_opts.no_implicit_nulls, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-missing-update", 1009, "Update must include all non-PK attrs",
-    (uchar **)&g_opts.no_missing_update, (uchar **)&g_opts.no_missing_update, 0,
+    &g_opts.no_missing_update, &g_opts.no_missing_update, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-multiops", 1010, "Allow only 1 operation per commit",
-    (uchar **)&g_opts.no_multiops, (uchar **)&g_opts.no_multiops, 0,
+    &g_opts.no_multiops, &g_opts.no_multiops, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-nulls", 1011, "Create no NULL values",
-    (uchar **)&g_opts.no_nulls, (uchar **)&g_opts.no_nulls, 0,
+    &g_opts.no_nulls, &g_opts.no_nulls, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "one-blob", 1012, "Only one blob attribute (default 2)",
-    (uchar **)&g_opts.one_blob, (uchar **)&g_opts.one_blob, 0,
+    &g_opts.one_blob, &g_opts.one_blob, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "opstring", 1013, "Operations to run e.g. idiucdc (c is commit) or"
                       " iuuc:uudc (the : separates loops)",
-    (uchar **)&g_opts.opstring, (uchar **)&g_opts.opstring, 0,
+    &g_opts.opstring, &g_opts.opstring, 0,
     GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "seed", 1014, "Random seed (0=loop number, default -1=random)",
-    (uchar **)&g_opts.seed, (uchar **)&g_opts.seed, 0,
+    &g_opts.seed, &g_opts.seed, 0,
     GET_INT, REQUIRED_ARG, -1, 0, 0, 0, 0, 0 },
   { "separate-events", 1015, "Do not combine events per GCI (5.0: true)",
-    (uchar **)&g_opts.separate_events, (uchar **)&g_opts.separate_events, 0,
+    &g_opts.separate_events, &g_opts.separate_events, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "tweak", 1016, "Whatever the source says",
-    (uchar **)&g_opts.tweak, (uchar **)&g_opts.tweak, 0,
+    &g_opts.tweak, &g_opts.tweak, 0,
     GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "use-table", 1017, "Use existing tables",
-    (uchar **)&g_opts.use_table, (uchar **)&g_opts.use_table, 0,
+    &g_opts.use_table, &g_opts.use_table, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0,
     0, 0, 0,
diff --git a/storage/ndb/test/ndbapi/test_event_multi_table.cpp b/storage/ndb/test/ndbapi/test_event_multi_table.cpp
index 36fb6f511ae..7fbd43ef5eb 100644
--- a/storage/ndb/test/ndbapi/test_event_multi_table.cpp
+++ b/storage/ndb/test/ndbapi/test_event_multi_table.cpp
@@ -258,7 +258,7 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS(""),
   { "database", 'd', "Name of database table is in",
-    (gptr*) &_dbname, (gptr*) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/test/run-test/main.cpp b/storage/ndb/test/run-test/main.cpp
index b5c4385f5d3..397eaf8b77e 100644
--- a/storage/ndb/test/run-test/main.cpp
+++ b/storage/ndb/test/run-test/main.cpp
@@ -77,60 +77,60 @@ my_bool opt_core;
 static struct my_option g_options[] =
 {
   { "help", '?', "Display this help and exit.", 
-    (uchar **) &g_help, (uchar **) &g_help,
+    &g_help, &g_help,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "version", 'V', "Output version information and exit.", 0, 0, 0, 
     GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "clusters", 256, "Cluster",
-    (uchar **) &g_clusters, (uchar **) &g_clusters,
+    &g_clusters, &g_clusters,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "replicate", 1024, "replicate",
-    (uchar **) &g_dummy, (uchar **) &g_dummy,
+    &g_dummy, &g_dummy,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "log-file", 256, "log-file",
-    (uchar **) &g_log_filename, (uchar **) &g_log_filename,
+    &g_log_filename, &g_log_filename,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "testcase-file", 'f', "testcase-file",
-    (uchar **) &g_test_case_filename, (uchar **) &g_test_case_filename,
+    &g_test_case_filename, &g_test_case_filename,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "report-file", 'r', "report-file",
-    (uchar **) &g_report_filename, (uchar **) &g_report_filename,
+    &g_report_filename, &g_report_filename,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "basedir", 256, "Base path",
-    (uchar **) &g_basedir, (uchar **) &g_basedir,
+    &g_basedir, &g_basedir,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "baseport", 256, "Base port",
-    (uchar **) &g_baseport, (uchar **) &g_baseport,
+    &g_baseport, &g_baseport,
     0, GET_INT, REQUIRED_ARG, g_baseport, 0, 0, 0, 0, 0},
   { "prefix", 256, "mysql install dir",
-    (uchar **) &g_prefix, (uchar **) &g_prefix,
+    &g_prefix, &g_prefix,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "verbose", 'v', "Verbosity",
-    (uchar **) &g_verbosity, (uchar **) &g_verbosity,
+    &g_verbosity, &g_verbosity,
     0, GET_INT, REQUIRED_ARG, g_verbosity, 0, 0, 0, 0, 0},
   { "configure", 256, "configure",
-    (uchar **) &g_do_setup, (uchar **) &g_do_setup,
+    &g_do_setup, &g_do_setup,
     0, GET_INT, REQUIRED_ARG, g_do_setup, 0, 0, 0, 0, 0 },
   { "deploy", 256, "deploy",
-    (uchar **) &g_do_deploy, (uchar **) &g_do_deploy,
+    &g_do_deploy, &g_do_deploy,
     0, GET_INT, REQUIRED_ARG, g_do_deploy, 0, 0, 0, 0, 0 },
   { "sshx", 256, "sshx",
-    (uchar **) &g_do_sshx, (uchar **) &g_do_sshx,
+    &g_do_sshx, &g_do_sshx,
     0, GET_INT, REQUIRED_ARG, g_do_sshx, 0, 0, 0, 0, 0 },
   { "start", 256, "start",
-    (uchar **) &g_do_start, (uchar **) &g_do_start,
+    &g_do_start, &g_do_start,
     0, GET_INT, REQUIRED_ARG, g_do_start, 0, 0, 0, 0, 0 },
   { "fqpn", 256, "Fully qualified path-names ",
-    (uchar **) &g_fqpn, (uchar **) &g_fqpn,
+    &g_fqpn, &g_fqpn,
     0, GET_INT, REQUIRED_ARG, g_fqpn, 0, 0, 0, 0, 0 },
   { "default-ports", 256, "Use default ports when possible",
-    (uchar **) &g_default_ports, (uchar **) &g_default_ports,
+    &g_default_ports, &g_default_ports,
     0, GET_INT, REQUIRED_ARG, g_default_ports, 0, 0, 0, 0, 0 },
   { "mode", 256, "Mode 0=interactive 1=regression 2=bench",
-    (uchar **) &g_mode, (uchar **) &g_mode,
+    &g_mode, &g_mode,
     0, GET_INT, REQUIRED_ARG, g_mode, 0, 0, 0, 0, 0 },
   { "quit", 256, "Quit before starting tests",
-    (uchar **) &g_mode, (uchar **) &g_do_quit,
+    &g_mode, &g_do_quit,
     0, GET_BOOL, NO_ARG, g_do_quit, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/test/src/NDBT_Test.cpp b/storage/ndb/test/src/NDBT_Test.cpp
index 69f3723ca75..b7b830af23d 100644
--- a/storage/ndb/test/src/NDBT_Test.cpp
+++ b/storage/ndb/test/src/NDBT_Test.cpp
@@ -1195,35 +1195,35 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS(""),
   { "print", OPT_PRINT, "Print execution tree",
-    (uchar **) &opt_print, (uchar **) &opt_print, 0,
+    &opt_print, &opt_print, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "print_html", OPT_PRINT_HTML, "Print execution tree in html table format",
-    (uchar **) &opt_print_html, (uchar **) &opt_print_html, 0,
+    &opt_print_html, &opt_print_html, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "print_cases", OPT_PRINT_CASES, "Print list of test cases",
-    (uchar **) &opt_print_cases, (uchar **) &opt_print_cases, 0,
+    &opt_print_cases, &opt_print_cases, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "records", 'r', "Number of records", 
-    (uchar **) &opt_records, (uchar **) &opt_records, 0,
+    &opt_records, &opt_records, 0,
     GET_INT, REQUIRED_ARG, 1000, 0, 0, 0, 0, 0 },
   { "loops", 'l', "Number of loops",
-    (uchar **) &opt_loops, (uchar **) &opt_loops, 0,
+    &opt_loops, &opt_loops, 0,
     GET_INT, REQUIRED_ARG, 5, 0, 0, 0, 0, 0 },
   { "seed", 1024, "Random seed",
-    (uchar **) &opt_seed, (uchar **) &opt_seed, 0,
+    &opt_seed, &opt_seed, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "testname", 'n', "Name of test to run",
-    (uchar **) &opt_testname, (uchar **) &opt_testname, 0,
+    &opt_testname, &opt_testname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "remote_mgm", 'm',
     "host:port to mgmsrv of remote cluster",
-    (uchar **) &opt_remote_mgm, (uchar **) &opt_remote_mgm, 0,
+    &opt_remote_mgm, &opt_remote_mgm, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "timer", 't', "Print execution time",
-    (uchar **) &opt_timer, (uchar **) &opt_timer, 0,
+    &opt_timer, &opt_timer, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "verbose", 'v', "Print verbose status",
-    (uchar **) &opt_verbose, (uchar **) &opt_verbose, 0,
+    &opt_verbose, &opt_verbose, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/test/tools/connect.cpp b/storage/ndb/test/tools/connect.cpp
index 278dbe833ea..d12d1b7a608 100644
--- a/storage/ndb/test/tools/connect.cpp
+++ b/storage/ndb/test/tools/connect.cpp
@@ -31,14 +31,14 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "loop", 'l', "loops",
-    (gptr*) &_loop, (gptr*) &_loop, 0,
+     &_loop,  &_loop, 0,
     GET_INT, REQUIRED_ARG, _loop, 0, 0, 0, 0, 0 }, 
   { "sleep", 's', "Sleep (ms) between connection attempt",
-    (gptr*) &_sleep, (gptr*) &_sleep, 0,
+     &_sleep,  &_sleep, 0,
     GET_INT, REQUIRED_ARG, _sleep, 0, 0, 0, 0, 0 }, 
   { "drop", 'd', 
     "Drop event operations before disconnect (0 = no, 1 = yes, else rand",
-    (gptr*) &_drop, (gptr*) &_drop, 0,
+     &_drop,  &_drop, 0,
     GET_INT, REQUIRED_ARG, _drop, 0, 0, 0, 0, 0 }, 
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/delete_all.cpp b/storage/ndb/tools/delete_all.cpp
index 1bf89f5a32f..23d1ef387d2 100644
--- a/storage/ndb/tools/delete_all.cpp
+++ b/storage/ndb/tools/delete_all.cpp
@@ -36,16 +36,16 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "database", 'd', "Name of database table is in",
-    (uchar**) &_dbname, (uchar**) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "transactional", 't', "Single transaction (may run out of operations)",
-    (uchar**) &_transactional, (uchar**) &_transactional, 0,
+    &_transactional, &_transactional, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "tupscan", 999, "Run tupscan",
-    (uchar**) &_tupscan, (uchar**) &_tupscan, 0,
+    &_tupscan, &_tupscan, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "diskscan", 999, "Run diskcan",
-    (uchar**) &_diskscan, (uchar**) &_diskscan, 0,
+    &_diskscan, &_diskscan, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/desc.cpp b/storage/ndb/tools/desc.cpp
index 831005139de..f31b4f6ae1b 100644
--- a/storage/ndb/tools/desc.cpp
+++ b/storage/ndb/tools/desc.cpp
@@ -39,16 +39,16 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "database", 'd', "Name of database table is in",
-    (uchar**) &_dbname, (uchar**) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "unqualified", 'u', "Use unqualified table names",
-    (uchar**) &_unqualified, (uchar**) &_unqualified, 0,
+    &_unqualified, &_unqualified, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "extra-partition-info", 'p', "Print more info per partition",
-    (uchar**) &_partinfo, (uchar**) &_partinfo, 0,
+    &_partinfo, &_partinfo, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "retries", 'r', "Retry every second for # retries",
-    (uchar**) &_retries, (uchar**) &_retries, 0,
+    &_retries, &_retries, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/drop_index.cpp b/storage/ndb/tools/drop_index.cpp
index ec88f331a80..82dd595f7df 100644
--- a/storage/ndb/tools/drop_index.cpp
+++ b/storage/ndb/tools/drop_index.cpp
@@ -30,7 +30,7 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "database", 'd', "Name of database table is in",
-    (uchar**) &_dbname, (uchar**) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/drop_tab.cpp b/storage/ndb/tools/drop_tab.cpp
index 8d07afbbf50..1fba31b5c8a 100644
--- a/storage/ndb/tools/drop_tab.cpp
+++ b/storage/ndb/tools/drop_tab.cpp
@@ -30,7 +30,7 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "database", 'd', "Name of database table is in",
-    (uchar**) &_dbname, (uchar**) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/listTables.cpp b/storage/ndb/tools/listTables.cpp
index 45129cb34af..bd70587f77e 100644
--- a/storage/ndb/tools/listTables.cpp
+++ b/storage/ndb/tools/listTables.cpp
@@ -256,22 +256,22 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_show_tables"),
   { "database", 'd', "Name of database table is in",
-    (uchar**) &_dbname, (uchar**) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "loops", 'l', "loops",
-    (uchar**) &_loops, (uchar**) &_loops, 0,
+    &_loops, &_loops, 0,
     GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 }, 
   { "type", 't', "type",
-    (uchar**) &_type, (uchar**) &_type, 0,
+    &_type, &_type, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "unqualified", 'u', "Use unqualified table names",
-    (uchar**) &_unqualified, (uchar**) &_unqualified, 0,
+    &_unqualified, &_unqualified, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE",
-    (uchar**) &_parsable, (uchar**) &_parsable, 0,
+    &_parsable, &_parsable, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "show-temp-status", OPT_SHOW_TMP_STATUS, "Show table temporary flag",
-    (uchar**) &show_temp_status, (uchar**) &show_temp_status, 0,
+    &show_temp_status, &show_temp_status, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/ndb_config.cpp b/storage/ndb/tools/ndb_config.cpp
index af36103f947..0df88dc0167 100644
--- a/storage/ndb/tools/ndb_config.cpp
+++ b/storage/ndb/tools/ndb_config.cpp
@@ -58,37 +58,37 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_config"),
   { "nodes", 256, "Print nodes",
-    (uchar**) &g_nodes, (uchar**) &g_nodes,
+    &g_nodes, &g_nodes,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   { "connections", 256, "Print connections",
-    (uchar**) &g_connections, (uchar**) &g_connections,
+    &g_connections, &g_connections,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   { "query", 'q', "Query option(s)",
-    (uchar**) &g_query, (uchar**) &g_query,
+    &g_query, &g_query,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "host", 256, "Host",
-    (uchar**) &g_host, (uchar**) &g_host,
+    &g_host, &g_host,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "type", 258, "Type of node/connection",
-    (uchar**) &g_type, (uchar**) &g_type,
+    &g_type, &g_type,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "id", 258, "Nodeid",
-    (uchar**) &g_nodeid, (uchar**) &g_nodeid,
+    &g_nodeid, &g_nodeid,
     0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "nodeid", 258, "Nodeid",
-    (uchar**) &g_nodeid, (uchar**) &g_nodeid,
+    &g_nodeid, &g_nodeid,
     0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "fields", 'f', "Field separator",
-    (uchar**) &g_field_delimiter, (uchar**) &g_field_delimiter,
+    &g_field_delimiter, &g_field_delimiter,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "rows", 'r', "Row separator",
-    (uchar**) &g_row_delimiter, (uchar**) &g_row_delimiter,
+    &g_row_delimiter, &g_row_delimiter,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "config-file", 256, "Path to config.ini",
-    (uchar**) &g_config_file, (uchar**) &g_config_file,
+    &g_config_file, &g_config_file,
     0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "mycnf", 256, "Read config from my.cnf",
-    (uchar**) &g_mycnf, (uchar**) &g_mycnf,
+    &g_mycnf, &g_mycnf,
     0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/restore/restore_main.cpp b/storage/ndb/tools/restore/restore_main.cpp
index 7db77524ad8..966c539cee9 100644
--- a/storage/ndb/tools/restore/restore_main.cpp
+++ b/storage/ndb/tools/restore/restore_main.cpp
@@ -100,99 +100,99 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_restore"),
   { "connect", 'c', "same as --connect-string",
-    (uchar**) &opt_connect_str, (uchar**) &opt_connect_str, 0,
+    &opt_connect_str, &opt_connect_str, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "nodeid", 'n', "Backup files from node with id",
-    (uchar**) &ga_nodeId, (uchar**) &ga_nodeId, 0,
+    &ga_nodeId, &ga_nodeId, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "backupid", 'b', "Backup id",
-    (uchar**) &ga_backupId, (uchar**) &ga_backupId, 0,
+    &ga_backupId, &ga_backupId, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "restore_data", 'r', 
     "Restore table data/logs into NDB Cluster using NDBAPI", 
-    (uchar**) &_restore_data, (uchar**) &_restore_data,  0,
+    &_restore_data, &_restore_data,  0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "restore_meta", 'm',
     "Restore meta data into NDB Cluster using NDBAPI",
-    (uchar**) &_restore_meta, (uchar**) &_restore_meta,  0,
+    &_restore_meta, &_restore_meta,  0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-upgrade", 'u',
     "Don't upgrade array type for var attributes, which don't resize VAR data and don't change column attributes",
-    (uchar**) &ga_no_upgrade, (uchar**) &ga_no_upgrade, 0,
+    &ga_no_upgrade, &ga_no_upgrade, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "no-restore-disk-objects", 'd',
     "Dont restore disk objects (tablespace/logfilegroups etc)",
-    (uchar**) &_no_restore_disk, (uchar**) &_no_restore_disk,  0,
+    &_no_restore_disk, &_no_restore_disk,  0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "restore_epoch", 'e', 
     "Restore epoch info into the status table. Convenient on a MySQL Cluster "
     "replication slave, for starting replication. The row in "
     NDB_REP_DB "." NDB_APPLY_TABLE " with id 0 will be updated/inserted.", 
-    (uchar**) &ga_restore_epoch, (uchar**) &ga_restore_epoch,  0,
+    &ga_restore_epoch, &ga_restore_epoch,  0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "skip-table-check", 's', "Skip table structure check during restore of data",
-   (uchar**) &ga_skip_table_check, (uchar**) &ga_skip_table_check, 0,
+   &ga_skip_table_check, &ga_skip_table_check, 0,
    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "parallelism", 'p',
     "No of parallel transactions during restore of data."
     "(parallelism can be 1 to 1024)", 
-    (uchar**) &ga_nParallelism, (uchar**) &ga_nParallelism, 0,
+    &ga_nParallelism, &ga_nParallelism, 0,
     GET_INT, REQUIRED_ARG, 128, 1, 1024, 0, 1, 0 },
   { "print", OPT_PRINT, "Print metadata, data and log to stdout",
-    (uchar**) &_print, (uchar**) &_print, 0,
+    &_print, &_print, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "print_data", OPT_PRINT_DATA, "Print data to stdout", 
-    (uchar**) &_print_data, (uchar**) &_print_data, 0,
+    &_print_data, &_print_data, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "print_meta", OPT_PRINT_META, "Print meta data to stdout",
-    (uchar**) &_print_meta, (uchar**) &_print_meta,  0,
+    &_print_meta, &_print_meta,  0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "print_log", OPT_PRINT_LOG, "Print log to stdout",
-    (uchar**) &_print_log, (uchar**) &_print_log,  0,
+    &_print_log, &_print_log,  0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "backup_path", OPT_BACKUP_PATH, "Path to backup files",
-    (uchar**) &ga_backupPath, (uchar**) &ga_backupPath, 0,
+    &ga_backupPath, &ga_backupPath, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "dont_ignore_systab_0", 'f',
     "Experimental. Do not ignore system table during restore.", 
-    (uchar**) &ga_dont_ignore_systab_0, (uchar**) &ga_dont_ignore_systab_0, 0,
+    &ga_dont_ignore_systab_0, &ga_dont_ignore_systab_0, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "ndb-nodegroup-map", OPT_NDB_NODEGROUP_MAP,
     "Nodegroup map for ndbcluster. Syntax: list of (source_ng, dest_ng)",
-    (uchar**) &opt_nodegroup_map_str,
-    (uchar**) &opt_nodegroup_map_str,
+    &opt_nodegroup_map_str,
+    &opt_nodegroup_map_str,
     0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "fields-enclosed-by", OPT_FIELDS_ENCLOSED_BY,
     "Fields are enclosed by ...",
-    (uchar**) &opt_fields_enclosed_by, (uchar**) &opt_fields_enclosed_by, 0,
+    &opt_fields_enclosed_by, &opt_fields_enclosed_by, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "fields-terminated-by", OPT_FIELDS_TERMINATED_BY,
     "Fields are terminated by ...",
-    (uchar**) &opt_fields_terminated_by,
-    (uchar**) &opt_fields_terminated_by, 0,
+    &opt_fields_terminated_by,
+    &opt_fields_terminated_by, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "fields-optionally-enclosed-by", OPT_FIELDS_OPTIONALLY_ENCLOSED_BY,
     "Fields are optionally enclosed by ...",
-    (uchar**) &opt_fields_optionally_enclosed_by,
-    (uchar**) &opt_fields_optionally_enclosed_by, 0,
+    &opt_fields_optionally_enclosed_by,
+    &opt_fields_optionally_enclosed_by, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "hex", OPT_HEX_FORMAT, "print binary types in hex format", 
-    (uchar**) &opt_hex_format, (uchar**) &opt_hex_format, 0,
+    &opt_hex_format, &opt_hex_format, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "tab", 'T', "Creates tab separated textfile for each table to "
     "given path. (creates .txt files)",
-   (uchar**) &tab_path, (uchar**) &tab_path, 0,
+   &tab_path, &tab_path, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   { "append", OPT_APPEND, "for --tab append data to file", 
-    (uchar**) &opt_append, (uchar**) &opt_append, 0,
+    &opt_append, &opt_append, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
   { "lines-terminated-by", OPT_LINES_TERMINATED_BY, "",
-    (uchar**) &opt_lines_terminated_by, (uchar**) &opt_lines_terminated_by, 0,
+    &opt_lines_terminated_by, &opt_lines_terminated_by, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "verbose", OPT_VERBOSE,
     "verbosity", 
-    (uchar**) &opt_verbose, (uchar**) &opt_verbose, 0,
+    &opt_verbose, &opt_verbose, 0,
     GET_INT, REQUIRED_ARG, 1, 0, 255, 0, 0, 0 },
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/select_all.cpp b/storage/ndb/tools/select_all.cpp
index 23d5f95f3f7..95dfeab9eed 100644
--- a/storage/ndb/tools/select_all.cpp
+++ b/storage/ndb/tools/select_all.cpp
@@ -54,43 +54,43 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "database", 'd', "Name of database table is in",
-    (uchar**) &_dbname, (uchar**) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "parallelism", 'p', "parallelism",
-    (uchar**) &_parallelism, (uchar**) &_parallelism, 0,
+    &_parallelism, &_parallelism, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
-    (uchar**) &_lock, (uchar**) &_lock, 0,
+    &_lock, &_lock, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "order", 'o', "Sort resultset according to index",
-    (uchar**) &_order, (uchar**) &_order, 0,
+    &_order, &_order, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "descending", 'z', "Sort descending (requires order flag)",
-    (uchar**) &_descending, (uchar**) &_descending, 0,
+    &_descending, &_descending, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "header", 'h', "Print header",
-    (uchar**) &_header, (uchar**) &_header, 0,
+    &_header, &_header, 0,
     GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, 
   { "useHexFormat", 'x', "Output numbers in hexadecimal format",
-    (uchar**) &_useHexFormat, (uchar**) &_useHexFormat, 0,
+    &_useHexFormat, &_useHexFormat, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "delimiter", 'D', "Column delimiter",
-    (uchar**) &_delimiter, (uchar**) &_delimiter, 0,
+    &_delimiter, &_delimiter, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "disk", 256, "Dump disk ref",
-    (uchar**) &_dumpDisk, (uchar**) &_dumpDisk, 0,
+    &_dumpDisk, &_dumpDisk, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "rowid", 256, "Dump rowid",
-    (uchar**) &use_rowid, (uchar**) &use_rowid, 0,
+    &use_rowid, &use_rowid, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "gci", 256, "Dump gci",
-    (uchar**) &use_gci, (uchar**) &use_gci, 0,
+    &use_gci, &use_gci, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "tupscan", 't', "Scan in tup order",
-    (uchar**) &_tup, (uchar**) &_tup, 0,
+    &_tup, &_tup, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "nodata", 256, "Dont print data",
-    (uchar**) &nodata, (uchar**) &nodata, 0,
+    &nodata, &nodata, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/select_count.cpp b/storage/ndb/tools/select_count.cpp
index 73982e886b5..6bdc682c16a 100644
--- a/storage/ndb/tools/select_count.cpp
+++ b/storage/ndb/tools/select_count.cpp
@@ -43,13 +43,13 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "database", 'd', "Name of database table is in",
-    (uchar**) &_dbname, (uchar**) &_dbname, 0,
+    &_dbname, &_dbname, 0,
     GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
   { "parallelism", 'p', "parallelism",
-    (uchar**) &_parallelism, (uchar**) &_parallelism, 0,
+    &_parallelism, &_parallelism, 0,
     GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 }, 
   { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)",
-    (uchar**) &_lock, (uchar**) &_lock, 0,
+    &_lock, &_lock, 0,
     GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, 
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/storage/ndb/tools/waiter.cpp b/storage/ndb/tools/waiter.cpp
index fc2a4b368b1..26c86e6d196 100644
--- a/storage/ndb/tools/waiter.cpp
+++ b/storage/ndb/tools/waiter.cpp
@@ -44,17 +44,17 @@ static struct my_option my_long_options[] =
 {
   NDB_STD_OPTS("ndb_desc"),
   { "no-contact", 'n', "Wait for cluster no contact",
-    (uchar**) &_no_contact, (uchar**) &_no_contact, 0,
+    &_no_contact, &_no_contact, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
-    (uchar**) &_not_started, (uchar**) &_not_started, 0,
+    &_not_started, &_not_started, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "single-user", OPT_WAIT_STATUS_SINGLE_USER,
     "Wait for cluster to enter single user mode",
-    (uchar**) &_single_user, (uchar**) &_single_user, 0,
+    &_single_user, &_single_user, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "timeout", 't', "Timeout to wait in seconds",
-    (uchar**) &_timeout, (uchar**) &_timeout, 0,
+    &_timeout, &_timeout, 0,
     GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 }, 
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
diff --git a/tests/thread_test.c b/tests/thread_test.c
index 1a3dd60c1fd..c243a3a7321 100644
--- a/tests/thread_test.c
+++ b/tests/thread_test.c
@@ -88,36 +88,36 @@ static struct my_option my_long_options[] =
 {
   {"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
    0, 0, 0, 0, 0},
-  {"database", 'D', "Database to use", (uchar**) &database, (uchar**) &database,
+  {"database", 'D', "Database to use", &database, &database,
    0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"host", 'h', "Connect to host", (uchar**) &host, (uchar**) &host, 0, GET_STR,
+  {"host", 'h', "Connect to host", &host, &host, 0, GET_STR,
    REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"password", 'p',
    "Password to use when connecting to server. If password is not given it's asked from the tty.",
    0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-  {"user", 'u', "User for login if not current user", (uchar**) &user,
-   (uchar**) &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"user", 'u', "User for login if not current user", &user,
+   &user, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"version", 'V', "Output version information and exit",
    0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"verbose", 'v', "Write some progress indicators", (uchar**) &verbose,
-   (uchar**) &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
-  {"query", 'Q', "Query to execute in each threads", (uchar**) &query,
-   (uchar**) &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+  {"verbose", 'v', "Write some progress indicators", &verbose,
+   &verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
+  {"query", 'Q', "Query to execute in each threads", &query,
+   &query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"port", 'P', "Port number to use for connection or 0 for default to, in "
    "order of preference, my.cnf, $MYSQL_TCP_PORT, "
 #if MYSQL_PORT_DEFAULT == 0
    "/etc/services, "
 #endif
    "built-in default (" STRINGIFY_ARG(MYSQL_PORT) ").",
-   (uchar**) &tcp_port,
-   (uchar**) &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
-  {"socket", 'S', "Socket file to use for connection", (uchar**) &unix_socket,
-   (uchar**) &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+   &tcp_port,
+   &tcp_port, 0, GET_UINT, REQUIRED_ARG, MYSQL_PORT, 0, 0, 0, 0, 0},
+  {"socket", 'S', "Socket file to use for connection", &unix_socket,
+   &unix_socket, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
   {"test-count", 'c', "Run test count times (default %d)",
-   (uchar**) &number_of_tests, (uchar**) &number_of_tests, 0, GET_UINT,
+   &number_of_tests, &number_of_tests, 0, GET_UINT,
    REQUIRED_ARG, 1000, 0, 0, 0, 0, 0},
   {"thread-count", 't', "Number of threads to start",
-   (uchar**) &number_of_threads, (uchar**) &number_of_threads, 0, GET_UINT,
+   &number_of_threads, &number_of_threads, 0, GET_UINT,
    REQUIRED_ARG, 2, 0, 0, 0, 0, 0},
   { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
 };
-- 
2.30.9