#At lp:maria based on revid:monty@askmonty.org-20090318021520-fn3aisa99yt4oe97 2685 Michael Widenius 2009-03-20 Avoid compiler warnings on windows modified: client/mysqltest.cc include/config-win.h unittest/mysys/waiting_threads-t.c per-file messages: client/mysqltest.cc Avoid compiler warnings on windows include/config-win.h Added missing typedef ssize_t Added some other useful defines from MySQL 6.0 unittest/mysys/waiting_threads-t.c Fixed link failure for 'ftruncate' on Windows === modified file 'client/mysqltest.cc' --- a/client/mysqltest.cc 2009-02-19 09:01:25 +0000 +++ b/client/mysqltest.cc 2009-03-20 11:41:30 +0000 @@ -1622,7 +1622,7 @@ int compare_files2(File fd1, const char* { int error= RESULT_OK; File fd2; - my_off_t fd1_length, fd2_length; + size_t fd1_length, fd2_length; DYNAMIC_STRING fd1_result, fd2_result; if ((fd2= my_open(filename2, O_RDONLY, MYF(0))) < 0) @@ -1631,8 +1631,8 @@ int compare_files2(File fd1, const char* die("Failed to open second file: '%s'", filename2); } - fd1_length= my_seek(fd1, 0, SEEK_END, MYF(0)); - fd2_length= my_seek(fd2, 0, SEEK_END, MYF(0)); + fd1_length= (size_t) my_seek(fd1, 0, SEEK_END, MYF(0)); + fd2_length= (size_t) my_seek(fd2, 0, SEEK_END, MYF(0)); if (init_dynamic_string(&fd1_result, 0, fd1_length, 0) || init_dynamic_string(&fd2_result, 0, fd2_length, 0)) === modified file 'include/config-win.h' --- a/include/config-win.h 2009-03-12 22:27:35 +0000 +++ b/include/config-win.h 2009-03-20 11:41:30 +0000 @@ -94,6 +94,17 @@ functions */ #define S_IROTH S_IREAD /* for my_lib */ +/* for MY_S_ISFIFO() macro from my_lib */ +#if defined (_S_IFIFO) && !defined (S_IFIFO) +#define S_IFIFO _S_IFIFO +#endif + +/* Winsock2 constant (Vista SDK and later)*/ +#define IPPROTO_IPV6 41 +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif + /* Constants used by chmod. Note, that group/others is ignored - because unsupported by Windows due to different access control model. @@ -160,10 +171,21 @@ typedef __int64 os_off_t; #ifdef _WIN64 typedef UINT_PTR rf_SetTimer; #else +typedef uint rf_SetTimer; +#endif + #ifndef HAVE_SIZE_T -typedef unsigned int size_t; +#ifndef _SIZE_T_DEFINED +typedef SIZE_T size_t; +#define _SIZE_T_DEFINED +#endif +#endif + +#ifndef HAVE_SSIZE_T +#ifndef _SSIZE_T_DEFINED +typedef SSIZE_T ssize_t; +#define _SSIZE_T_DEFINED #endif -typedef uint rf_SetTimer; #endif #define Socket_defined @@ -195,7 +217,7 @@ typedef uint rf_SetTimer; #define SIZEOF_CHARP 4 #endif #define HAVE_BROKEN_NETINET_INCLUDES -#ifdef __NT__ +#ifdef _WIN32 #define HAVE_NAMED_PIPE /* We can only create pipes on NT */ #endif @@ -316,7 +338,7 @@ inline ulonglong double2ulonglong(double #define strcasecmp stricmp #define strncasecmp strnicmp -#ifndef __NT__ +#ifndef _WIN32 #undef FILE_SHARE_DELETE #define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */ #endif @@ -368,7 +390,7 @@ inline ulonglong double2ulonglong(double #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) /* The following is only used for statistics, so it should be good enough */ -#ifdef __NT__ /* This should also work on Win98 but .. */ +#ifdef _WIN32 /* 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)) #endif === modified file 'unittest/mysys/waiting_threads-t.c' --- a/unittest/mysys/waiting_threads-t.c 2009-02-19 09:01:25 +0000 +++ b/unittest/mysys/waiting_threads-t.c 2009-03-20 11:41:30 +0000 @@ -254,6 +254,7 @@ void do_tests() diag("timeout_long=%lu us, deadlock_search_depth_long=%lu", wt_timeout_long, wt_deadlock_search_depth_long); +#ifndef _WIN32 #define test_kill_strategy(X) \ diag("kill strategy: " #X); \ DBUG_EXECUTE("reset_file", \ @@ -261,6 +262,12 @@ void do_tests() DBUG_PRINT("info", ("kill strategy: " #X)); \ kill_strategy=X; \ do_one_test(); +#else + diag("kill strategy: " #X); \ + DBUG_PRINT("info", ("kill strategy: " #X)); \ + kill_strategy=X; \ + do_one_test(); +#endif test_kill_strategy(LATEST); test_kill_strategy(RANDOM);