WL#2936 - Falcon & MySQL plugin interface: server variables

Avoid compiler warnings
parent 1bd2953c
...@@ -139,8 +139,7 @@ static int ksrflow; ...@@ -139,8 +139,7 @@ static int ksrflow;
/* Dummy call to force a backgrounded readline to stop before it tries /* Dummy call to force a backgrounded readline to stop before it tries
to get the tty settings. */ to get the tty settings. */
static void static void
set_winsize (tty) set_winsize (int tty __attribute__((unused)))
int tty;
{ {
#if defined (TIOCGWINSZ) #if defined (TIOCGWINSZ)
struct winsize w; struct winsize w;
......
...@@ -479,7 +479,7 @@ AC_MSG_CHECKING(if conversion of longlong to float works) ...@@ -479,7 +479,7 @@ AC_MSG_CHECKING(if conversion of longlong to float works)
AC_CACHE_VAL(ac_cv_conv_longlong_to_float, AC_CACHE_VAL(ac_cv_conv_longlong_to_float,
[AC_TRY_RUN([#include <stdio.h> [AC_TRY_RUN([#include <stdio.h>
typedef long long longlong; typedef long long longlong;
main() int main()
{ {
longlong ll=1; longlong ll=1;
float f; float f;
...@@ -487,7 +487,7 @@ main() ...@@ -487,7 +487,7 @@ main()
f = (float) ll; f = (float) ll;
fprintf(file,"%g\n",f); fprintf(file,"%g\n",f);
fclose(file); fclose(file);
exit (0); return (0);
}], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl }], ac_cv_conv_longlong_to_float=`cat conftestval`, ac_cv_conv_longlong_to_float=0, ifelse([$2], , , ac_cv_conv_longlong_to_float=$2))])dnl
if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes" if test "$ac_cv_conv_longlong_to_float" = "1" -o "$ac_cv_conv_longlong_to_float" = "yes"
then then
......
...@@ -842,19 +842,23 @@ static void init_one_value(const struct my_option *option, gptr *variable, ...@@ -842,19 +842,23 @@ static void init_one_value(const struct my_option *option, gptr *variable,
/* /*
Do not clear variable value if it has no default value. Do not clear variable value if it has no default value.
The default value may already be set. The default value may already be set.
NOTE: To avoid compiler warnings, we first cast longlong to intptr,
so that the value has the same size as a pointer.
*/ */
if ((char*) value) if ((char*) (intptr) value)
*((char**) variable)= (char*) value; *((char**) variable)= (char*) (intptr) value;
break; break;
case GET_STR_ALLOC: case GET_STR_ALLOC:
/* /*
Do not clear variable value if it has no default value. Do not clear variable value if it has no default value.
The default value may already be set. The default value may already be set.
NOTE: To avoid compiler warnings, we first cast longlong to intptr,
so that the value has the same size as a pointer.
*/ */
if ((char*) value) if ((char*) (intptr) value)
{ {
my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR)); my_free((*(char**) variable), MYF(MY_ALLOW_ZERO_PTR));
*((char**) variable)= my_strdup((char*) value, MYF(MY_WME)); *((char**) variable)= my_strdup((char*) (intptr) value, MYF(MY_WME));
} }
break; break;
default: /* dummy default to avoid compiler warnings */ default: /* dummy default to avoid compiler warnings */
......
...@@ -677,7 +677,6 @@ pthread_handler_t signal_hand(void *arg); ...@@ -677,7 +677,6 @@ pthread_handler_t signal_hand(void *arg);
static void mysql_init_variables(void); static void mysql_init_variables(void);
static void get_options(int *argc,char **argv); static void get_options(int *argc,char **argv);
static my_bool get_one_option(int, const struct my_option *, char *); static my_bool get_one_option(int, const struct my_option *, char *);
static void usage(void);
static void set_server_version(void); static void set_server_version(void);
static int init_thread_environment(); static int init_thread_environment();
static char *get_relative_path(const char *path); static char *get_relative_path(const char *path);
...@@ -700,6 +699,7 @@ static void clean_up(bool print_message); ...@@ -700,6 +699,7 @@ static void clean_up(bool print_message);
static int test_if_case_insensitive(const char *dir_name); static int test_if_case_insensitive(const char *dir_name);
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
static void usage(void);
static void start_signal_handler(void); static void start_signal_handler(void);
static void close_server_sock(); static void close_server_sock();
static void clean_up_mutexes(void); static void clean_up_mutexes(void);
...@@ -6877,6 +6877,7 @@ static void print_version(void) ...@@ -6877,6 +6877,7 @@ static void print_version(void)
server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT); server_version,SYSTEM_TYPE,MACHINE_TYPE, MYSQL_COMPILATION_COMMENT);
} }
#ifndef EMBEDDED_LIBRARY
static void usage(void) static void usage(void)
{ {
if (!(default_charset_info= get_charset_by_csname(default_character_set_name, if (!(default_charset_info= get_charset_by_csname(default_character_set_name,
...@@ -6922,6 +6923,7 @@ To see what values a running MySQL server is using, type\n\ ...@@ -6922,6 +6923,7 @@ To see what values a running MySQL server is using, type\n\
'mysqladmin variables' instead of 'mysqld --verbose --help'.\n"); 'mysqladmin variables' instead of 'mysqld --verbose --help'.\n");
} }
} }
#endif /*!EMBEDDED_LIBRARY*/
/* /*
......
...@@ -43,37 +43,37 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables); ...@@ -43,37 +43,37 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables);
const char *any_db="*any*"; // Special symbol for check_access const char *any_db="*any*"; // Special symbol for check_access
const LEX_STRING command_name[]={ const LEX_STRING command_name[]={
{ STRING_WITH_LEN("Sleep") }, { C_STRING_WITH_LEN("Sleep") },
{ STRING_WITH_LEN("Quit") }, { C_STRING_WITH_LEN("Quit") },
{ STRING_WITH_LEN("Init DB") }, { C_STRING_WITH_LEN("Init DB") },
{ STRING_WITH_LEN("Query") }, { C_STRING_WITH_LEN("Query") },
{ STRING_WITH_LEN("Field List") }, { C_STRING_WITH_LEN("Field List") },
{ STRING_WITH_LEN("Create DB") }, { C_STRING_WITH_LEN("Create DB") },
{ STRING_WITH_LEN("Drop DB") }, { C_STRING_WITH_LEN("Drop DB") },
{ STRING_WITH_LEN("Refresh") }, { C_STRING_WITH_LEN("Refresh") },
{ STRING_WITH_LEN("Shutdown") }, { C_STRING_WITH_LEN("Shutdown") },
{ STRING_WITH_LEN("Statistics") }, { C_STRING_WITH_LEN("Statistics") },
{ STRING_WITH_LEN("Processlist") }, { C_STRING_WITH_LEN("Processlist") },
{ STRING_WITH_LEN("Connect") }, { C_STRING_WITH_LEN("Connect") },
{ STRING_WITH_LEN("Kill") }, { C_STRING_WITH_LEN("Kill") },
{ STRING_WITH_LEN("Debug") }, { C_STRING_WITH_LEN("Debug") },
{ STRING_WITH_LEN("Ping") }, { C_STRING_WITH_LEN("Ping") },
{ STRING_WITH_LEN("Time") }, { C_STRING_WITH_LEN("Time") },
{ STRING_WITH_LEN("Delayed insert") }, { C_STRING_WITH_LEN("Delayed insert") },
{ STRING_WITH_LEN("Change user") }, { C_STRING_WITH_LEN("Change user") },
{ STRING_WITH_LEN("Binlog Dump") }, { C_STRING_WITH_LEN("Binlog Dump") },
{ STRING_WITH_LEN("Table Dump") }, { C_STRING_WITH_LEN("Table Dump") },
{ STRING_WITH_LEN("Connect Out") }, { C_STRING_WITH_LEN("Connect Out") },
{ STRING_WITH_LEN("Register Slave") }, { C_STRING_WITH_LEN("Register Slave") },
{ STRING_WITH_LEN("Prepare") }, { C_STRING_WITH_LEN("Prepare") },
{ STRING_WITH_LEN("Execute") }, { C_STRING_WITH_LEN("Execute") },
{ STRING_WITH_LEN("Long Data") }, { C_STRING_WITH_LEN("Long Data") },
{ STRING_WITH_LEN("Close stmt") }, { C_STRING_WITH_LEN("Close stmt") },
{ STRING_WITH_LEN("Reset stmt") }, { C_STRING_WITH_LEN("Reset stmt") },
{ STRING_WITH_LEN("Set option") }, { C_STRING_WITH_LEN("Set option") },
{ STRING_WITH_LEN("Fetch") }, { C_STRING_WITH_LEN("Fetch") },
{ STRING_WITH_LEN("Daemon") }, { C_STRING_WITH_LEN("Daemon") },
{ STRING_WITH_LEN("Error") } // Last command number { C_STRING_WITH_LEN("Error") } // Last command number
}; };
const char *xa_state_names[]={ const char *xa_state_names[]={
......
...@@ -2506,10 +2506,9 @@ byte* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type, ...@@ -2506,10 +2506,9 @@ byte* sys_var_pluginvar::value_ptr(THD *thd, enum_var_type type,
result= real_value_ptr(thd, type); result= real_value_ptr(thd, type);
if ((plugin_var->flags && PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_ENUM) if ((plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_ENUM)
result= (byte*) get_type(plugin_var_typelib(), *(ulong*)result); result= (byte*) get_type(plugin_var_typelib(), *(ulong*)result);
else else if ((plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_SET)
if ((plugin_var->flags && PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_SET)
{ {
char buffer[STRING_BUFFER_USUAL_SIZE]; char buffer[STRING_BUFFER_USUAL_SIZE];
String str(buffer, sizeof(buffer), system_charset_info); String str(buffer, sizeof(buffer), system_charset_info);
...@@ -2620,7 +2619,7 @@ bool sys_var_pluginvar::update(THD *thd, set_var *var) ...@@ -2620,7 +2619,7 @@ bool sys_var_pluginvar::update(THD *thd, set_var *var)
options->def_value= (opt)->def_val; \ options->def_value= (opt)->def_val; \
options->min_value= (opt)->min_val; \ options->min_value= (opt)->min_val; \
options->max_value= (opt)->max_val; \ options->max_value= (opt)->max_val; \
options->block_size= (opt)->blk_sz options->block_size= (long) (opt)->blk_sz
static void plugin_opt_set_limits(struct my_option *options, static void plugin_opt_set_limits(struct my_option *options,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment