#At file:///Users/kgeorge/mysql/work/wl1054-next-mr/ based on revid:georgi.kodinov@stripped
2965 Georgi Kodinov 2010-06-29
WL#1054 : Implemented first round of code review remarks from Mats
1. Removed example code from mysql.cc
2. Changed a (oid *) cast into a more concrete one
3. Changed a macro name to upper case to comply with coding standards
modified:
client/mysql.cc
sql-common/client.c
=== modified file 'client/mysql.cc'
--- a/client/mysql.cc 2010-06-18 14:13:45 +0000
+++ b/client/mysql.cc 2010-06-29 08:44:11 +0000
@@ -4299,54 +4299,6 @@ char *get_arg(char *line, my_bool get_ne
return valid_arg ? start : NullS;
}
-/**
- An example of mysql_authentication_dialog_ask callback.
-
- The C function with the name "mysql_authentication_dialog_ask", if exists,
- will be used by the "dialog" client authentication plugin when user
- input is needed. This function should be of mysql_authentication_dialog_ask_t
- type. If the function does not exists, a built-in implementation will be
- used.
-
- @param mysql mysql
- @param type type of the input
- 1 - normal string input
- 2 - password string
- @param prompt prompt
- @param buf a buffer to store the use input
- @param buf_len the length of the buffer
-
- @retval a pointer to the user input string.
- It may be equal to 'buf' or to 'mysql->password'.
- In all other cases it is assumed to be an allocated
- string, and the "dialog" plugin will free() it.
-*/
-extern "C" char *mysql_authentication_dialog_ask(MYSQL *mysql, int type,
- const char *prompt,
- char *buf, int buf_len)
-{
- char *s=buf;
-
- fputs("[mysql] ", stdout);
- fputs(prompt, stdout);
- fputs(" ", stdout);
-
- if (type == 2) /* password */
- {
- s= get_tty_password("");
- strnmov(buf, s, buf_len);
- buf[buf_len-1]= 0;
- my_free(s, MYF(0));
- }
- else
- {
- fgets(buf, buf_len-1, stdin);
- if (buf[0] && (s= strend(buf))[-1] == '\n')
- s[-1]= 0;
- }
-
- return buf;
-}
static int
sql_real_connect(char *host,char *database,char *user,char *password,
=== modified file 'sql-common/client.c'
--- a/sql-common/client.c 2010-06-04 13:50:29 +0000
+++ b/sql-common/client.c 2010-06-29 08:44:11 +0000
@@ -1195,7 +1195,7 @@ static int add_init_command(struct st_my
return 0;
}
-#define extension_set_string(OPTS, X, STR) \
+#define EXTENSION_SET_STRING(OPTS, X, STR) \
if ((OPTS)->extension) \
my_free((OPTS)->extension->X, MYF(MY_ALLOW_ZERO_PTR)); \
else \
@@ -1381,10 +1381,10 @@ void mysql_read_default_options(struct s
options->report_data_truncation= opt_arg ? test(atoi(opt_arg)) : 1;
break;
case OPT_plugin_dir:
- extension_set_string(options, plugin_dir, opt_arg);
+ EXTENSION_SET_STRING(options, plugin_dir, opt_arg);
break;
case OPT_default_auth:
- extension_set_string(options, default_auth, opt_arg);
+ EXTENSION_SET_STRING(options, default_auth, opt_arg);
break;
default:
DBUG_PRINT("warning",("unknown option: %s",option[0]));
@@ -2500,7 +2500,7 @@ static int send_client_reply_packet(MCPV
set_mysql_error(mysql, CR_SSL_CONNECTION_ERROR, unknown_sqlstate);
goto error;
}
- mysql->connector_fd= (void*)ssl_fd;
+ mysql->connector_fd= (unsigned char *) ssl_fd;
/* Connect to the server */
DBUG_PRINT("info", ("IO layer change in progress..."));
@@ -4064,10 +4064,10 @@ mysql_options(MYSQL *mysql,enum mysql_op
mysql->options.client_flag&= ~CLIENT_SSL_VERIFY_SERVER_CERT;
break;
case MYSQL_PLUGIN_DIR:
- extension_set_string(&mysql->options, plugin_dir, arg);
+ EXTENSION_SET_STRING(&mysql->options, plugin_dir, arg);
break;
case MYSQL_DEFAULT_AUTH:
- extension_set_string(&mysql->options, default_auth, arg);
+ EXTENSION_SET_STRING(&mysql->options, default_auth, arg);
break;
default:
DBUG_RETURN(1);
Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100629084411-x206dy747ajfbrpp.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr-wl1054 branch (Georgi.Kodinov:2965) WL#1054 | Georgi Kodinov | 29 Jun |