diff --git a/include/ma_config_win.h b/include/ma_config_win.h deleted file mode 100644 index cd0b1ddf..00000000 --- a/include/ma_config_win.h +++ /dev/null @@ -1,280 +0,0 @@ -/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, - MA 02111-1307, USA */ - -/* Defines for Win32 to make it compatible for MySQL */ - -#ifndef _config_win_h_ -#define _config_win_h_ - -#include -#include -#include -#include /* Because of rint() */ -#include -#include -#include -#include -#include - -#ifndef THREAD - #define THREAD -#endif - -#ifdef _WIN64 -#define MACHINE_TYPE "ia64" /* Define to machine type name */ -#else -#define MACHINE_TYPE "i32" /* Define to machine type name */ -#endif /* _WIN64 */ - -/* File and lock constants */ -#define O_SHARE 0x1000 /* Open file in sharing mode */ -#ifdef __BORLANDC__ -#define F_RDLCK LK_NBLCK /* read lock */ -#define F_WRLCK LK_NBRLCK /* write lock */ -#define F_UNLCK LK_UNLCK /* remove lock(s) */ -#else -#define F_RDLCK _LK_NBLCK /* read lock */ -#define F_WRLCK _LK_NBRLCK /* write lock */ -#define F_UNLCK _LK_UNLCK /* remove lock(s) */ -#endif - -#define F_EXCLUSIVE 1 /* We have only exclusive locking */ -#define F_TO_EOF (INT_MAX32/2) /* size for lock of all file */ -#define F_OK 0 /* parameter to access() */ - -#define S_IROTH S_IREAD /* for my_lib */ - -#ifdef __BORLANDC__ -#define FILE_BINARY O_BINARY /* my_fopen in binary mode */ -#define O_TEMPORARY 0 -#define O_SHORT_LIVED 0 -#define SH_DENYNO _SH_DENYNO -#else -#define O_BINARY _O_BINARY /* compability with MSDOS */ -#define FILE_BINARY _O_BINARY /* my_fopen in binary mode */ -#define O_TEMPORARY _O_TEMPORARY -#define O_SHORT_LIVED _O_SHORT_LIVED -#define SH_DENYNO _SH_DENYNO -#endif -#define NO_OPEN_3 /* For my_create() */ - -#define SIGQUIT SIGTERM /* No SIGQUIT */ - -#undef _REENTRANT /* Crashes something for win32 */ -#undef SAFE_MUTEX /* Can't be used on windows */ - -#define LONGLONG_MIN ((__int64) 0x8000000000000000) -#define LONGLONG_MAX ((__int64) 0x7FFFFFFFFFFFFFFF) -#define LL(A) ((__int64) A) - -/* Type information */ - -typedef unsigned short ushort; -typedef unsigned int uint; -typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */ -typedef __int64 longlong; -typedef int sigset_t; -#define longlong_defined -/* off_t should not be __int64 because of conflicts in header files; - Use my_off_t or os_off_t instead */ -typedef long off_t; -typedef __int64 os_off_t; -#ifdef _WIN64 -typedef UINT_PTR rf_SetTimer; -#else -typedef uint rf_SetTimer; -#endif - -#if (defined(_MSC_VER) && !(_MSC_VER < 1800)) -#define HAVE_STRTOULL 1 -#define HAVE_STRTOLL 1 -#endif - -#define Socket_defined -#define my_socket SOCKET -#ifndef bool -#define bool BOOL -#endif -#define SIGPIPE SIGINT -#define RETQSORTTYPE void -#define QSORT_TYPE_IS_VOID -#define RETSIGTYPE void -#define SOCKET_SIZE_TYPE int -#define my_socket_defined -#define bool_defined -#define byte_defined -#define HUGE_PTR -#define STDCALL __stdcall /* Used by libmariadb.dll */ - -#define VOID_SIGHANDLER -#define SIZEOF_CHAR 1 -#define SIZEOF_LONG 4 -#define SIZEOF_LONG_LONG 8 -#define SIZEOF_OFF_T 8 -#define HAVE_BROKEN_NETINET_INCLUDES -#ifdef __NT__ -#define HAVE_NAMED_PIPE /* We can only create pipes on NT */ -#endif - -/* Use all character sets in MySQL */ -#define USE_MB 1 -#define USE_MB_IDENT 1 -#define USE_STRCOLL 1 - -/* Convert some simple functions to Posix */ - -#define sigset(A,B) signal((A),(B)) -#define finite(A) _finite(A) -#define sleep(A) Sleep((A)*1000) - -#ifndef __BORLANDC__ -#define access(A,B) _access(A,B) -#endif - -#if defined(__cplusplus) - -inline double rint(double nr) -{ - double f = floor(nr); - double c = ceil(nr); - return (((c-nr) >= (nr-f)) ? f :c); -} - -#ifdef _WIN64 -#define ulonglong2double(A) ((double) (A)) -#define my_off_t2double(A) ((double) (A)) - -#else -inline double ulonglong2double(ulonglong value) -{ - longlong nr=(longlong) value; - if (nr >= 0) - return (double) nr; - return (18446744073709551616.0 + (double) nr); -} -#define my_off_t2double(A) ulonglong2double(A) -#endif /* _WIN64 */ -#else -#define inline __inline -#endif /* __cplusplus */ - -#define __attribute(A) - -#if SIZEOF_OFF_T > 4 -#define lseek(A,B,C) _lseeki64((A),(longlong) (B),(C)) -#define tell(A) _telli64(A) -#endif - -#define STACK_DIRECTION -1 - -/* redefine deprecated functions -#define sprintf sprintf_s -#define strcpy strcpy_s -#define strcat strcat_s -#define fopen fopen_r -#define freopen freopen_r -#define getenv _dupenv_s -*/ -#ifdef _WIN32 -#include -#endif - -#define HAVE_PERROR -#define HAVE_VFPRINT -#define HAVE_CHSIZE /* System has chsize() function */ -#define HAVE_RENAME /* Have rename() as function */ -#define HAVE_BINARY_STREAMS /* Have "b" flag in streams */ -#define HAVE_LONG_JMP /* Have long jump function */ -#define HAVE_LOCKING /* have locking() call */ -#define HAVE_ERRNO_AS_DEFINE /* errno is a define */ -#define HAVE_STDLIB /* everything is include in this file */ -#define HAVE_MEMCPY -#define HAVE_MEMMOVE -#define HAVE_GETCWD -#define HAVE_TELL -#define HAVE_TZNAME -#define HAVE_PUTENV -#define HAVE_SELECT -#define HAVE_SETLOCALE -#ifndef HAVE_SOCKET -#define HAVE_SOCKET /* Giangi */ -#endif -#define HAVE_FLOAT_H -#define HAVE_LIMITS_H -#define HAVE_STDDEF_H -#define HAVE_RINT /* defined in this file */ -#define NO_FCNTL_NONBLOCK /* No FCNTL */ -#define HAVE_ALLOCA -#define HAVE_STRPBRK -#define HAVE_STRSTR - -#ifdef WIN32 -#define HAVE_SNPRINTF /* Gave link error */ -#define snprintf _snprintf -#endif - -#ifdef _MSC_VER -#define HAVE_LDIV /* The optimizer breaks in zortech for ldiv */ -#define HAVE_ANSI_INCLUDE -#define HAVE_SYS_UTIME_H -#define HAVE_STRTOUL -#endif -#define my_reinterpret_cast(A) reinterpret_cast -#define my_const_cast(A) const_cast - -/* MYSQL OPTIONS */ - -#ifdef _CUSTOMCONFIG_ -#include -#else -#define DEFAULT_MYSQL_HOME "c:\\mysql" -#define PACKAGE "mysql" -#define DEFAULT_BASEDIR "C:\\" -#define SHAREDIR "share" -#define DEFAULT_CHARSET_HOME "C:/mysql/" -#endif - -/* File name handling */ - -#define FN_LIBCHAR '\\' -#define FN_ROOTDIR "\\" -#define FN_NETWORK_DRIVES /* Uses \\ to indicate network drives */ -#define FN_NO_CASE_SENCE /* Files are not case-sensitive */ -#define MY_NFILE 1024 - -#define DO_NOT_REMOVE_THREAD_WRAPPERS -#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) -/* The following is only used for statistics, so it should be good enough */ -#ifdef __NT__ /* This should also work on Win98 but .. */ -#define thread_safe_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C)) -#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) -#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) -#else -#define thread_safe_add(V,C,L) \ - pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L)); -#define thread_safe_sub(V,C,L) \ - pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L)); -#define statistic_add(V,C,L) (V)+=(C) -#endif -#define statistic_increment(V,L) thread_safe_increment((V),(L)) -#define strcasecmp(A,B) _stricmp((A),(B)) - -#define fdopen(A,B) _fdopen((A),(B)) -#define sopen(A,B,C,D) _sopen((A),(B),(C),(D)) - - -#endif diff --git a/include/ma_global.h b/include/ma_global.h index 330b578d..8da11117 100644 --- a/include/ma_global.h +++ b/include/ma_global.h @@ -22,13 +22,23 @@ #define _global_h #ifdef _WIN32 -#include -#else -#include -#if defined(__cplusplus) && defined(inline) -#undef inline /* fix configure problem */ +#include +#include +#include +#define strcasecmp _stricmp +#define snprintf _snprintf +#define sleep(x) Sleep(1000*(x)) +#ifdef _MSC_VER +#define inline __inline +#endif +#define STDCALL __stdcall +#endif + +#include + +#ifndef __GNUC__ +#define __attribute(A) #endif -#endif /* _WIN32... */ /* Fix problem with S_ISLNK() on Linux */ #if defined(HAVE_LINUXTHREADS) @@ -243,16 +253,6 @@ double my_ulonglong2double(unsigned long long A); #define DONT_REMEMBER_SIGNAL #endif -/* Define void to stop lint from generating "null effekt" comments */ -#ifndef DONT_DEFINE_VOID -#ifdef _lint -int __void__; -#define VOID(X) (__void__ = (int) (X)) -#else -#undef VOID -#define VOID(X) (X) -#endif -#endif /* DONT_DEFINE_VOID */ #if defined(_lint) || defined(FORCE_INIT_OF_VARS) #define LINT_INIT(var) var=0 /* No uninitialize-warning */ @@ -336,7 +336,6 @@ typedef int File; /* File descriptor */ #ifndef my_socket_defined typedef int my_socket; /* File descriptor for sockets */ #define my_socket_defined -#define INVALID_SOCKET -1 #endif /* Type for fuctions that handles signals */ #define sig_handler RETSIGTYPE diff --git a/libmariadb/ma_hash.c b/libmariadb/ma_hash.c index 8b00d077..a7f87661 100644 --- a/libmariadb/ma_hash.c +++ b/libmariadb/ma_hash.c @@ -497,7 +497,7 @@ my_bool hash_delete(HASH *hash,uchar *record) pos->next=empty_index; exit: - VOID(ma_pop_dynamic(&hash->array)); + ma_pop_dynamic(&hash->array); if (hash->free) (*hash->free)((uchar*) record); return(0); diff --git a/libmariadb/ma_net.c b/libmariadb/ma_net.c index 6b370fa5..73396530 100644 --- a/libmariadb/ma_net.c +++ b/libmariadb/ma_net.c @@ -66,27 +66,6 @@ ulong net_buffer_length= 8192; /* Default length. Enlarged if necessary */ #endif #endif -typedef my_bool thr_alarm_t; -typedef my_bool ALARM; -#define thr_alarm_init(A) (*(A))=0 -#define thr_alarm_in_use(A) (*(A)) -#define thr_end_alarm(A) -#define thr_alarm(A,B,C) local_thr_alarm((A),(B),(C)) -static inline int local_thr_alarm(my_bool *A,int B __attribute__((unused)),ALARM *C __attribute__((unused))) -{ - *A=1; - return 0; -} -#define thr_got_alarm(A) 0 -#define RETRY_COUNT 1 - -#ifdef MYSQL_SERVER -extern ulong bytes_sent, bytes_received; -extern pthread_mutex_t LOCK_bytes_sent , LOCK_bytes_received; -#else -#undef statistic_add -#define statistic_add(A,B,C) -#endif /* ** Give error if a too big packet is found @@ -425,7 +404,6 @@ ma_net_real_write(NET *net,const char *packet,size_t len) return(1); } pos+=length; - statistic_add(bytes_sent,length,&LOCK_bytes_sent); } #ifdef HAVE_COMPRESS if (net->compress) @@ -465,7 +443,6 @@ ma_real_read(NET *net, size_t *complen) } remain -= (ulong) length; pos+= (ulong) length; - statistic_add(bytes_received,(ulong) length,&LOCK_bytes_received); } if (i == 0) { /* First parts is packet length */ diff --git a/libmariadb/secure/ma_schannel.h b/libmariadb/secure/ma_schannel.h index 79865c44..98971ea2 100644 --- a/libmariadb/secure/ma_schannel.h +++ b/libmariadb/secure/ma_schannel.h @@ -30,8 +30,6 @@ #include -typedef void VOID; - #include #include diff --git a/plugins/connection/aurora.c b/plugins/connection/aurora.c index effeecc6..1d27c14d 100644 --- a/plugins/connection/aurora.c +++ b/plugins/connection/aurora.c @@ -595,7 +595,7 @@ my_bool aurora_reconnect(MYSQL *mysql) { AURORA *aurora; MA_CONNECTION_HANDLER *save_hdlr= mysql->extension->conn_hdlr; - int i; + unsigned int i; /* We can't determine if a new primary was promotoed, or if * line just dropped - we will close both primary and replica diff --git a/plugins/pvio/pvio_socket.c b/plugins/pvio/pvio_socket.c index 209f9e2b..597c574f 100644 --- a/plugins/pvio/pvio_socket.c +++ b/plugins/pvio/pvio_socket.c @@ -52,6 +52,7 @@ #include #include #else +#include #define O_NONBLOCK 1 #endif diff --git a/unittest/libmariadb/t_aurora.c b/unittest/libmariadb/t_aurora.c index 4577bace..1837cc01 100644 --- a/unittest/libmariadb/t_aurora.c +++ b/unittest/libmariadb/t_aurora.c @@ -8,7 +8,7 @@ static int aurora1(MYSQL *my) { int rc; my_bool read_only= 1; - const char *primary, *my_schema; + char *primary, *my_schema; MYSQL_RES *res; MYSQL *mysql= mysql_init(NULL); @@ -75,7 +75,7 @@ static int test_reconnect(MYSQL *my) my_bool read_only= 1; int rc; my_bool reconnect= 1; - const char *aurora_host; + char *aurora_host; mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); diff --git a/unittest/mytap/tap.c b/unittest/mytap/tap.c index 89bd2471..546acd8e 100644 --- a/unittest/mytap/tap.c +++ b/unittest/mytap/tap.c @@ -156,7 +156,9 @@ typedef struct signal_entry { } signal_entry; static signal_entry install_signal[]= { +#ifdef SIGQUIT { SIGQUIT, handle_core_signal }, +#endif { SIGILL, handle_core_signal }, { SIGABRT, handle_core_signal }, { SIGFPE, handle_core_signal },