From 3d6eb7afcfb47cb432f790d0b25c8c1f4ec5bcf3 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sun, 6 Jun 2021 13:21:03 +0200 Subject: [PATCH] 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) --- client/async_example.c | 4 +- client/client_priv.h | 2 +- client/mysql.cc | 14 +++--- client/mysql_plugin.c | 8 ++-- client/mysql_upgrade.c | 8 ++-- client/mysqladmin.cc | 6 +-- client/mysqlbinlog.cc | 2 +- client/mysqlcheck.c | 4 +- client/mysqldump.c | 4 +- client/mysqlimport.c | 4 +- client/mysqlshow.c | 4 +- client/mysqlslap.c | 11 +++-- client/readline.cc | 2 +- cmake/os/Windows.cmake | 2 +- config.h.cmake | 2 +- dbug/dbug.c | 8 ++-- extra/innochecksum.cc | 2 +- extra/mariabackup/ds_stdout.cc | 2 +- extra/mariabackup/xbstream_read.cc | 2 +- extra/mariabackup/xbstream_write.cc | 2 +- extra/mariabackup/xtrabackup.cc | 4 +- include/my_dbug.h | 10 ++--- include/my_global.h | 32 ++++++++----- include/my_net.h | 4 +- include/my_pthread.h | 4 +- include/my_stacktrace.h | 6 +-- include/mysql.h | 14 +----- include/mysql_com.h | 4 +- include/thr_alarm.h | 4 +- include/violite.h | 4 +- libmysqld/lib_sql.cc | 2 +- libmysqld/libmysql.c | 16 +++---- libmysqld/libmysqld.c | 11 +---- mysys/get_password.c | 8 ++-- mysys/mf_keycache.c | 6 +-- mysys/mf_path.c | 4 +- mysys/mf_tempdir.c | 4 +- mysys/my_access.c | 13 +++--- mysys/my_conio.c | 4 +- mysys/my_copy.c | 2 +- mysys/my_default.c | 14 +++--- mysys/my_getncpus.c | 2 +- mysys/my_getpagesize.c | 2 +- mysys/my_getwd.c | 2 +- mysys/my_mkdir.c | 2 +- mysys/my_pthread.c | 2 +- mysys/my_redel.c | 4 +- mysys/my_rename.c | 2 +- mysys/my_sleep.c | 2 +- mysys/my_wincond.c | 2 +- mysys/stacktrace.c | 10 ++--- mysys/string.c | 4 +- mysys/thr_alarm.c | 2 +- mysys/thr_mutex.c | 8 ++-- plugin/feedback/utils.cc | 2 +- plugin/server_audit/server_audit.c | 6 +-- sql/custom_conf.h | 2 +- sql/hash_filo.cc | 4 +- sql/hostname.cc | 6 +-- sql/mf_iocache.cc | 2 +- sql/mysqld.cc | 36 +++++++-------- sql/mysqld.h | 2 +- sql/net_serv.cc | 16 +++---- sql/signal_handler.cc | 4 +- sql/sql_base.cc | 2 +- sql/sql_class.cc | 2 +- sql/sql_class.h | 2 +- sql/sql_connect.cc | 2 +- sql/sql_const.h | 13 ------ sql/sql_db.cc | 2 +- sql/sql_load.cc | 2 +- sql/sql_partition.cc | 2 +- sql/sql_plugin.cc | 2 +- sql/sql_profile.cc | 4 +- sql/sql_profile.h | 2 +- sql/sql_show.cc | 2 +- sql/sql_table.cc | 2 +- sql/sys_vars.cc | 2 +- sql/udf_example.c | 6 +-- sql/wsrep_sst.cc | 14 +++--- storage/connect/CMakeLists.txt | 1 + storage/federatedx/ha_federatedx.cc | 2 +- storage/heap/hp_write.c | 2 +- storage/innobase/buf/buf0dump.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 2 +- storage/innobase/include/univ.i | 2 +- storage/innobase/row/row0mysql.cc | 6 +-- storage/maria/aria_chk.c | 2 +- storage/maria/aria_dump_log.c | 2 +- storage/maria/aria_read_log.c | 4 +- storage/maria/ma_control_file.c | 4 +- storage/maria/ma_create.c | 6 +-- storage/maria/ma_info.c | 2 +- storage/maria/ma_locking.c | 4 +- storage/maria/ma_loghandler.c | 4 +- storage/maria/ma_open.c | 6 +-- storage/maria/ma_pagecache.c | 6 +-- storage/maria/ma_sort.c | 2 +- storage/maria/unittest/ma_pagecache_consist.c | 2 +- .../maria/unittest/ma_pagecache_rwconsist.c | 2 +- .../maria/unittest/ma_pagecache_rwconsist2.c | 2 +- storage/maria/unittest/ma_pagecache_single.c | 2 +- storage/maria/unittest/ma_test_loghandler-t.c | 2 +- .../unittest/ma_test_loghandler_first_lsn-t.c | 2 +- .../unittest/ma_test_loghandler_max_lsn-t.c | 2 +- .../ma_test_loghandler_multithread-t.c | 2 +- .../unittest/ma_test_loghandler_noflush-t.c | 2 +- .../unittest/ma_test_loghandler_nologs-t.c | 2 +- .../unittest/ma_test_loghandler_pagecache-t.c | 2 +- .../unittest/ma_test_loghandler_purge-t.c | 2 +- storage/maria/unittest/test_file.c | 2 +- storage/myisam/mi_create.c | 2 +- storage/myisam/mi_extra.c | 45 ------------------- storage/myisam/mi_info.c | 2 +- storage/myisam/mi_log.c | 2 +- storage/myisam/mi_open.c | 2 +- storage/myisam/myisamchk.c | 2 +- storage/myisam/sort.c | 2 +- storage/rocksdb/ut0counter.h | 2 +- storage/sphinx/ha_sphinx.cc | 12 ++--- storage/sphinx/snippets_udf.cc | 8 ++-- storage/spider/hs_client/auto_addrinfo.hpp | 2 +- storage/spider/hs_client/auto_file.hpp | 2 +- storage/spider/hs_client/socket.cpp | 38 ++++++++-------- strings/my_vsnprintf.c | 2 +- tests/list_test.c | 2 +- tests/nonblock-wrappers.h | 4 +- tests/showdb_test.c | 2 +- tests/ssl_test.c | 2 +- tests/thread_test.c | 2 +- unittest/mytap/tap.c | 4 +- vio/viosocket.c | 10 ++--- 132 files changed, 303 insertions(+), 379 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 #else #include @@ -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 #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 #else #include @@ -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 #include #include -#ifndef __WIN__ +#ifndef _WIN32 #include #endif #include #include /* 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) || diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 71ad4ab0912..73463ef2833 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -50,7 +50,7 @@ IF(MSVC AND CMAKE_CXX_COMPILER_ID MATCHES Clang) SET(CLANG_CL TRUE) ENDIF() -ADD_DEFINITIONS(-D_WINDOWS -D__WIN__ -D_CRT_SECURE_NO_DEPRECATE) +ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) ADD_DEFINITIONS(-D_WIN32_WINNT=0x0A00) # We do not want the windows.h macros min/max ADD_DEFINITIONS(-DNOMINMAX) diff --git a/config.h.cmake b/config.h.cmake index ae77d676502..80721592ab0 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -429,7 +429,7 @@ #define PSAPI_VERSION 1 /* for GetProcessMemoryInfo() */ /* We don't want the min/max macros */ -#ifdef __WIN__ +#ifdef _WIN32 #define NOMINMAX 1 #endif diff --git a/dbug/dbug.c b/dbug/dbug.c index 5c05994fb4e..548d82d03e6 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -97,7 +97,7 @@ extern void __gcov_flush(); #define fnmatch(A,B,C) strcmp(A,B) #endif -#if defined(__WIN__) +#if defined(_WIN32) #include #endif @@ -1872,7 +1872,7 @@ static void DoPrefix(CODE_STATE *cs, uint _line_) (void) fprintf(cs->stack->out_file->file, "%5d: ", cs->lineno); if (cs->stack->flags & TIMESTAMP_ON) { -#ifdef __WIN__ +#ifdef _WIN32 /* FIXME This doesn't give microseconds as in Unix case, and the resolution is in system ticks, 10 ms intervals. See my_getsystime.c for high res */ SYSTEMTIME loc_t; @@ -2203,7 +2203,7 @@ void _db_flush_() } -#ifndef __WIN__ +#ifndef _WIN32 void _db_suicide_() { int retval; @@ -2222,7 +2222,7 @@ void _db_suicide_() fprintf(stderr, "sigsuspend returned %d errno %d \n", retval, errno); assert(FALSE); /* With full signal mask, we should never return here. */ } -#endif /* ! __WIN__ */ +#endif /* ! _WIN32 */ void _db_lock_file_() diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 02aec1bd919..5d705e64423 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -32,7 +32,7 @@ #include #include #include -#ifndef __WIN__ +#ifndef _WIN32 # include #endif #include diff --git a/extra/mariabackup/ds_stdout.cc b/extra/mariabackup/ds_stdout.cc index 08776e99329..a9639ff7739 100644 --- a/extra/mariabackup/ds_stdout.cc +++ b/extra/mariabackup/ds_stdout.cc @@ -75,7 +75,7 @@ stdout_open(ds_ctxt_t *ctxt __attribute__((unused)), stdout_file = (ds_stdout_file_t *) (file + 1); -#ifdef __WIN__ +#ifdef _WIN32 setmode(fileno(stdout), _O_BINARY); #endif diff --git a/extra/mariabackup/xbstream_read.cc b/extra/mariabackup/xbstream_read.cc index 84bb279aba0..b54a98157ea 100644 --- a/extra/mariabackup/xbstream_read.cc +++ b/extra/mariabackup/xbstream_read.cc @@ -43,7 +43,7 @@ xb_stream_read_new(void) stream = (xb_rstream_t *) my_malloc(PSI_NOT_INSTRUMENTED, sizeof(xb_rstream_t), MYF(MY_FAE)); -#ifdef __WIN__ +#ifdef _WIN32 setmode(fileno(stdin), _O_BINARY); #endif diff --git a/extra/mariabackup/xbstream_write.cc b/extra/mariabackup/xbstream_write.cc index 2c9ffde6c42..5801e867aac 100644 --- a/extra/mariabackup/xbstream_write.cc +++ b/extra/mariabackup/xbstream_write.cc @@ -110,7 +110,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path, file->chunk_ptr = file->chunk; file->chunk_free = XB_STREAM_MIN_CHUNK_SIZE; if (onwrite) { -#ifdef __WIN__ +#ifdef _WIN32 setmode(fileno(stdout), _O_BINARY); #endif file->userdata = userdata; diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 9d1e9a22b4a..04ca6fa11d6 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1398,7 +1398,7 @@ struct my_option xb_server_options[] = (G_PTR*) &mysql_data_home, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files. Several paths may be specified, separated by a " -#if defined(__WIN__) || defined(OS2) || defined(__NETWARE__) +#if defined(_WIN32) "semicolon (;)" #else "colon (:)" @@ -6690,7 +6690,7 @@ static int main_low(char** argv) /* get default temporary directory */ if (!opt_mysql_tmpdir || !opt_mysql_tmpdir[0]) { opt_mysql_tmpdir = getenv("TMPDIR"); -#if defined(__WIN__) +#if defined(_WIN32) if (!opt_mysql_tmpdir) { opt_mysql_tmpdir = getenv("TEMP"); } diff --git a/include/my_dbug.h b/include/my_dbug.h index fa5b4c126d1..e25bfcf28a7 100644 --- a/include/my_dbug.h +++ b/include/my_dbug.h @@ -17,9 +17,9 @@ #ifndef _my_dbug_h #define _my_dbug_h -#ifndef __WIN__ +#ifndef _WIN32 #include -#endif /* not __WIN__ */ +#endif #ifdef __cplusplus extern "C" { @@ -134,7 +134,7 @@ extern int (*dbug_sanity)(void); #define DBUG_FREE_CODE_STATE(arg) dbug_free_code_state(arg) #undef DBUG_ASSERT_AS_PRINTF -#ifndef __WIN__ +#ifndef _WIN32 #define DBUG_ABORT() (_db_flush_(), abort()) #else /* @@ -156,12 +156,12 @@ extern int (*dbug_sanity)(void); An alternative would be to use _exit(EXIT_FAILURE), but then valgrind would report lots of memory leaks. */ -#ifdef __WIN__ +#ifdef _WIN32 #define DBUG_SUICIDE() DBUG_ABORT() #else extern void _db_suicide_(void); #define DBUG_SUICIDE() (_db_flush_(), _db_suicide_()) -#endif /* __WIN__ */ +#endif /* _WIN32 */ #else /* No debugger */ diff --git a/include/my_global.h b/include/my_global.h index e999e555bf7..92fdfef228e 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -20,9 +20,17 @@ #ifndef MY_GLOBAL_INCLUDED #define MY_GLOBAL_INCLUDED -/* Client library users on Windows need this macro defined here. */ -#if !defined(__WIN__) && defined(_WIN32) -#define __WIN__ +/* + MDEV-25602 Deprecate __WIN__ symbol. + Temporarily, allow inside connect engine, + until fixed in upstream. +*/ +#ifndef connect_EXPORTS +#ifdef _MSC_VER +#pragma deprecated("__WIN__") +#elif defined (__GNUC__) +#pragma GCC poison __WIN__ +#endif #endif /* @@ -43,7 +51,7 @@ #undef _WIN #undef _WIN32 #undef _WIN64 -#undef __WIN__ +#undef _WIN32 #undef __WIN32__ #define HAVE_ERRNO_AS_DEFINE #define _POSIX_MONOTONIC_CLOCK @@ -79,7 +87,7 @@ #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ /* Make it easier to add conditional code in _expressions_ */ -#ifdef __WIN__ +#ifdef _WIN32 #define IF_WIN(A,B) A #else #define IF_WIN(A,B) B @@ -240,7 +248,7 @@ #endif -#if !defined(__WIN__) +#if !defined(_WIN32) #ifndef _POSIX_PTHREAD_SEMANTICS #define _POSIX_PTHREAD_SEMANTICS /* We want posix threads */ #endif @@ -261,7 +269,7 @@ C_MODE_END #if !defined(SCO) && !defined(_REENTRANT) #define _REENTRANT 1 /* Threads requires reentrant code */ #endif -#endif /* !defined(__WIN__) */ +#endif /* !defined(_WIN32) */ /* gcc/egcs issues */ @@ -588,12 +596,12 @@ typedef SOCKET_SIZE_TYPE size_socket; #endif /* additional file share flags for win32 */ -#ifdef __WIN__ +#ifdef _WIN32 #define _SH_DENYRWD 0x110 /* deny read/write mode & delete */ #define _SH_DENYWRD 0x120 /* deny write mode & delete */ #define _SH_DENYRDD 0x130 /* deny read mode & delete */ #define _SH_DENYDEL 0x140 /* deny delete only */ -#endif /* __WIN__ */ +#endif /* _WIN32 */ /* General constants */ @@ -693,7 +701,7 @@ typedef SOCKET_SIZE_TYPE size_socket; /* Some defines of functions for portability */ #undef remove /* Crashes MySQL on SCO 5.0.0 */ -#ifndef __WIN__ +#ifndef _WIN32 #define closesocket(A) close(A) #endif @@ -915,7 +923,7 @@ typedef ulonglong uint64; #if defined(NO_CLIENT_LONG_LONG) typedef unsigned long my_ulonglong; -#elif defined (__WIN__) +#elif defined (_WIN32) typedef unsigned __int64 my_ulonglong; #else typedef unsigned long long my_ulonglong; @@ -955,7 +963,7 @@ typedef ulonglong table_map; /* Used for table bits in join */ typedef const struct charset_info_st CHARSET_INFO; typedef struct st_mysql_lex_string LEX_STRING; -#if defined(__WIN__) +#if defined(_WIN32) #define socket_errno WSAGetLastError() #define SOCKET_EINTR WSAEINTR #define SOCKET_ETIMEDOUT WSAETIMEDOUT diff --git a/include/my_net.h b/include/my_net.h index 9a4f2f44b49..f56ae09ad8c 100644 --- a/include/my_net.h +++ b/include/my_net.h @@ -43,7 +43,7 @@ C_MODE_START #include #endif -#if !defined(__WIN__) +#if !defined(_WIN32) #include #include #include @@ -52,7 +52,7 @@ C_MODE_START #endif #endif -#if defined(__WIN__) +#if defined(_WIN32) #define O_NONBLOCK 1 /* For emulation of fcntl() */ /* diff --git a/include/my_pthread.h b/include/my_pthread.h index e6fd0dfc5da..d38d69d04a0 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -30,7 +30,7 @@ extern "C" { #define EXTERNC #endif /* __cplusplus */ -#if defined(__WIN__) +#if defined(_WIN32) typedef CRITICAL_SECTION pthread_mutex_t; typedef DWORD pthread_t; typedef struct thread_attr { @@ -277,7 +277,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res); #define HAVE_PTHREAD_KILL 1 #endif -#endif /* defined(__WIN__) */ +#endif /* defined(_WIN32) */ #if defined(HPUX10) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS) #undef pthread_cond_timedwait diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index 20b86f45232..7cfee0f7a4f 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -23,7 +23,7 @@ (defined(__alpha__) && defined(__GNUC__)) #define HAVE_STACKTRACE 1 #endif -#elif defined(__WIN__) || defined(HAVE_PRINTSTACK) +#elif defined(_WIN32) || defined(HAVE_PRINTSTACK) #define HAVE_STACKTRACE 1 #endif @@ -49,12 +49,12 @@ void my_write_core(int sig); # if BACKTRACE_DEMANGLE char *my_demangle(const char *mangled_name, int *status); # endif /* BACKTRACE_DEMANGLE */ -# ifdef __WIN__ +# ifdef _WIN32 # define my_setup_stacktrace() void my_set_exception_pointers(EXCEPTION_POINTERS *ep); # else void my_setup_stacktrace(void); -# endif /* __WIN__ */ +# endif /* _WIN32 */ #else # define my_setup_stacktrace() #endif /* ! (defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE)) */ diff --git a/include/mysql.h b/include/mysql.h index 6ff4c6d3fad..87def05dc7e 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -32,13 +32,6 @@ #include #endif -#ifdef __CYGWIN__ /* CYGWIN implements a UNIX API */ -#undef WIN -#undef _WIN -#undef _WIN32 -#undef _WIN64 -#undef __WIN__ -#endif #ifdef __cplusplus extern "C" { @@ -53,10 +46,7 @@ extern "C" { typedef char my_bool; #endif -#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WIN__) -#define __WIN__ -#endif -#if !defined(__WIN__) +#if !defined(_WIN32) #define STDCALL #else #define STDCALL __stdcall @@ -130,7 +120,7 @@ typedef unsigned int MYSQL_FIELD_OFFSET; /* offset to current field */ #ifndef MY_GLOBAL_INCLUDED #if defined(NO_CLIENT_LONG_LONG) typedef unsigned long my_ulonglong; -#elif defined (__WIN__) +#elif defined (_WIN32) typedef unsigned __int64 my_ulonglong; #else typedef unsigned long long my_ulonglong; diff --git a/include/mysql_com.h b/include/mysql_com.h index 0f525488b53..e0a81a7e31b 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -96,10 +96,10 @@ #define LOCAL_HOST_NAMEDPIPE "." -#if defined(__WIN__) && !defined( _CUSTOMCONFIG_) +#if defined(_WIN32) && !defined( _CUSTOMCONFIG_) #define MYSQL_NAMEDPIPE "MySQL" #define MYSQL_SERVICENAME "MySQL" -#endif /* __WIN__ */ +#endif /* You should add new commands to the end of this list, otherwise old diff --git a/include/thr_alarm.h b/include/thr_alarm.h index 250590a0e2f..e0f3fdd1c25 100644 --- a/include/thr_alarm.h +++ b/include/thr_alarm.h @@ -65,7 +65,7 @@ typedef my_bool ALARM; #define end_thr_alarm(A) #else -#if defined(__WIN__) +#if defined(_WIN32) typedef struct st_thr_alarm_entry { UINT_PTR crono; @@ -77,7 +77,7 @@ typedef int thr_alarm_entry; #define thr_got_alarm(thr_alarm) (**(thr_alarm)) -#endif /* __WIN__ */ +#endif /* _WIN32 */ typedef thr_alarm_entry* thr_alarm_t; diff --git a/include/violite.h b/include/violite.h index 2333d0018b5..b823e62b2e1 100644 --- a/include/violite.h +++ b/include/violite.h @@ -74,11 +74,11 @@ struct vio_keepalive_opts Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); Vio* mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, uint flags); -#ifdef __WIN__ +#ifdef _WIN32 Vio* vio_new_win32pipe(HANDLE hPipe); #else #define HANDLE void * -#endif /* __WIN__ */ +#endif /* _WIN32 */ void vio_delete(Vio* vio); int vio_close(Vio* vio); diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 3d0482d1cd5..5374c420fac 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -578,7 +578,7 @@ int init_embedded_server(int argc, char **argv, char **groups) /* Get default temporary directory */ opt_mysql_tmpdir=getenv("TMPDIR"); /* Use this if possible */ -#if defined(__WIN__) +#if defined(_WIN32) if (!opt_mysql_tmpdir) opt_mysql_tmpdir=getenv("TEMP"); if (!opt_mysql_tmpdir) diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c index 2c954cea390..09ae52aedee 100644 --- a/libmysqld/libmysql.c +++ b/libmysqld/libmysql.c @@ -35,7 +35,7 @@ #ifdef HAVE_PWD_H #include #endif -#if !defined(__WIN__) +#if !defined(_WIN32) #include #include #include @@ -46,7 +46,7 @@ #ifdef HAVE_SYS_SELECT_H #include #endif -#endif /* !defined(__WIN__) */ +#endif /* !defined(_WIN32) */ #if defined(HAVE_POLL_H) #include #elif defined(HAVE_SYS_POLL_H) @@ -55,7 +55,7 @@ #ifdef HAVE_SYS_UN_H #include #endif -#if !defined(__WIN__) +#if !defined(_WIN32) #include /* because of signal() */ #endif #ifndef INADDR_NONE @@ -78,13 +78,13 @@ ulong max_allowed_packet= 1024L*1024L*1024L; my_bool net_flush(NET *net); #endif -#if defined(__WIN__) +#if defined(_WIN32) /* socket_errno is defined in my_global.h for all platforms */ #define perror(A) #else #include #define SOCKET_ERROR -1 -#endif /* __WIN__ */ +#endif /* _WIN32 */ /* If allowed through some configuration, then this needs to @@ -167,7 +167,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), if (!mysql_unix_port) { char *env; -#ifdef __WIN__ +#ifdef _WIN32 mysql_unix_port = (char*) MYSQL_NAMEDPIPE; #else mysql_unix_port = (char*) MYSQL_UNIX_ADDR; @@ -176,7 +176,7 @@ int STDCALL mysql_server_init(int argc __attribute__((unused)), mysql_unix_port = env; } mysql_debug(NullS); -#if defined(SIGPIPE) && !defined(__WIN__) +#if defined(SIGPIPE) && !defined(_WIN32) (void) signal(SIGPIPE, SIG_IGN); #endif #ifdef EMBEDDED_LIBRARY @@ -421,7 +421,7 @@ struct passwd *getpwuid(uid_t); char* getlogin(void); #endif -#if !defined(__WIN__) +#if !defined(_WIN32) void read_user_name(char *name) { diff --git a/libmysqld/libmysqld.c b/libmysqld/libmysqld.c index d29126467e2..774b687f0e2 100644 --- a/libmysqld/libmysqld.c +++ b/libmysqld/libmysqld.c @@ -32,7 +32,7 @@ #ifdef HAVE_PWD_H #include #endif -#if !defined(__WIN__) +#if !defined(_WIN32) #include #include #include @@ -54,7 +54,7 @@ extern ulong net_buffer_length; extern ulong max_allowed_packet; -#if defined(__WIN__) +#if defined(_WIN32) #define ERRNO WSAGetLastError() #define perror(A) #else @@ -69,13 +69,6 @@ struct passwd *getpwuid(uid_t); char* getlogin(void); #endif -#ifdef __WIN__ -static my_bool is_NT(void) -{ - char *os=getenv("OS"); - return (os && !strcmp(os, "Windows_NT")) ? 1 : 0; -} -#endif int mysql_init_character_set(MYSQL *mysql); diff --git a/mysys/get_password.c b/mysys/get_password.c index 2a5ddc9a4d7..24befa6b5df 100644 --- a/mysys/get_password.c +++ b/mysys/get_password.c @@ -29,7 +29,7 @@ #include #endif /* HAVE_PWD_H */ #else /* ! HAVE_GETPASS */ -#ifndef __WIN__ +#ifndef _WIN32 #include #ifdef HAVE_TERMIOS_H /* For tty-password */ #include @@ -49,14 +49,14 @@ #endif #else #include -#endif /* __WIN__ */ +#endif /* _WIN32 */ #endif /* HAVE_GETPASS */ #ifdef HAVE_GETPASSPHRASE /* For Solaris */ #define getpass(A) getpassphrase(A) #endif -#ifdef __WIN__ +#ifdef _WIN32 /* were just going to fake it here and get input from the keyboard */ @@ -204,4 +204,4 @@ char *get_tty_password(const char *opt_message) DBUG_RETURN(my_strdup(PSI_INSTRUMENT_ME, buff, MYF(MY_FAE))); } -#endif /*__WIN__*/ +#endif /*_WIN32*/ diff --git a/mysys/mf_keycache.c b/mysys/mf_keycache.c index ec5e39938b6..4056935b6d6 100644 --- a/mysys/mf_keycache.c +++ b/mysys/mf_keycache.c @@ -400,7 +400,7 @@ static long keycache_thread_id; #define HASH_LINK_NUMBER(h) \ ((uint) (((char*)(h)-(char *) keycache->hash_link_root)/sizeof(HASH_LINK))) -#if (defined(KEYCACHE_TIMEOUT) && !defined(__WIN__)) || defined(KEYCACHE_DEBUG) +#if (defined(KEYCACHE_TIMEOUT) && !defined(_WIN32)) || defined(KEYCACHE_DEBUG) static int keycache_pthread_cond_wait(mysql_cond_t *cond, mysql_mutex_t *mutex); #else @@ -4674,7 +4674,7 @@ static void keycache_dump(SIMPLE_KEY_CACHE_CB *keycache) #endif /* defined(KEYCACHE_TIMEOUT) */ -#if defined(KEYCACHE_TIMEOUT) && !defined(__WIN__) +#if defined(KEYCACHE_TIMEOUT) && !defined(_WIN32) static int keycache_pthread_cond_wait(mysql_cond_t *cond, @@ -4736,7 +4736,7 @@ static int keycache_pthread_cond_wait(mysql_cond_t *cond, return rc; } #endif -#endif /* defined(KEYCACHE_TIMEOUT) && !defined(__WIN__) */ +#endif /* defined(KEYCACHE_TIMEOUT) && !defined(_WIN32) */ #if defined(KEYCACHE_DEBUG) diff --git a/mysys/mf_path.c b/mysys/mf_path.c index 7da925d6f5f..cba80599daa 100644 --- a/mysys/mf_path.c +++ b/mysys/mf_path.c @@ -74,7 +74,7 @@ char * my_path(char * to, const char *progname, /* test if file without filename is found in path */ /* Returns to if found and to has dirpart if found, else NullS */ -#if defined(__WIN__) +#if defined(_WIN32) #define F_OK 0 #define PATH_SEP ';' #define PROGRAM_EXTENSION ".exe" @@ -107,7 +107,7 @@ static char *find_file_in_path(char *to, const char *name) } } } -#ifdef __WIN__ +#ifdef _WIN32 to[0]=FN_CURLIB; strxmov(to+1,dir,name,ext,NullS); if (!access(to,F_OK)) /* Test in current dir */ diff --git a/mysys/mf_tempdir.c b/mysys/mf_tempdir.c index d09b307c4c7..f2b1ea819b7 100644 --- a/mysys/mf_tempdir.c +++ b/mysys/mf_tempdir.c @@ -16,7 +16,7 @@ #include "mysys_priv.h" #include -#if defined(__WIN__) +#if defined(_WIN32) #define DELIM ';' #else #define DELIM ':' @@ -37,7 +37,7 @@ my_bool init_tmpdir(MY_TMPDIR *tmpdir, const char *pathlist) { /* Get default temporary directory */ pathlist=getenv("TMPDIR"); /* Use this if possible */ -#if defined(__WIN__) +#if defined(_WIN32) if (!pathlist) pathlist=getenv("TEMP"); if (!pathlist) diff --git a/mysys/my_access.c b/mysys/my_access.c index 65746295391..81e635d9716 100644 --- a/mysys/my_access.c +++ b/mysys/my_access.c @@ -17,7 +17,7 @@ #include "mysys_priv.h" #include -#ifdef __WIN__ +#ifdef _WIN32 /* Check a file or path for accessability. @@ -46,7 +46,7 @@ int my_access(const char *path, int amode) return 0; } -#endif /* __WIN__ */ +#endif /* _WIN32 */ /* @@ -150,7 +150,7 @@ int check_if_legal_tablename(const char *name) } -#ifdef __WIN__ +#ifdef _WIN32 /** Checks if the drive letter supplied is valid or not. Valid drive letters are A to Z, both lower case and upper case. @@ -217,10 +217,9 @@ my_bool is_filename_allowed(const char *name __attribute__((unused)), } return TRUE; } /* is_filename_allowed */ -#endif /* __WIN__ */ - -#if defined(__WIN__) || defined(__EMX__) +#endif /* _WIN32 */ +#if defined(_WIN32) /* Check if a path will access a reserved file name that may cause problems @@ -265,4 +264,4 @@ int check_if_legal_filename(const char *path) DBUG_RETURN(0); } -#endif /* defined(__WIN__) || defined(__EMX__) */ +#endif /* defined(_WIN32) */ diff --git a/mysys/my_conio.c b/mysys/my_conio.c index 04750635dd3..abcfa9798ec 100644 --- a/mysys/my_conio.c +++ b/mysys/my_conio.c @@ -17,7 +17,7 @@ #include "mysys_priv.h" -#ifdef __WIN__ +#ifdef _WIN32 static HANDLE my_coninpfh= 0; /* console input */ @@ -220,4 +220,4 @@ char* my_cgets(char *buffer, size_t clen, size_t* plen) return result; } -#endif /* __WIN__ */ +#endif /* _WIN32 */ diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 94ad3f6b665..3b07dd5fd53 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -116,7 +116,7 @@ int my_copy(const char *from, const char *to, myf MyFlags) if (MyFlags & MY_FAE) goto err; } -#if !defined(__WIN__) +#if !defined(_WIN32) /* Copy ownership */ if (chown(to, stat_buff.st_uid, stat_buff.st_gid)) { diff --git a/mysys/my_default.c b/mysys/my_default.c index ec94aee290c..cc4462a240b 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -39,7 +39,7 @@ #include #include #include -#ifdef __WIN__ +#ifdef _WIN32 #include #endif @@ -66,7 +66,7 @@ const char *my_defaults_extra_file=0; #define DEFAULT_DIRS_SIZE (MAX_DEFAULT_DIRS + 1) /* Terminate with NULL */ static const char **default_directories = NULL; -#ifdef __WIN__ +#ifdef _WIN32 static const char *f_extensions[]= { ".ini", ".cnf", 0 }; #define NEWLINE "\r\n" #else @@ -620,7 +620,7 @@ static int search_default_file_with_ext(struct handle_option_ctx *ctx, strmov(name,config_file); } fn_format(name,name,"","",4); -#if !defined(__WIN__) +#if !defined(_WIN32) { MY_STAT stat_info; if (!my_stat(name,&stat_info,MYF(0))) @@ -973,7 +973,7 @@ static int add_directory(MEM_ROOT *alloc, const char *dir, const char **dirs) return 0; } -#ifdef __WIN__ +#ifdef _WIN32 static const char *my_get_module_parent(char *buf, size_t size) { char *last= NULL; @@ -1003,7 +1003,7 @@ static const char *my_get_module_parent(char *buf, size_t size) return buf; } -#endif /* __WIN__ */ +#endif /* _WIN32 */ static const char **init_default_directories(MEM_ROOT *alloc) @@ -1018,7 +1018,7 @@ static const char **init_default_directories(MEM_ROOT *alloc) DBUG_RETURN(NULL); bzero((char *) dirs, DEFAULT_DIRS_SIZE * sizeof(char *)); -#ifdef __WIN__ +#ifdef _WIN32 { char fname_buffer[FN_REFLEN]; @@ -1066,7 +1066,7 @@ static const char **init_default_directories(MEM_ROOT *alloc) /* Placeholder for --defaults-extra-file= */ errors += add_directory(alloc, "", dirs); -#if !defined(__WIN__) +#if !defined(_WIN32) errors += add_directory(alloc, "~/", dirs); #endif diff --git a/mysys/my_getncpus.c b/mysys/my_getncpus.c index 0d081b72d11..1f5fa794a55 100644 --- a/mysys/my_getncpus.c +++ b/mysys/my_getncpus.c @@ -63,7 +63,7 @@ int my_getncpus(void) #ifdef _SC_NPROCESSORS_ONLN ncpus= sysconf(_SC_NPROCESSORS_ONLN); -#elif defined(__WIN__) +#elif defined(_WIN32) SYSTEM_INFO sysinfo; /* diff --git a/mysys/my_getpagesize.c b/mysys/my_getpagesize.c index 030a62deb61..62d077ccdc4 100644 --- a/mysys/my_getpagesize.c +++ b/mysys/my_getpagesize.c @@ -18,7 +18,7 @@ #ifndef HAVE_GETPAGESIZE -#if defined __WIN__ +#if defined _WIN32 int my_getpagesize(void) { diff --git a/mysys/my_getwd.c b/mysys/my_getwd.c index cdad96b3a84..d74c263db03 100644 --- a/mysys/my_getwd.c +++ b/mysys/my_getwd.c @@ -22,7 +22,7 @@ #ifdef HAVE_GETWD #include #endif -#if defined(__WIN__) +#if defined(_WIN32) #include #include #include diff --git a/mysys/my_mkdir.c b/mysys/my_mkdir.c index f9067710331..00bcca7776e 100644 --- a/mysys/my_mkdir.c +++ b/mysys/my_mkdir.c @@ -18,7 +18,7 @@ #include "mysys_err.h" #include #include -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/mysys/my_pthread.c b/mysys/my_pthread.c index c1567f2cd03..0e766876792 100644 --- a/mysys/my_pthread.c +++ b/mysys/my_pthread.c @@ -90,7 +90,7 @@ struct tm *gmtime_r(const time_t *clock, struct tm *res) ** Author: Gary Wisniewski , much modified by Monty ****************************************************************************/ -#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(__WIN__) && !defined(HAVE_rts_threads) +#if !defined(HAVE_SIGWAIT) && !defined(sigwait) && !defined(_WIN32) && !defined(HAVE_rts_threads) #if !defined(DONT_USE_SIGSUSPEND) diff --git a/mysys/my_redel.c b/mysys/my_redel.c index 1a69eaa291f..3dacfff96dd 100644 --- a/mysys/my_redel.c +++ b/mysys/my_redel.c @@ -106,7 +106,7 @@ int my_copystat(const char *from, const char *to, int MyFlags) return -1; } -#if !defined(__WIN__) +#if !defined(_WIN32) if (statbuf.st_nlink > 1 && MyFlags & MY_LINK_WARNING) { if (MyFlags & MY_LINK_WARNING) @@ -121,7 +121,7 @@ int my_copystat(const char *from, const char *to, int MyFlags) if (MyFlags & MY_FAE) return -1; } -#endif /* !__WIN__ */ +#endif /* !_WIN32 */ if (MyFlags & MY_COPYTIME) { diff --git a/mysys/my_rename.c b/mysys/my_rename.c index 7b31e83be20..93a59342b6c 100644 --- a/mysys/my_rename.c +++ b/mysys/my_rename.c @@ -81,7 +81,7 @@ int my_rename(const char *from, const char *to, myf MyFlags) DBUG_ENTER("my_rename"); DBUG_PRINT("my",("from %s to %s MyFlags %lu", from, to, MyFlags)); -#if defined(__WIN__) +#if defined(_WIN32) if (!win_rename_with_retries(from, to)) { my_osmaperr(GetLastError()); diff --git a/mysys/my_sleep.c b/mysys/my_sleep.c index 1c54b696aea..fff58e4aa2a 100644 --- a/mysys/my_sleep.c +++ b/mysys/my_sleep.c @@ -20,7 +20,7 @@ void my_sleep(ulong m_seconds) { -#if defined(__WIN__) +#if defined(_WIN32) Sleep(m_seconds/1000+1); /* Sleep() has millisecond arg */ #elif defined(HAVE_SELECT) struct timeval t; diff --git a/mysys/my_wincond.c b/mysys/my_wincond.c index 64c48c5aeba..978be9db862 100644 --- a/mysys/my_wincond.c +++ b/mysys/my_wincond.c @@ -111,4 +111,4 @@ int pthread_attr_destroy(pthread_attr_t *connect_att) return 0; } -#endif /* __WIN__ */ +#endif /* _WIN32 */ diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 5718b2e762d..250d0bdbea2 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -18,7 +18,7 @@ #include "mysys_priv.h" #include -#ifndef __WIN__ +#ifndef _WIN32 #include #include #ifdef HAVE_STACKTRACE @@ -43,10 +43,10 @@ static sig_handler default_handle_fatal_signal(int sig) my_safe_printf_stderr("%s: Got signal %d. Attempting backtrace\n", my_progname_short, sig); my_print_stacktrace(0,0,1); -#ifndef __WIN__ +#ifndef _WIN32 signal(sig, SIG_DFL); kill(getpid(), sig); -#endif /* __WIN__ */ +#endif /* _WIN32 */ return; } @@ -428,7 +428,7 @@ void my_write_core(int sig) #endif } -#else /* __WIN__*/ +#else /* _WIN32*/ #ifdef _MSC_VER /* Silence warning in OS header dbghelp.h */ @@ -713,7 +713,7 @@ int my_safe_print_str(const char *val, size_t len) } return 0; } -#endif /*__WIN__*/ +#endif /*_WIN32*/ size_t my_write_stderr(const void *buf, size_t count) diff --git a/mysys/string.c b/mysys/string.c index b346393d91e..91e4306ced4 100644 --- a/mysys/string.c +++ b/mysys/string.c @@ -145,13 +145,13 @@ my_bool dynstr_trunc(DYNAMIC_STRING *str, size_t n) my_bool dynstr_append_os_quoted(DYNAMIC_STRING *str, const char *append, ...) { -#ifdef __WIN__ +#ifdef _WIN32 LEX_CSTRING quote= { C_STRING_WITH_LEN("\"") }; LEX_CSTRING replace= { C_STRING_WITH_LEN("\\\"") }; #else LEX_CSTRING quote= { C_STRING_WITH_LEN("\'") }; LEX_CSTRING replace= { C_STRING_WITH_LEN("'\"'\"'") }; -#endif /* __WIN__ */ +#endif /* _WIN32 */ my_bool ret= TRUE; va_list dirty_text; diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index 92a471075c6..666f444b51c 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -50,7 +50,7 @@ my_bool thr_alarm_inited= 0, my_disable_thr_alarm= 0; -#if !defined(__WIN__) +#if !defined(_WIN32) uint thr_client_alarm; static int alarm_aborted=1; /* No alarm thread */ diff --git a/mysys/thr_mutex.c b/mysys/thr_mutex.c index 2a8e54621c0..dd3a5ce132f 100644 --- a/mysys/thr_mutex.c +++ b/mysys/thr_mutex.c @@ -433,7 +433,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line) remove_from_active_list(mp); -#ifdef __WIN__ +#ifdef _WIN32 pthread_mutex_unlock(&mp->mutex); error=0; #else @@ -446,7 +446,7 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line) fflush(stderr); abort(); } -#endif /* __WIN__ */ +#endif /* _WIN32 */ pthread_mutex_unlock(&mp->global); return error; } @@ -603,7 +603,7 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) /* Free all entries that points to this one */ safe_mutex_free_deadlock_data(mp); -#ifdef __WIN__ +#ifdef _WIN32 pthread_mutex_destroy(&mp->global); pthread_mutex_destroy(&mp->mutex); #else @@ -611,7 +611,7 @@ int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) error=1; if (pthread_mutex_destroy(&mp->mutex)) error=1; -#endif /* __WIN__ */ +#endif /* _WIN32 */ mp->file= 0; /* Mark destroyed */ #ifdef SAFE_MUTEX_DETECT_DESTROY diff --git a/plugin/feedback/utils.cc b/plugin/feedback/utils.cc index e362446204f..bbbd5850089 100644 --- a/plugin/feedback/utils.cc +++ b/plugin/feedback/utils.cc @@ -246,7 +246,7 @@ int my_getncpus() { #ifdef _SC_NPROCESSORS_ONLN return sysconf(_SC_NPROCESSORS_ONLN); -#elif defined(__WIN__) +#elif defined(_WIN32) SYSTEM_INFO sysinfo; GetSystemInfo(&sysinfo); return sysinfo.dwNumberOfProcessors; diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index bfabe763eb7..49d41627275 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -217,7 +217,7 @@ static int loc_rename(const char *from, const char *to) { int error = 0; -#if defined(__WIN__) +#if defined(_WIN32) if (!MoveFileEx(from, to, MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) { @@ -1044,9 +1044,9 @@ static int get_user_host(const char *uh_line, unsigned int uh_len, return 0; } -#if defined(__WIN__) && !defined(S_ISDIR) +#if defined(_WIN32) && !defined(S_ISDIR) #define S_ISDIR(x) ((x) & _S_IFDIR) -#endif /*__WIN__ && !S_ISDIR*/ +#endif /*_WIN32 && !S_ISDIR*/ static int start_logging() { diff --git a/sql/custom_conf.h b/sql/custom_conf.h index 5847b939ca7..f0bb619a515 100644 --- a/sql/custom_conf.h +++ b/sql/custom_conf.h @@ -18,7 +18,7 @@ #define __MYSQL_CUSTOM_BUILD_CONFIG__ #define MYSQL_PORT 5002 -#ifdef __WIN__ +#ifdef _WIN32 #define MYSQL_NAMEDPIPE "SwSqlServer" #define MYSQL_SERVICENAME "SwSqlServer" #define KEY_SERVICE_PARAMETERS diff --git a/sql/hash_filo.cc b/sql/hash_filo.cc index b359bd95786..085c12f15da 100644 --- a/sql/hash_filo.cc +++ b/sql/hash_filo.cc @@ -27,7 +27,7 @@ #include "sql_priv.h" #include "hash_filo.h" -#ifdef __WIN__ +#ifdef _WIN32 // Remove linker warning 4221 about empty file namespace { char dummy; }; -#endif // __WIN__ +#endif // _WIN32 diff --git a/sql/hostname.cc b/sql/hostname.cc index fed47e88597..7b07ab620a6 100644 --- a/sql/hostname.cc +++ b/sql/hostname.cc @@ -28,7 +28,7 @@ #include "sql_priv.h" #include "unireg.h" // SPECIAL_NO_HOST_CACHE #include "hostname.h" -#ifndef __WIN__ +#ifndef _WIN32 #include // getservbyname, servent #endif #include "hash_filo.h" @@ -40,12 +40,12 @@ #ifdef __cplusplus extern "C" { // Because of SCO 3.2V4.2 #endif -#if !defined( __WIN__) +#if !defined( _WIN32) #ifdef HAVE_SYS_UN_H #include #endif #include -#endif // __WIN__ +#endif // _WIN32 #ifdef __cplusplus } #endif diff --git a/sql/mf_iocache.cc b/sql/mf_iocache.cc index 877a49edbec..a8087ed5fc5 100644 --- a/sql/mf_iocache.cc +++ b/sql/mf_iocache.cc @@ -87,7 +87,7 @@ int _my_b_net_read(IO_CACHE *info, uchar *Buffer, size_t) } /* extern "C" */ -#elif defined(__WIN__) +#elif defined(_WIN32) // Remove linker warning 4221 about empty file namespace { char dummy; }; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index dcddb157cda..249dde9177c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -18,7 +18,7 @@ #include "sql_priv.h" #include "unireg.h" #include -#ifndef __WIN__ +#ifndef _WIN32 #include // getservbyname, servent #endif #include "sql_parse.h" // path_starts_from_data_home_dir @@ -148,7 +148,7 @@ extern "C" { // Because of SCO 3.2V4.2 #endif #include -#if !defined(__WIN__) +#if !defined(_WIN32) #include #ifdef HAVE_SYS_UN_H #include @@ -160,11 +160,11 @@ extern "C" { // Because of SCO 3.2V4.2 #include #endif #include -#endif /* __WIN__ */ +#endif /* _WIN32 */ #include -#ifdef __WIN__ +#ifdef _WIN32 #include #endif @@ -1636,7 +1636,7 @@ static void break_connect_loop() #endif } mysql_mutex_unlock(&LOCK_start_thread); -#endif /* __WIN__ */ +#endif /* _WIN32 */ } @@ -1784,7 +1784,7 @@ extern "C" sig_handler print_signal_warning(int sig) #ifdef SIGNAL_HANDLER_RESET_ON_DELIVERY my_sigset(sig,print_signal_warning); /* int. thread system calls */ #endif -#if !defined(__WIN__) +#if !defined(_WIN32) if (sig == SIGALRM) alarm(2); /* reschedule alarm */ #endif @@ -2109,7 +2109,7 @@ static void set_ports() } if (!mysqld_unix_port) { -#ifdef __WIN__ +#ifdef _WIN32 mysqld_unix_port= (char*) MYSQL_NAMEDPIPE; #else mysqld_unix_port= (char*) MYSQL_UNIX_ADDR; @@ -2168,7 +2168,7 @@ static void set_user(const char *user, struct passwd *user_info_arg) allow_coredumps(); } -#if !defined(__WIN__) +#if !defined(_WIN32) static void set_effective_user(struct passwd *user_info_arg) { DBUG_ASSERT(user_info_arg != 0); @@ -2189,7 +2189,7 @@ static void set_effective_user(struct passwd *user_info_arg) /** Change root user if started with @c --chroot . */ static void set_root(const char *path) { -#if !defined(__WIN__) +#if !defined(_WIN32) if (chroot(path) == -1) { sql_perror("chroot"); @@ -2272,7 +2272,7 @@ static void activate_tcp_port(uint port, mysql_socket_set_thread_owner(ip_sock); -#ifndef __WIN__ +#ifndef _WIN32 /* We should not use SO_REUSEADDR on windows as this would enable a user to open two mysqld servers with the same TCP/IP port. @@ -2280,7 +2280,7 @@ static void activate_tcp_port(uint port, arg= 1; (void) mysql_socket_setsockopt(ip_sock, SOL_SOCKET, SO_REUSEADDR, (char*)&arg, sizeof(arg)); -#endif /* __WIN__ */ +#endif /* _WIN32 */ #ifdef IPV6_V6ONLY /* @@ -2898,7 +2898,7 @@ static void start_signal_handler(void) static void check_data_home(const char *path) {} -#endif /* __WIN__ */ +#endif /* _WIN32 */ #if BACKTRACE_DEMANGLE @@ -2925,7 +2925,7 @@ mariadb_dbug_assert_failed(const char *assert_expr, const char *file, } #endif /* DBUG_ASSERT_AS_PRINT */ -#if !defined(__WIN__) +#if !defined(_WIN32) #ifndef SA_RESETHAND #define SA_RESETHAND 0 #endif /* SA_RESETHAND */ @@ -3191,7 +3191,7 @@ static void check_data_home(const char *path) {} #endif /*!EMBEDDED_LIBRARY*/ -#endif /* __WIN__*/ +#endif /* _WIN32*/ /** @@ -3995,7 +3995,7 @@ static int init_common_variables() /* MyISAM requires two file handles per table. */ wanted_files= (extra_files + max_connections + extra_max_connections + tc_size * 2 * tc_instances); -#if defined(HAVE_POOL_OF_THREADS) && !defined(__WIN__) +#if defined(HAVE_POOL_OF_THREADS) && !defined(_WIN32) // add epoll or kevent fd for each threadpool group, in case pool of threads is used wanted_files+= (thread_handling > SCHEDULER_NO_THREADS) ? 0 : threadpool_size; #endif @@ -6615,7 +6615,7 @@ struct my_option my_long_options[]= &opt_use_ssl, &opt_use_ssl, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif -#ifdef __WIN__ +#ifdef _WIN32 {"standalone", 0, "Dummy option to start as a standalone program (NT).", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -7541,7 +7541,7 @@ static void usage(void) puts("\nFor more help options (several pages), use mysqld --verbose --help."); else { -#ifdef __WIN__ +#ifdef _WIN32 puts("NT and Win32 specific options:\n" " --install Install the default service (NT).\n" " --install-manual Install the default service started manually (NT).\n" @@ -7759,7 +7759,7 @@ static int mysql_init_variables(void) #endif /* ! EMBEDDED_LIBRARY */ #endif /* HAVE_OPENSSL */ -#if defined(__WIN__) +#if defined(_WIN32) /* Allow Win32 users to move MySQL anywhere */ { char prg_dev[LIBLEN]; diff --git a/sql/mysqld.h b/sql/mysqld.h index ff7060425cb..5356fd967c7 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -697,7 +697,7 @@ void init_sql_statement_info(); void init_com_statement_info(); #endif /* HAVE_PSI_STATEMENT_INTERFACE */ -#ifndef __WIN__ +#ifndef _WIN32 extern pthread_t signal_thread; #endif diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 409d3cac85e..8b0f1eed46d 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -92,7 +92,7 @@ static void inline MYSQL_SERVER_my_error(...) {} the client should have a bigger max_allowed_packet. */ -#if defined(__WIN__) || !defined(MYSQL_SERVER) +#if defined(_WIN32) || !defined(MYSQL_SERVER) /* The following is because alarms doesn't work on windows. */ #ifndef NO_ALARM #define NO_ALARM @@ -167,7 +167,7 @@ my_bool my_net_init(NET *net, Vio *vio, void *thd, uint my_flags) { /* For perl DBI/DBD. */ net->fd= vio_fd(vio); -#if defined(MYSQL_SERVER) && !defined(__WIN__) +#if defined(MYSQL_SERVER) && !defined(_WIN32) if (!(test_flags & TEST_BLOCKING)) { my_bool old_mode; @@ -279,7 +279,7 @@ static int net_data_is_ready(my_socket sd) struct timeval tv; int res; -#ifndef __WIN__ +#ifndef _WIN32 /* Windows uses an _array_ of 64 fd's as default, so it's safe */ if (sd >= FD_SETSIZE) return -1; @@ -710,7 +710,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) if ((long) (length= vio_write(net->vio,pos,(size_t) (end-pos))) <= 0) { my_bool interrupted = vio_should_retry(net->vio); -#if !defined(__WIN__) +#if !defined(_WIN32) if ((interrupted || length == 0) && !thr_alarm_in_use(&alarmed)) { if (!thr_alarm(&alarmed, net->write_timeout, &alarm_buff)) @@ -733,7 +733,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) } } else -#endif /* !defined(__WIN__) */ +#endif /* !defined(_WIN32) */ if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) && interrupted) { @@ -758,7 +758,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) pos+=length; update_statistics(thd_increment_bytes_sent(net->thd, length)); } -#ifndef __WIN__ +#ifndef _WIN32 end: #endif #ifdef HAVE_COMPRESS @@ -1005,7 +1005,7 @@ retry: goto end; } -#if !defined(__WIN__) && defined(MYSQL_SERVER) +#if !defined(_WIN32) && defined(MYSQL_SERVER) /* We got an error that there was no data on the socket. We now set up an alarm to not 'read forever', change the socket to the blocking @@ -1037,7 +1037,7 @@ retry: continue; } } -#endif /* (!defined(__WIN__) && defined(MYSQL_SERVER) */ +#endif /* (!defined(_WIN32) && defined(MYSQL_SERVER) */ if (thr_alarm_in_use(&alarmed) && !thr_got_alarm(&alarmed) && interrupted) { /* Probably in MIT threads */ diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 7b3cfefa377..f233f8a3a82 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -24,7 +24,7 @@ #include "sql_class.h" #include "my_stacktrace.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #define SIGNAL_FMT "exception 0x%x" #else @@ -346,7 +346,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) #endif end: -#ifndef __WIN__ +#ifndef _WIN32 /* Quit, without running destructors (etc.) Use a signal, because the parent (systemd) can check that with WIFSIGNALED diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 160ca1f5f2f..6845fe80445 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -54,7 +54,7 @@ #include "sql_table.h" // build_table_filename #include "datadict.h" // dd_frm_is_view() #include "rpl_rli.h" // rpl_group_info -#ifdef __WIN__ +#ifdef _WIN32 #include #endif #include "wsrep_mysqld.h" diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 017ae3c5eff..1d27854dc82 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1851,7 +1851,7 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, } #define SECONDS_TO_WAIT_FOR_KILL 2 -#if !defined(__WIN__) && defined(HAVE_SELECT) +#if !defined(_WIN32) && defined(HAVE_SELECT) /* my_sleep() can wait for sub second times */ #define WAIT_FOR_KILL_TRY_TIMES 20 #else diff --git a/sql/sql_class.h b/sql/sql_class.h index 3f748c6a206..0f85da68c8e 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3033,7 +3033,7 @@ public: } default_transaction, *transaction; Global_read_lock global_read_lock; Field *dup_field; -#ifndef __WIN__ +#ifndef _WIN32 sigset_t signals; #endif #ifdef SIGNAL_WITH_VIO_CLOSE diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index 1da8c42d96e..31297782f30 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -23,7 +23,7 @@ #include "mariadb.h" #include "mysqld.h" #include "sql_priv.h" -#ifndef __WIN__ +#ifndef _WIN32 #include // getservbyname, servent #endif #include "sql_audit.h" diff --git a/sql/sql_const.h b/sql/sql_const.h index 762728aa876..bcc556e61f9 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -297,19 +297,6 @@ */ #define MAX_TIME_ZONE_NAME_LENGTH (NAME_LEN + 1) -#if defined(__WIN__) - -#define INTERRUPT_PRIOR -2 -#define CONNECT_PRIOR -1 -#define WAIT_PRIOR 0 -#define QUERY_PRIOR 2 -#else -#define INTERRUPT_PRIOR 10 -#define CONNECT_PRIOR 9 -#define WAIT_PRIOR 8 -#define QUERY_PRIOR 6 -#endif /* __WIN92__ */ - #define SP_PSI_STATEMENT_INFO_COUNT 19 #endif /* SQL_CONST_INCLUDED */ diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 090b87af4ff..37e136927f2 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -44,7 +44,7 @@ #include #include #include "log.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #endif #include "debug.h" // debug_crash_here diff --git a/sql/sql_load.cc b/sql/sql_load.cc index b144d2afda4..0e3cdaac569 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -567,7 +567,7 @@ int mysql_load(THD *thd, const sql_exchange *ex, TABLE_LIST *table_list, DBUG_RETURN(TRUE); } -#if !defined(__WIN__) && ! defined(__NETWARE__) +#if !defined(_WIN32) MY_STAT stat_info; if (!my_stat(name, &stat_info, MYF(MY_WME))) DBUG_RETURN(TRUE); diff --git a/sql/sql_partition.cc b/sql/sql_partition.cc index 397b8a8a350..d7bb02bbd4e 100644 --- a/sql/sql_partition.cc +++ b/sql/sql_partition.cc @@ -2183,7 +2183,7 @@ static int add_keyword_path(String *str, const char *keyword, { char temp_path[FN_REFLEN]; strcpy(temp_path, path); -#ifdef __WIN__ +#ifdef _WIN32 /* Convert \ to / to be able to create table on unix */ char *pos, *end; size_t length= strlen(temp_path); diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 61cf204d721..c7a93a72a99 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1959,7 +1959,7 @@ static bool plugin_load_list(MEM_ROOT *tmp_root, const char *list) list= NULL; /* terminate the loop */ /* fall through */ case ';': -#ifndef __WIN__ +#ifndef _WIN32 case ':': /* can't use this as delimiter as it may be drive letter */ #endif p[-1]= 0; diff --git a/sql/sql_profile.cc b/sql/sql_profile.cc index d8ecd2abee7..f576e693a0e 100644 --- a/sql/sql_profile.cc +++ b/sql/sql_profile.cc @@ -610,7 +610,7 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond table->field[9]->store((uint32)(entry->rusage.ru_oublock - previous->rusage.ru_oublock)); table->field[9]->set_notnull(); -#elif defined(__WIN__) +#elif defined(_WIN32) ULONGLONG reads_delta = entry->io_count.ReadOperationCount - previous->io_count.ReadOperationCount; ULONGLONG writes_delta = entry->io_count.WriteOperationCount - @@ -643,7 +643,7 @@ int PROFILING::fill_statistics_info(THD *thd_arg, TABLE_LIST *tables, Item *cond table->field[13]->store((uint32)(entry->rusage.ru_minflt - previous->rusage.ru_minflt), true); table->field[13]->set_notnull(); -#elif defined(__WIN__) +#elif defined(_WIN32) /* Windows APIs don't easily distinguish between hard and soft page faults, so we just fill the 'major' column and leave the second NULL. */ diff --git a/sql/sql_profile.h b/sql/sql_profile.h index 85018a2598b..881365596ed 100644 --- a/sql/sql_profile.h +++ b/sql/sql_profile.h @@ -46,7 +46,7 @@ int make_profile_table_for_show(THD *thd, ST_SCHEMA_TABLE *schema_table); #include "sql_priv.h" #include "unireg.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 193e6beffba..53c5f6d741d 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1651,7 +1651,7 @@ static void append_directory(THD *thd, String *packet, LEX_CSTRING *dir_type, packet->append(' '); packet->append(dir_type); packet->append(STRING_WITH_LEN(" DIRECTORY='")); -#ifdef __WIN__ +#ifdef _WIN32 /* Convert \ to / to be able to create table on unix */ char *winfilename= (char*) thd->memdup(filename, length); char *pos, *end; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index cd48f58da10..e637d680973 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -59,7 +59,7 @@ #include "debug.h" // debug_crash_here() #include -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 73fefeead50..fa4e769232d 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3031,7 +3031,7 @@ static Sys_var_ulonglong Sys_thread_stack( static Sys_var_charptr_fscs Sys_tmpdir( "tmpdir", "Path for temporary files. Several paths may " "be specified, separated by a " -#if defined(__WIN__) +#if defined(_WIN32) "semicolon (;)" #else "colon (:)" diff --git a/sql/udf_example.c b/sql/udf_example.c index cb3f3ad1c98..14c793ee98a 100644 --- a/sql/udf_example.c +++ b/sql/udf_example.c @@ -122,13 +122,13 @@ #include #include #include -#ifdef __WIN__ +#ifdef _WIN32 typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */ typedef __int64 longlong; #else typedef unsigned long long ulonglong; typedef long long longlong; -#endif /*__WIN__*/ +#endif /*_WIN32*/ #else #include "mariadb.h" #include @@ -700,7 +700,7 @@ longlong udf_sequence(UDF_INIT *initid __attribute__((unused)), UDF_ARGS *args, ** ****************************************************************************/ -#ifdef __WIN__ +#ifdef _WIN32 #include #else #include diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 1cce8259d5c..57c1885b777 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -729,7 +729,7 @@ static int sst_append_env_var(wsp::env& env, return -env.error(); } -#ifdef __WIN__ +#ifdef _WIN32 /* Space, single quote, ampersand, backquote, I/O redirection characters, caret, all brackets, plus, exclamation and comma @@ -803,7 +803,7 @@ static size_t estimate_cmd_len (bool* extra_args) else if (IS_REQ_ESCAPING(c)) { cmd_len++; -#ifdef __WIN__ +#ifdef _WIN32 quotation= true; #endif } @@ -832,7 +832,7 @@ static size_t estimate_cmd_len (bool* extra_args) else if (IS_REQ_ESCAPING(c)) { cmd_len++; -#ifdef __WIN__ +#ifdef _WIN32 quotation= true; #endif } @@ -888,7 +888,7 @@ static void copy_orig_argv (char* cmd_str) else if (IS_REQ_ESCAPING(c)) { plain= false; -#ifdef __WIN__ +#ifdef _WIN32 quotation= true; #endif } @@ -928,7 +928,7 @@ static void copy_orig_argv (char* cmd_str) c = *arg++; if (IS_REQ_ESCAPING(c)) { -#ifdef __WIN__ +#ifdef _WIN32 *cmd_str++ = c; #else *cmd_str++ = '\\'; @@ -968,7 +968,7 @@ static void copy_orig_argv (char* cmd_str) else if (IS_REQ_ESCAPING(c)) { plain= false; -#ifdef __WIN__ +#ifdef _WIN32 quotation= true; #endif } @@ -999,7 +999,7 @@ static void copy_orig_argv (char* cmd_str) { if (IS_REQ_ESCAPING(c)) { -#ifdef __WIN__ +#ifdef _WIN32 *cmd_str++ = c; #else *cmd_str++ = '\\'; diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index a41ed86371d..a2cd035d336 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -82,6 +82,7 @@ ELSE(NOT UNIX) # Connect does not work with clang-cl RETURN() ENDIF() + add_definitions(-D__WIN__) ENDIF(UNIX) diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index bea741fa7b2..99513d70950 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1466,7 +1466,7 @@ static void fill_server(MEM_ROOT *mem_root, FEDERATEDX_SERVER *server, database.length(my_casedn_str(system_charset_info, database.c_ptr_safe())); } -#ifndef __WIN__ +#ifndef _WIN32 /* TODO: there is no unix sockets under windows so the engine should be revised about using sockets in such environment. diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c index 670f628a2d5..5469784c8c1 100644 --- a/storage/heap/hp_write.c +++ b/storage/heap/hp_write.c @@ -17,7 +17,7 @@ /* Write a record to heap-databas */ #include "heapdef.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index eb0b04c55fa..1a95de2b045 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -256,7 +256,7 @@ buf_dump( #ifdef _WIN32 /* use my_fopen() for correct permissions during bootstrap*/ f = my_fopen(tmp_filename, O_RDWR|O_TRUNC|O_CREAT, 0); -#elif defined(__GLIBC__) || defined(__WIN__) || O_CLOEXEC == 0 +#elif defined(__GLIBC__) || O_CLOEXEC == 0 f = fopen(tmp_filename, "w" STR_O_CLOEXEC); #else { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 5f7bef3ae70..53c7eae7c09 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -13294,7 +13294,7 @@ inline int ha_innobase::delete_table(const char* name, enum_sql_command sqlcom) if (is_part) { char par_case_name[FN_REFLEN]; -#ifndef __WIN__ +#ifndef _WIN32 /* Check for the table using lower case name, including the partition separator "P" */ diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index 05289c05c86..5bfed89b6d7 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -487,7 +487,7 @@ it is read or written. */ # define UNIV_PREFETCH_RW(addr) ((void) 0) # endif /* COMPILER_HINTS */ -# elif defined __WIN__ && defined COMPILER_HINTS +# elif defined _WIN32 && defined COMPILER_HINTS # include # define UNIV_EXPECT(expr,value) (expr) # define UNIV_LIKELY_NULL(expr) (expr) diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 1ad3cbf7a68..3b365bd86a2 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -3749,11 +3749,11 @@ row_rename_table_for_mysql( /* We look for pattern #P# to see if the table is partitioned MySQL table. */ -#ifdef __WIN__ +#ifdef _WIN32 is_part = strstr((char *)old_name, (char *)"#p#"); #else is_part = strstr((char *)old_name, (char *)"#P#"); -#endif /* __WIN__ */ +#endif /* _WIN32 */ /* MariaDB partition engine hard codes the file name separator as "#P#" and "#SP#". The text case is fixed even if @@ -3773,7 +3773,7 @@ row_rename_table_for_mysql( case them in the system table. */ if (!table && is_part && lower_case_table_names == 1) { char par_case_name[MAX_FULL_NAME_LEN + 1]; -#ifndef __WIN__ +#ifndef _WIN32 /* Check for the table using lower case name, including the partition separator "P" */ diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c index cd679a1c80f..728b574c98c 100644 --- a/storage/maria/aria_chk.c +++ b/storage/maria/aria_chk.c @@ -505,7 +505,7 @@ static void usage(void) maria_chk very silent.\n\ -t, --tmpdir=path Path for temporary files. Multiple paths can be\n\ specified, separated by "); -#if defined( __WIN__) || defined(__NETWARE__) +#if defined( _WIN32) printf("semicolon (;)"); #else printf("colon (:)"); diff --git a/storage/maria/aria_dump_log.c b/storage/maria/aria_dump_log.c index 8e065e9ff9d..17af368c424 100644 --- a/storage/maria/aria_dump_log.c +++ b/storage/maria/aria_dump_log.c @@ -19,7 +19,7 @@ extern void translog_example_table_init(); static const char *load_default_groups[]= { "aria_dump_log",0 }; static void get_options(int *argc,char * * *argv); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) const char *default_dbug_option= "d:t:i:O,\\aria_dump_log.trace"; #else const char *default_dbug_option= "d:t:i:o,/tmp/aria_dump_log.trace"; diff --git a/storage/maria/aria_read_log.c b/storage/maria/aria_read_log.c index 51bfa879702..c0c76ed5590 100644 --- a/storage/maria/aria_read_log.c +++ b/storage/maria/aria_read_log.c @@ -24,7 +24,7 @@ static const char *load_default_groups[]= { "aria_read_log",0 }; static void get_options(int *argc,char * * *argv); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) const char *default_dbug_option= "d:t:O,\\aria_read_log.trace"; #else const char *default_dbug_option= "d:t:o,/tmp/aria_read_log.trace"; @@ -273,7 +273,7 @@ static struct my_option my_long_options[] = 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"tmpdir", 't', "Path for temporary files. Multiple paths can be specified, " "separated by " -#if defined( __WIN__) || defined(__NETWARE__) +#if defined( _WIN32) "semicolon (;)" #else "colon (:)" diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c index 65b8b0922aa..d71f92c2eac 100644 --- a/storage/maria/ma_control_file.c +++ b/storage/maria/ma_control_file.c @@ -226,7 +226,7 @@ static int lock_control_file(const char *name, my_bool do_retry) @todo BUG We should explore my_sopen(_SH_DENYWRD) to open or create the file under Windows. */ -#ifndef __WIN__ +#ifndef _WIN32 uint retry= 0; uint retry_count= do_retry ? MARIA_MAX_CONTROL_FILE_LOCK_RETRY : 0; @@ -581,7 +581,7 @@ int ma_control_file_end(void) if (control_file_fd < 0) /* already closed */ DBUG_RETURN(0); -#ifndef __WIN__ +#ifndef _WIN32 (void) my_lock(control_file_fd, F_UNLCK, 0L, F_TO_EOF, MYF(MY_SEEK_NOT_DONE | MY_FORCE_LOCK)); #endif diff --git a/storage/maria/ma_create.c b/storage/maria/ma_create.c index a7ade46f8a4..df189c61043 100644 --- a/storage/maria/ma_create.c +++ b/storage/maria/ma_create.c @@ -23,12 +23,8 @@ #include "trnman.h" #include "ma_crypt.h" -#if defined(MSDOS) || defined(__WIN__) -#ifdef __WIN__ +#ifdef _WIN32 #include -#else -#include /* Prototype for getpid */ -#endif #endif #include diff --git a/storage/maria/ma_info.c b/storage/maria/ma_info.c index f0b04e020c2..f31113d8384 100644 --- a/storage/maria/ma_info.c +++ b/storage/maria/ma_info.c @@ -16,7 +16,7 @@ /* Return useful base information for an open table */ #include "maria_def.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/storage/maria/ma_locking.c b/storage/maria/ma_locking.c index 200a728626f..d8f815b2a50 100644 --- a/storage/maria/ma_locking.c +++ b/storage/maria/ma_locking.c @@ -220,7 +220,7 @@ int maria_lock_database(MARIA_HA *info, int lock_type) break; /* Impossible */ } } -#ifdef __WIN__ +#ifdef _WIN32 else { /* @@ -320,7 +320,7 @@ int _ma_writeinfo(register MARIA_HA *info, uint operation) &share->state, MA_STATE_INFO_WRITE_DONT_MOVE_OFFSET))) olderror=my_errno; -#ifdef __WIN__ +#ifdef _WIN32 if (maria_flush) { _commit(share->kfile.file); diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index e2956d7ca3c..11bdd68fc03 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -29,7 +29,7 @@ Also there is no need to flush filesystem changes ,i.e to sync() directories. */ -#ifdef __WIN__ +#ifdef _WIN32 #define sync_dir(A,B) 0 #else #define sync_dir(A,B) mysql_file_sync(A,B) @@ -3673,7 +3673,7 @@ my_bool translog_init_with_table(const char *directory, /* Directory to store files */ unpack_dirname(log_descriptor.directory, directory); -#ifndef __WIN__ +#ifndef _WIN32 if ((log_descriptor.directory_fd= my_open(log_descriptor.directory, O_RDONLY, MYF(MY_WME))) < 0) { diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c index 49fd0dcc7af..f84f0b8e938 100644 --- a/storage/maria/ma_open.c +++ b/storage/maria/ma_open.c @@ -26,12 +26,8 @@ #include "ma_crypt.h" #include "s3_func.h" -#if defined(MSDOS) || defined(__WIN__) -#ifdef __WIN__ +#ifdef _WIN32 #include -#else -#include /* Prototype for getpid */ -#endif #endif static void setup_key_functions(MARIA_KEYDEF *keyinfo); diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index bf646115bd9..986cacddf0c 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -589,7 +589,7 @@ static my_thread_id pagecache_thread_id; ((uint) (((char*)(h)-(char *) p->hash_link_root)/ \ sizeof(PAGECACHE_HASH_LINK))) -#if (defined(PAGECACHE_TIMEOUT) && !defined(__WIN__)) || defined(PAGECACHE_DEBUG) +#if (defined(PAGECACHE_TIMEOUT) && !defined(_WIN32)) || defined(PAGECACHE_DEBUG) static int pagecache_pthread_cond_wait(mysql_cond_t *cond, mysql_mutex_t *mutex); #else @@ -5561,7 +5561,7 @@ static void pagecache_dump(PAGECACHE *pagecache) #endif /* defined(PAGECACHE_TIMEOUT) */ -#if defined(PAGECACHE_TIMEOUT) && !defined(__WIN__) +#if defined(PAGECACHE_TIMEOUT) && !defined(_WIN32) static int pagecache_pthread_cond_wait(mysql_cond_t *cond, @@ -5623,7 +5623,7 @@ static int pagecache_pthread_cond_wait(mysql_cond_t *cond, return rc; } #endif -#endif /* defined(PAGECACHE_TIMEOUT) && !defined(__WIN__) */ +#endif /* defined(PAGECACHE_TIMEOUT) && !defined(_WIN32) */ #if defined(PAGECACHE_DEBUG) diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c index 8153ec701a0..b9d6fffda86 100644 --- a/storage/maria/ma_sort.c +++ b/storage/maria/ma_sort.c @@ -20,7 +20,7 @@ #include "ma_fulltext.h" #include -#if defined(MSDOS) || defined(__WIN__) +#if defined(_WIN32) #include #else #include diff --git a/storage/maria/unittest/ma_pagecache_consist.c b/storage/maria/unittest/ma_pagecache_consist.c index 29fa29ca035..ff4a2bcb33a 100644 --- a/storage/maria/unittest/ma_pagecache_consist.c +++ b/storage/maria/unittest/ma_pagecache_consist.c @@ -339,7 +339,7 @@ int main(int argc __attribute__((unused)), MY_INIT(argv[0]); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\test_pagecache_consist.trace"; #else default_dbug_option= "d:t:i:o,/tmp/test_pagecache_consist.trace"; diff --git a/storage/maria/unittest/ma_pagecache_rwconsist.c b/storage/maria/unittest/ma_pagecache_rwconsist.c index a3303eb65a4..24c30245bac 100644 --- a/storage/maria/unittest/ma_pagecache_rwconsist.c +++ b/storage/maria/unittest/ma_pagecache_rwconsist.c @@ -210,7 +210,7 @@ int main(int argc __attribute__((unused)), MY_INIT(argv[0]); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\test_pagecache_consist.trace"; #else default_dbug_option= "d:t:i:O,/tmp/test_pagecache_consist.trace"; diff --git a/storage/maria/unittest/ma_pagecache_rwconsist2.c b/storage/maria/unittest/ma_pagecache_rwconsist2.c index 2a0f76b478f..c92bec3ca41 100644 --- a/storage/maria/unittest/ma_pagecache_rwconsist2.c +++ b/storage/maria/unittest/ma_pagecache_rwconsist2.c @@ -206,7 +206,7 @@ int main(int argc __attribute__((unused)), MY_INIT(argv[0]); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\test_pagecache_consist.trace"; #else default_dbug_option= "d:t:i:O,/tmp/test_pagecache_consist.trace"; diff --git a/storage/maria/unittest/ma_pagecache_single.c b/storage/maria/unittest/ma_pagecache_single.c index 4cd62c52d86..c4e2c53d235 100644 --- a/storage/maria/unittest/ma_pagecache_single.c +++ b/storage/maria/unittest/ma_pagecache_single.c @@ -730,7 +730,7 @@ int main(int argc __attribute__((unused)), MY_INIT(argv[0]); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\test_pagecache_single.trace"; #else default_dbug_option= "d:t:i:o,/tmp/test_pagecache_single.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler-t.c b/storage/maria/unittest/ma_test_loghandler-t.c index 198ea5b2afb..ccda66af755 100644 --- a/storage/maria/unittest/ma_test_loghandler-t.c +++ b/storage/maria/unittest/ma_test_loghandler-t.c @@ -185,7 +185,7 @@ int main(int argc __attribute__((unused)), char *argv[]) bzero(long_tr_id, 6); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c index 8806571cabf..21f6b7d7b44 100644 --- a/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c +++ b/storage/maria/unittest/ma_test_loghandler_first_lsn-t.c @@ -54,7 +54,7 @@ int main(int argc __attribute__((unused)), char *argv[]) bzero(long_tr_id, 6); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c index 65b926376ae..391d785159a 100644 --- a/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c +++ b/storage/maria/unittest/ma_test_loghandler_max_lsn-t.c @@ -52,7 +52,7 @@ int main(int argc __attribute__((unused)), char *argv[]) bzero(long_tr_id, 6); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler_multithread-t.c b/storage/maria/unittest/ma_test_loghandler_multithread-t.c index cb4d2bc70ba..ec097ede036 100644 --- a/storage/maria/unittest/ma_test_loghandler_multithread-t.c +++ b/storage/maria/unittest/ma_test_loghandler_multithread-t.c @@ -292,7 +292,7 @@ int main(int argc __attribute__((unused)), long_buffer[i]= (i & 0xFF); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler_noflush-t.c b/storage/maria/unittest/ma_test_loghandler_noflush-t.c index 3aafe5db9b4..46b3a8e71aa 100644 --- a/storage/maria/unittest/ma_test_loghandler_noflush-t.c +++ b/storage/maria/unittest/ma_test_loghandler_noflush-t.c @@ -53,7 +53,7 @@ int main(int argc __attribute__((unused)), char *argv[]) bzero(long_tr_id, 6); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c index 913bd4ef5b6..b95d8bee24c 100644 --- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c +++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c @@ -54,7 +54,7 @@ int main(int argc __attribute__((unused)), char *argv[]) bzero(long_tr_id, 6); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c index f09a78e5fa8..892a773b475 100644 --- a/storage/maria/unittest/ma_test_loghandler_pagecache-t.c +++ b/storage/maria/unittest/ma_test_loghandler_pagecache-t.c @@ -57,7 +57,7 @@ int main(int argc __attribute__((unused)), char *argv[]) bzero(long_tr_id, 6); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler_pagecache.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler_pagecache.trace"; diff --git a/storage/maria/unittest/ma_test_loghandler_purge-t.c b/storage/maria/unittest/ma_test_loghandler_purge-t.c index e1eeca2fc9b..07b50f197de 100644 --- a/storage/maria/unittest/ma_test_loghandler_purge-t.c +++ b/storage/maria/unittest/ma_test_loghandler_purge-t.c @@ -55,7 +55,7 @@ int main(int argc __attribute__((unused)), char *argv[]) bzero(long_tr_id, 6); #ifndef DBUG_OFF -#if defined(__WIN__) +#if defined(_WIN32) default_dbug_option= "d:t:i:O,\\ma_test_loghandler.trace"; #else default_dbug_option= "d:t:i:o,/tmp/ma_test_loghandler.trace"; diff --git a/storage/maria/unittest/test_file.c b/storage/maria/unittest/test_file.c index 8c9a5f66a2f..853f5352fca 100644 --- a/storage/maria/unittest/test_file.c +++ b/storage/maria/unittest/test_file.c @@ -44,7 +44,7 @@ int test_file(PAGECACHE_FILE file, char *file_name, int step= 0; int res= 1; /* ok */ -#ifdef __WIN__ +#ifdef _WIN32 /* On Windows, the info returned by stat(), specifically file length is not necessarily current, because this is the behavior of diff --git a/storage/myisam/mi_create.c b/storage/myisam/mi_create.c index 51354e0e8b5..140d8abe26f 100644 --- a/storage/myisam/mi_create.c +++ b/storage/myisam/mi_create.c @@ -21,7 +21,7 @@ #include "sp_defs.h" #include -#ifdef __WIN__ +#ifdef _WIN32 #include #endif #include diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 67cb714e7bf..4f3326098f6 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -279,51 +279,6 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) mi_print_error(info->s, HA_ERR_CRASHED); mi_mark_crashed(info); /* Fatal error found */ } -#ifdef __WIN__REMOVE_OBSOLETE_WORKAROUND - /* Close the isam and data files as Win32 can't drop an open table */ - if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) - { - info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED); - error=end_io_cache(&info->rec_cache); - } - if (info->lock_type != F_UNLCK && ! info->was_locked) - { - info->was_locked=info->lock_type; - if (mi_lock_database(info,F_UNLCK)) - error=my_errno; - info->lock_type = F_UNLCK; - } - if (share->kfile >= 0) - { - /* - We don't need to call _mi_decrement_open_count() if we are - dropping the table, as the files will be removed anyway. If we - are aborted before the files is removed, it's better to not - call it as in that case the automatic repair on open will add - the missing index entries - */ - if (function != HA_EXTRA_PREPARE_FOR_DROP) - _mi_decrement_open_count(info); - if (mysql_file_close(share->kfile,MYF(0))) - error=my_errno; - } - { - LIST *list_element ; - for (list_element=myisam_open_list ; - list_element ; - list_element=list_element->next) - { - MI_INFO *tmpinfo=(MI_INFO*) list_element->data; - if (tmpinfo->s == info->s) - { - if (tmpinfo->dfile >= 0 && mysql_file_close(tmpinfo->dfile, MYF(0))) - error = my_errno; - tmpinfo->dfile= -1; - } - } - } - share->kfile= -1; /* Files aren't open anymore */ -#endif mysql_mutex_unlock(&share->intern_lock); mysql_mutex_unlock(&THR_LOCK_myisam); break; diff --git a/storage/myisam/mi_info.c b/storage/myisam/mi_info.c index 50cb5439472..9e1a5e416de 100644 --- a/storage/myisam/mi_info.c +++ b/storage/myisam/mi_info.c @@ -17,7 +17,7 @@ /* Return useful base information for an open table */ #include "myisamdef.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/storage/myisam/mi_log.c b/storage/myisam/mi_log.c index 9b8405d0a9c..bc9607fb342 100644 --- a/storage/myisam/mi_log.c +++ b/storage/myisam/mi_log.c @@ -19,7 +19,7 @@ */ #include "myisamdef.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c index 3db424ea997..b80c2b69f16 100644 --- a/storage/myisam/mi_open.c +++ b/storage/myisam/mi_open.c @@ -33,7 +33,7 @@ #include #include -#ifdef __WIN__ +#ifdef _WIN32 #include #endif diff --git a/storage/myisam/myisamchk.c b/storage/myisam/myisamchk.c index 18b729a3d6f..a5777527e54 100644 --- a/storage/myisam/myisamchk.c +++ b/storage/myisam/myisamchk.c @@ -356,7 +356,7 @@ static void usage(void) -?, --help Display this help and exit.\n\ -t, --tmpdir=path Path for temporary files. Multiple paths can be\n\ specified, separated by "); -#if defined( __WIN__) +#if defined( _WIN32) printf("semicolon (;)"); #else printf("colon (:)"); diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 6fe38a3fd04..fe0c0f8f02e 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -19,7 +19,7 @@ */ #include "fulltext.h" -#if defined(__WIN__) +#if defined(_WIN32) #include #else #include diff --git a/storage/rocksdb/ut0counter.h b/storage/rocksdb/ut0counter.h index 3a7ee85d01c..7b1885810c3 100644 --- a/storage/rocksdb/ut0counter.h +++ b/storage/rocksdb/ut0counter.h @@ -28,7 +28,7 @@ Created 2012/04/12 by Sunny Bains /** Default number of slots to use in ib_counter_t */ #define IB_N_SLOTS 64 -#ifdef __WIN__ +#ifdef _WIN32 #define get_curr_thread_id() GetCurrentThreadId() #else #define get_curr_thread_id() pthread_self() diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index e2f1909e8e2..3c5b23f559f 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -39,7 +39,7 @@ #include #include // include client for INSERT table (sort of redoing federated..) -#ifndef __WIN__ +#ifndef _WIN32 // UNIX-specific #include #include @@ -959,7 +959,7 @@ static char * sphDup ( const char * sSrc, int iLen=-1 ) static void sphLogError ( const char * sFmt, ... ) { // emit timestamp -#ifdef __WIN__ +#ifdef _WIN32 SYSTEMTIME t; GetLocalTime ( &t ); @@ -983,7 +983,7 @@ static void sphLogError ( const char * sFmt, ... ) fprintf ( stderr, "%02d%02d%02d %2d:%02d:%02d SphinxSE: internal error: ", pParsed->tm_year % 100, pParsed->tm_mon + 1, pParsed->tm_mday, pParsed->tm_hour, pParsed->tm_min, pParsed->tm_sec); -#endif // __WIN__ +#endif // _WIN32 // emit message va_list ap; @@ -1194,7 +1194,7 @@ static CSphSEShare * get_share ( const char * table_name, TABLE * table ) #if MYSQL_VERSION_ID>=50120 pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const uchar *) table_name, strlen(table_name) ); #else -#ifdef __WIN__ +#ifdef _WIN32 pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, (const byte *) table_name, strlen(table_name) ); #else pShare = (CSphSEShare*) sphinx_hash_search ( &sphinx_open_tables, table_name, strlen(table_name) ); @@ -2128,7 +2128,7 @@ int ha_sphinx::open ( const char * name, int, uint ) int ha_sphinx::Connect ( const char * sHost, ushort uPort ) { struct sockaddr_in sin; -#ifndef __WIN__ +#ifndef _WIN32 struct sockaddr_un saun; #endif @@ -2197,7 +2197,7 @@ int ha_sphinx::Connect ( const char * sHost, ushort uPort ) } } else { -#ifndef __WIN__ +#ifndef _WIN32 iDomain = AF_UNIX; iSockaddrSize = sizeof(saun); pSockaddr = (struct sockaddr *) &saun; diff --git a/storage/sphinx/snippets_udf.cc b/storage/sphinx/snippets_udf.cc index ab2764407d8..8b87d9dce04 100644 --- a/storage/sphinx/snippets_udf.cc +++ b/storage/sphinx/snippets_udf.cc @@ -17,7 +17,7 @@ #include #include -#ifndef __WIN__ +#ifndef _WIN32 #include #include #else @@ -91,7 +91,7 @@ void sphUnalignedWrite ( void * pPtr, const T & tVal ) #define SafeDeleteArray(_arg) { if ( _arg ) delete [] ( _arg ); (_arg) = NULL; } #define Min(a,b) ((a)<(b)?(a):(b)) -#ifndef __WIN__ +#ifndef _WIN32 typedef unsigned int DWORD; #endif inline DWORD sphF2DW ( float f ) { union { float f; uint32 d; } u; u.f = f; return u.d; } @@ -361,7 +361,7 @@ bool CSphUrl::Parse ( const char * sUrl, int iLen ) int CSphUrl::Connect() { struct sockaddr_in sin; -#ifndef __WIN__ +#ifndef _WIN32 struct sockaddr_un saun; #endif @@ -428,7 +428,7 @@ int CSphUrl::Connect() } } else { -#ifndef __WIN__ +#ifndef _WIN32 iDomain = AF_UNIX; iSockaddrSize = sizeof(saun); pSockaddr = (struct sockaddr *) &saun; diff --git a/storage/spider/hs_client/auto_addrinfo.hpp b/storage/spider/hs_client/auto_addrinfo.hpp index 5262ad11d4a..26e5dee933e 100644 --- a/storage/spider/hs_client/auto_addrinfo.hpp +++ b/storage/spider/hs_client/auto_addrinfo.hpp @@ -9,7 +9,7 @@ #ifndef DENA_AUTO_ADDRINFO_HPP #define DENA_AUTO_ADDRINFO_HPP -#ifndef __WIN__ +#ifndef _WIN32 #include #endif diff --git a/storage/spider/hs_client/auto_file.hpp b/storage/spider/hs_client/auto_file.hpp index ddd1f8c9196..44903f5fc4a 100644 --- a/storage/spider/hs_client/auto_file.hpp +++ b/storage/spider/hs_client/auto_file.hpp @@ -10,7 +10,7 @@ #define DENA_AUTO_FILE_HPP /* -#ifndef __WIN__ +#ifndef _WIN32 #include #endif */ diff --git a/storage/spider/hs_client/socket.cpp b/storage/spider/hs_client/socket.cpp index e4541ce7273..9a2ecddedd7 100644 --- a/storage/spider/hs_client/socket.cpp +++ b/storage/spider/hs_client/socket.cpp @@ -9,7 +9,7 @@ #include #include -#ifndef __WIN__ +#ifndef _WIN32 #include #include #endif @@ -43,7 +43,7 @@ namespace dena { void ignore_sigpipe() { -#if defined(SIGPIPE) && !defined(__WIN__) +#if defined(SIGPIPE) && !defined(_WIN32) if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) { fatal_abort("SIGPIPE SIG_IGN"); } @@ -80,7 +80,7 @@ socket_args::set(const config& conf) void socket_args::set_unix_domain(const char *path) { -#ifndef __WIN__ +#ifndef _WIN32 family = AF_UNIX; addr = sockaddr_storage(); addrlen = sizeof(sockaddr_un); @@ -112,7 +112,7 @@ socket_set_timeout(auto_file& fd, const socket_args& args, String& err_r) if (!args.nonblocking) { #if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) if (args.recv_timeout != 0) { -#ifndef __WIN__ +#ifndef _WIN32 struct timeval tv; tv.tv_sec = args.recv_timeout; tv.tv_usec = 0; @@ -120,7 +120,7 @@ socket_set_timeout(auto_file& fd, const socket_args& args, String& err_r) int tv = args.recv_timeout * 1000; #endif if (setsockopt(fd.get(), SOL_SOCKET, SO_RCVTIMEO, -#ifndef __WIN__ +#ifndef _WIN32 (const void *) &tv, #else (const char *) &tv, @@ -130,7 +130,7 @@ socket_set_timeout(auto_file& fd, const socket_args& args, String& err_r) } } if (args.send_timeout != 0) { -#ifndef __WIN__ +#ifndef _WIN32 struct timeval tv; tv.tv_sec = args.send_timeout; tv.tv_usec = 0; @@ -138,7 +138,7 @@ socket_set_timeout(auto_file& fd, const socket_args& args, String& err_r) int tv = args.send_timeout * 1000; #endif if (setsockopt(fd.get(), SOL_SOCKET, SO_SNDTIMEO, -#ifndef __WIN__ +#ifndef _WIN32 (const void *) &tv, #else (const char *) &tv, @@ -157,7 +157,7 @@ socket_set_options(auto_file& fd, const socket_args& args, String& err_r) { if (args.timeout != 0 && !args.nonblocking) { #if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) -#ifndef __WIN__ +#ifndef _WIN32 struct timeval tv; tv.tv_sec = args.timeout; tv.tv_usec = 0; @@ -165,7 +165,7 @@ socket_set_options(auto_file& fd, const socket_args& args, String& err_r) int tv = args.timeout * 1000; #endif if (setsockopt(fd.get(), SOL_SOCKET, SO_RCVTIMEO, -#ifndef __WIN__ +#ifndef _WIN32 (const void *) &tv, #else (const char *) &tv, @@ -173,14 +173,14 @@ socket_set_options(auto_file& fd, const socket_args& args, String& err_r) sizeof(tv)) != 0) { return errno_string("setsockopt SO_RCVTIMEO", errno, err_r); } -#ifndef __WIN__ +#ifndef _WIN32 tv.tv_sec = args.timeout; tv.tv_usec = 0; #else tv = args.timeout * 1000; #endif if (setsockopt(fd.get(), SOL_SOCKET, SO_SNDTIMEO, -#ifndef __WIN__ +#ifndef _WIN32 (const void *) &tv, #else (const char *) &tv, @@ -190,7 +190,7 @@ socket_set_options(auto_file& fd, const socket_args& args, String& err_r) } #endif } -#ifndef __WIN__ +#ifndef _WIN32 if (args.nonblocking && fcntl(fd.get(), F_SETFL, O_NONBLOCK) != 0) { return errno_string("fcntl O_NONBLOCK", errno, err_r); } @@ -198,7 +198,7 @@ socket_set_options(auto_file& fd, const socket_args& args, String& err_r) if (args.sndbuf != 0) { const int v = args.sndbuf; if (setsockopt(fd.get(), SOL_SOCKET, SO_SNDBUF, -#ifndef __WIN__ +#ifndef _WIN32 (const void *) &v, #else (const char *) &v, @@ -210,7 +210,7 @@ socket_set_options(auto_file& fd, const socket_args& args, String& err_r) if (args.rcvbuf != 0) { const int v = args.rcvbuf; if (setsockopt(fd.get(), SOL_SOCKET, SO_RCVBUF, -#ifndef __WIN__ +#ifndef _WIN32 (const void *) &v, #else (const char *) &v, @@ -242,7 +242,7 @@ socket_connect(auto_file& fd, const socket_args& args, String& err_r) if (connect(fd.get(), reinterpret_cast(&args.addr), args.addrlen) != 0) { if (!args.nonblocking -#ifndef __WIN__ +#ifndef _WIN32 || errno != EINPROGRESS #endif ) { @@ -260,7 +260,7 @@ socket_bind(auto_file& fd, const socket_args& args, String& err_r) return errno_string("socket", errno, err_r); } if (args.reuseaddr) { -#ifndef __WIN__ +#ifndef _WIN32 if (args.family == AF_UNIX) { const sockaddr_un *const ap = reinterpret_cast(&args.addr); @@ -271,7 +271,7 @@ socket_bind(auto_file& fd, const socket_args& args, String& err_r) #endif int v = 1; if (setsockopt(fd.get(), SOL_SOCKET, SO_REUSEADDR, -#ifndef __WIN__ +#ifndef _WIN32 (const void *) &v, #else (const char *) &v, @@ -279,7 +279,7 @@ socket_bind(auto_file& fd, const socket_args& args, String& err_r) sizeof(v)) != 0) { return errno_string("setsockopt SO_REUSEADDR", errno, err_r); } -#ifndef __WIN__ +#ifndef _WIN32 } #endif } @@ -290,7 +290,7 @@ socket_bind(auto_file& fd, const socket_args& args, String& err_r) if (listen(fd.get(), args.listen_backlog) != 0) { return errno_string("listen", errno, err_r); } -#ifndef __WIN__ +#ifndef _WIN32 if (args.nonblocking && fcntl(fd.get(), F_SETFL, O_NONBLOCK) != 0) { return errno_string("fcntl O_NONBLOCK", errno, err_r); } diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index aefca1fb3ee..8417e07a6b0 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -933,7 +933,7 @@ const char* my_strerror(char *buf, size_t len, int nr) this choice is not advertised, use the default (POSIX/XSI). Testing for __GNUC__ is not sufficient to determine whether this choice exists. */ -#if defined(__WIN__) +#if defined(_WIN32) strerror_s(buf, len, nr); #elif ((defined _POSIX_C_SOURCE && (_POSIX_C_SOURCE >= 200112L)) || \ (defined _XOPEN_SOURCE && (_XOPEN_SOURCE >= 600))) && \ diff --git a/tests/list_test.c b/tests/list_test.c index 42d4f962b19..6c915d470b7 100644 --- a/tests/list_test.c +++ b/tests/list_test.c @@ -14,7 +14,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -#ifdef __WIN__ +#ifdef _WIN32 #include #endif #include diff --git a/tests/nonblock-wrappers.h b/tests/nonblock-wrappers.h index 78851854442..19737c8d04a 100644 --- a/tests/nonblock-wrappers.h +++ b/tests/nonblock-wrappers.h @@ -22,7 +22,7 @@ Used to test the non-blocking calls using mysql_client_test. */ -#ifndef __WIN__ +#ifndef _WIN32 #include #else #include @@ -35,7 +35,7 @@ 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/tests/showdb_test.c b/tests/showdb_test.c index 267e32d51d7..e6b8989e36c 100644 --- a/tests/showdb_test.c +++ b/tests/showdb_test.c @@ -15,7 +15,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -#ifdef __WIN__ +#ifdef _WIN32 #include #endif #include diff --git a/tests/ssl_test.c b/tests/ssl_test.c index 6102fc7fd4e..d15d553b67a 100644 --- a/tests/ssl_test.c +++ b/tests/ssl_test.c @@ -15,7 +15,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ -#ifdef __WIN__ +#ifdef _WIN32 #include #endif #include diff --git a/tests/thread_test.c b/tests/thread_test.c index 0fa92d505a3..a40b4d20870 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -28,7 +28,7 @@ static pthread_mutex_t LOCK_thread_count; static char *database,*host,*user,*password,*unix_socket,*query; uint tcp_port; -#ifndef __WIN__ +#ifndef _WIN32 void *test_thread(void *arg __attribute__((unused))) #else unsigned __stdcall test_thread(void *arg __attribute__((unused))) diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c index 65608e0de05..86edea11411 100644 --- a/unittest/mytap/tap.c +++ b/unittest/mytap/tap.c @@ -345,7 +345,7 @@ int exit_status() return EXIT_SUCCESS; } -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(_WIN32) #include #else #include @@ -357,7 +357,7 @@ int exit_status() static ulong start_timer(void) { -#if defined(__WIN__) || defined(__NETWARE__) +#if defined(_WIN32) return clock(); #else struct tms tms_tmp; diff --git a/vio/viosocket.c b/vio/viosocket.c index f84d0e0738b..f63c76c9c79 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -25,7 +25,7 @@ */ #include "vio_priv.h" -#ifdef __WIN__ +#ifdef _WIN32 #include #include #include @@ -300,7 +300,7 @@ int vio_socket_shutdown(Vio *vio, int how) int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode) { int r= 0; -#if defined(__WIN__) || !defined(NO_FCNTL_NONBLOCK) +#if defined(_WIN32) || !defined(NO_FCNTL_NONBLOCK) my_socket sd= mysql_socket_getfd(vio->mysql_socket); #endif DBUG_ENTER("vio_blocking"); @@ -309,7 +309,7 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode) DBUG_PRINT("enter", ("set_blocking_mode: %d old_mode: %d", (int) set_blocking_mode, (int) *old_mode)); -#if !defined(__WIN__) +#if !defined(_WIN32) #if !defined(NO_FCNTL_NONBLOCK) if (sd >= 0) { @@ -331,7 +331,7 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode) #else r= set_blocking_mode ? 0 : 1; #endif /* !defined(NO_FCNTL_NONBLOCK) */ -#else /* !defined(__WIN__) */ +#else /* !defined(_WIN32) */ if (vio->type != VIO_TYPE_NAMEDPIPE) { ulong arg; @@ -351,7 +351,7 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode) } else r= MY_TEST(!(vio->fcntl_mode & O_NONBLOCK)) != set_blocking_mode; -#endif /* !defined(__WIN__) */ +#endif /* !defined(_WIN32) */ DBUG_PRINT("exit", ("%d", r)); DBUG_RETURN(r); }