summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2021-06-06 13:21:03 +0200
committerVladislav Vaintroub <wlad@mariadb.com>2021-06-06 13:21:03 +0200
commit3d6eb7afcfb47cb432f790d0b25c8c1f4ec5bcf3 (patch)
tree0915add6039e740b9ab08baf215e435480c44526 /client
parent06dd151bb86ad5b87d4d46011f36da1289c01074 (diff)
downloadmariadb-git-3d6eb7afcfb47cb432f790d0b25c8c1f4ec5bcf3.tar.gz
MDEV-25602 get rid of __WIN__ in favor of standard _WIN32
This fixed the MySQL bug# 20338 about misuse of double underscore prefix __WIN__, which was old MySQL's idea of identifying Windows Replace it by _WIN32 standard symbol for targeting Windows OS (both 32 and 64 bit) Not that connect storage engine is not fixed in this patch (must be fixed in "upstream" branch)
Diffstat (limited to 'client')
-rw-r--r--client/async_example.c4
-rw-r--r--client/client_priv.h2
-rw-r--r--client/mysql.cc14
-rw-r--r--client/mysql_plugin.c8
-rw-r--r--client/mysql_upgrade.c8
-rw-r--r--client/mysqladmin.cc6
-rw-r--r--client/mysqlbinlog.cc2
-rw-r--r--client/mysqlcheck.c4
-rw-r--r--client/mysqldump.c4
-rw-r--r--client/mysqlimport.c4
-rw-r--r--client/mysqlshow.c4
-rw-r--r--client/mysqlslap.c11
-rw-r--r--client/readline.cc2
13 files changed, 36 insertions, 37 deletions
diff --git a/client/async_example.c b/client/async_example.c
index ccb60950904..f216de22930 100644
--- a/client/async_example.c
+++ b/client/async_example.c
@@ -16,7 +16,7 @@
*/
-#ifndef __WIN__
+#ifndef _WIN32
#include <poll.h>
#else
#include <WinSock2.h>
@@ -33,7 +33,7 @@ static const char *my_groups[]= { "client", NULL };
static int
wait_for_mysql(MYSQL *mysql, int status)
{
-#ifdef __WIN__
+#ifdef _WIN32
fd_set rs, ws, es;
int res;
struct timeval tv, *timeout;
diff --git a/client/client_priv.h b/client/client_priv.h
index cd95d235763..ee33a0b0f99 100644
--- a/client/client_priv.h
+++ b/client/client_priv.h
@@ -27,7 +27,7 @@
#include <mysql_version.h>
#ifndef WEXITSTATUS
-# ifdef __WIN__
+# ifdef _WIN32
# define WEXITSTATUS(stat_val) (stat_val)
# else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
diff --git a/client/mysql.cc b/client/mysql.cc
index 2bb3f2309d6..d22a3d49b16 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -88,7 +88,7 @@ extern "C" {
#endif /* defined(HAVE_CURSES_H) && defined(HAVE_TERM_H) */
#undef bcmp // Fix problem with new readline
-#if defined(__WIN__)
+#if defined(_WIN32)
#include <conio.h>
#else
#include <readline.h>
@@ -1587,7 +1587,7 @@ static struct my_option my_long_options[] =
{"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},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -1893,7 +1893,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
set_if_bigger(opt_silent,1); // more silent
break;
case 'W':
-#ifdef __WIN__
+#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_protocol_type= "pipe";
@@ -2026,7 +2026,7 @@ static int get_options(int argc, char **argv)
static int read_and_execute(bool interactive)
{
-#if defined(__WIN__)
+#if defined(_WIN32)
String tmpbuf;
String buffer;
#endif
@@ -2106,7 +2106,7 @@ static int read_and_execute(bool interactive)
if (opt_outfile && glob_buffer.is_empty())
fflush(OUTFILE);
-#if defined(__WIN__)
+#if defined(_WIN32)
tee_fputs(prompt, stdout);
if (!tmpbuf.is_alloced())
tmpbuf.alloc(65535);
@@ -2139,7 +2139,7 @@ static int read_and_execute(bool interactive)
if (line)
free(line);
line= readline(prompt);
-#endif /* defined(__WIN__) */
+#endif /* defined(_WIN32) */
/*
When Ctrl+d or Ctrl+z is pressed, the line may be NULL on some OS
@@ -2194,7 +2194,7 @@ static int read_and_execute(bool interactive)
}
}
-#if defined(__WIN__)
+#if defined(_WIN32)
buffer.free();
tmpbuf.free();
#else
diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c
index 32030ce1dee..abb42dd01ef 100644
--- a/client/mysql_plugin.c
+++ b/client/mysql_plugin.c
@@ -233,7 +233,7 @@ static int run_command(char* cmd, const char *mode)
}
-#ifdef __WIN__
+#ifdef _WIN32
/**
Check to see if there are spaces in a path.
@@ -329,7 +329,7 @@ static int get_default_values()
if ((error= make_tempfile(defaults_file, "txt")))
goto exit;
-#ifdef __WIN__
+#ifdef _WIN32
{
char *format_str= 0;
@@ -860,7 +860,7 @@ static int process_options(int argc, char *argv[], char *operation)
memset(buff, 0, sizeof(buff));
strncpy(buff, opt_basedir, sizeof(buff) - 1);
-#ifdef __WIN__
+#ifdef _WIN32
strncat(buff, "/", sizeof(buff) - strlen(buff) - 1);
#else
strncat(buff, FN_DIRSEP, sizeof(buff) - strlen(buff) - 1);
@@ -1175,7 +1175,7 @@ static int bootstrap_server(char *server_path, char *bootstrap_file)
char bootstrap_cmd[FN_REFLEN];
int error= 0;
-#ifdef __WIN__
+#ifdef _WIN32
char *format_str= 0;
const char *verbose_str= NULL;
diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c
index e49b0fd0dc0..0ac2c8b5853 100644
--- a/client/mysql_upgrade.c
+++ b/client/mysql_upgrade.c
@@ -29,7 +29,7 @@
#endif
#ifndef WEXITSTATUS
-# ifdef __WIN__
+# ifdef _WIN32
# define WEXITSTATUS(stat_val) (stat_val)
# else
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
@@ -121,7 +121,7 @@ static struct my_option my_long_options[]=
"Password to use when connecting to server. If password is not given,"
" it's solicited on the tty.", &opt_password,&opt_password,
0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0,
GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -451,7 +451,7 @@ static int run_tool(char *tool_path, DYNAMIC_STRING *ds_res, ...)
va_end(args);
-#ifdef __WIN__
+#ifdef _WIN32
dynstr_append(&ds_cmdline, "\"");
#endif
@@ -1286,7 +1286,7 @@ int main(int argc, char **argv)
load_defaults_or_exit("my", load_default_groups, &argc, &argv);
defaults_argv= argv; /* Must be freed by 'free_defaults' */
-#if defined(__WIN__)
+#if defined(_WIN32)
if (GetModuleFileName(NULL, self_name, FN_REFLEN) == 0)
#endif
{
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index de9fe1f7a70..6fa5d6c73d0 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -175,7 +175,7 @@ static struct my_option my_long_options[] =
{"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},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -278,7 +278,7 @@ get_one_option(const struct my_option *opt, const char *argument, const char *fi
option_silent++;
break;
case 'W':
-#ifdef __WIN__
+#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
@@ -1153,7 +1153,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{
bool old= (find_type(argv[0], &command_typelib, FIND_TYPE_BASIC) ==
ADMIN_OLD_PASSWORD);
-#ifdef __WIN__
+#ifdef _WIN32
size_t pw_len= strlen(typed_password);
if (pw_len > 1 && typed_password[0] == '\'' &&
typed_password[pw_len-1] == '\'')
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index d3fc58351ee..d65828ea71c 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -2918,7 +2918,7 @@ static Exit_status dump_local_log_entries(PRINT_EVENT_INFO *print_event_info,
stdin in binary mode. Errors on setting this mode result in
halting the function and printing an error message to stderr.
*/
-#if defined (__WIN__) || defined(_WIN64)
+#if defined (_WIN32)
if (_setmode(fileno(stdin), O_BINARY) == -1)
{
error("Could not set binary mode on stdin.");
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c
index 5d96dd29be2..480308aa015 100644
--- a/client/mysqlcheck.c
+++ b/client/mysqlcheck.c
@@ -165,7 +165,7 @@ static struct my_option my_long_options[] =
"When using ANALYZE TABLE use the PERSISTENT FOR ALL option.",
&opt_persistent_all, &opt_persistent_all, 0, GET_BOOL, NO_ARG,
0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -355,7 +355,7 @@ get_one_option(const struct my_option *opt,
opt_upgrade= 1;
break;
case 'W':
-#ifdef __WIN__
+#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 7fda95239e6..b6419e11a0e 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -504,7 +504,7 @@ static struct my_option my_long_options[] =
{"password", 'p',
"Password to use when connecting to server. If password is not given it's solicited on the tty.",
0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -896,7 +896,7 @@ get_one_option(const struct my_option *opt,
exit(1);
break;
case 'W':
-#ifdef __WIN__
+#ifdef _WIN32
opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
diff --git a/client/mysqlimport.c b/client/mysqlimport.c
index 32022146230..8723641c74b 100644
--- a/client/mysqlimport.c
+++ b/client/mysqlimport.c
@@ -146,7 +146,7 @@ static struct my_option my_long_options[] =
{"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},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -252,7 +252,7 @@ get_one_option(const struct my_option *opt, const char *argument,
else
tty_password= 1;
break;
-#ifdef __WIN__
+#ifdef _WIN32
case 'W':
opt_protocol = MYSQL_PROTOCOL_PIPE;
opt_local_file=1;
diff --git a/client/mysqlshow.c b/client/mysqlshow.c
index d09839d04a8..9b31d87225c 100644
--- a/client/mysqlshow.c
+++ b/client/mysqlshow.c
@@ -247,7 +247,7 @@ static struct my_option my_long_options[] =
&opt_mysql_port,
&opt_mysql_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0,
0},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -336,7 +336,7 @@ get_one_option(const struct my_option *opt, const char *argument,
tty_password=1;
break;
case 'W':
-#ifdef __WIN__
+#ifdef _WIN32
opt_protocol = MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
diff --git a/client/mysqlslap.c b/client/mysqlslap.c
index f456d9b1841..555f0624c7e 100644
--- a/client/mysqlslap.c
+++ b/client/mysqlslap.c
@@ -86,16 +86,15 @@ TODO:
#include <my_dir.h>
#include <signal.h>
#include <sslopt-vars.h>
-#ifndef __WIN__
+#ifndef _WIN32
#include <sys/wait.h>
#endif
#include <ctype.h>
#include <welcome_copyright_notice.h> /* ORACLE_WELCOME_COPYRIGHT_NOTICE */
-#ifdef __WIN__
+#ifdef _WIN32
#define srandom srand
#define random rand
-#define snprintf _snprintf
#endif
@@ -282,7 +281,7 @@ static long int timedif(struct timeval a, struct timeval b)
return s + us;
}
-#ifdef __WIN__
+#ifdef _WIN32
static int gettimeofday(struct timeval *tp, void *tzp)
{
unsigned int ticks;
@@ -665,7 +664,7 @@ static struct my_option my_long_options[] =
{"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},
-#ifdef __WIN__
+#ifdef _WIN32
{"pipe", 'W', "Use named pipes to connect to server.", 0, 0, 0, GET_NO_ARG,
NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
@@ -772,7 +771,7 @@ get_one_option(const struct my_option *opt, const char *argument,
tty_password= 1;
break;
case 'W':
-#ifdef __WIN__
+#ifdef _WIN32
opt_protocol= MYSQL_PROTOCOL_PIPE;
/* Prioritize pipe if explicit via command line */
diff --git a/client/readline.cc b/client/readline.cc
index 8d3d97b8585..6b9e8239984 100644
--- a/client/readline.cc
+++ b/client/readline.cc
@@ -34,7 +34,7 @@ LINE_BUFFER *batch_readline_init(ulong max_size,FILE *file)
{
LINE_BUFFER *line_buff;
-#ifndef __WIN__
+#ifndef _WIN32
MY_STAT input_file_stat;
if (my_fstat(fileno(file), &input_file_stat, MYF(MY_WME)) ||
MY_S_ISDIR(input_file_stat.st_mode) ||