Commit 4dc093ce authored by Michael Widenius's avatar Michael Widenius

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
parent 2611d3c0
...@@ -1622,7 +1622,7 @@ int compare_files2(File fd1, const char* filename2) ...@@ -1622,7 +1622,7 @@ int compare_files2(File fd1, const char* filename2)
{ {
int error= RESULT_OK; int error= RESULT_OK;
File fd2; File fd2;
my_off_t fd1_length, fd2_length; size_t fd1_length, fd2_length;
DYNAMIC_STRING fd1_result, fd2_result; DYNAMIC_STRING fd1_result, fd2_result;
if ((fd2= my_open(filename2, O_RDONLY, MYF(0))) < 0) if ((fd2= my_open(filename2, O_RDONLY, MYF(0))) < 0)
...@@ -1631,8 +1631,8 @@ int compare_files2(File fd1, const char* filename2) ...@@ -1631,8 +1631,8 @@ int compare_files2(File fd1, const char* filename2)
die("Failed to open second file: '%s'", filename2); die("Failed to open second file: '%s'", filename2);
} }
fd1_length= my_seek(fd1, 0, SEEK_END, MYF(0)); fd1_length= (size_t) my_seek(fd1, 0, SEEK_END, MYF(0));
fd2_length= my_seek(fd2, 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) || if (init_dynamic_string(&fd1_result, 0, fd1_length, 0) ||
init_dynamic_string(&fd2_result, 0, fd2_length, 0)) init_dynamic_string(&fd2_result, 0, fd2_length, 0))
......
...@@ -94,6 +94,17 @@ functions */ ...@@ -94,6 +94,17 @@ functions */
#define S_IROTH S_IREAD /* for my_lib */ #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 Constants used by chmod. Note, that group/others is ignored
- because unsupported by Windows due to different access control model. - because unsupported by Windows due to different access control model.
...@@ -160,10 +171,21 @@ typedef __int64 os_off_t; ...@@ -160,10 +171,21 @@ typedef __int64 os_off_t;
#ifdef _WIN64 #ifdef _WIN64
typedef UINT_PTR rf_SetTimer; typedef UINT_PTR rf_SetTimer;
#else #else
typedef uint rf_SetTimer;
#endif
#ifndef HAVE_SIZE_T #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 #endif
typedef uint rf_SetTimer;
#endif #endif
#define Socket_defined #define Socket_defined
...@@ -195,7 +217,7 @@ typedef uint rf_SetTimer; ...@@ -195,7 +217,7 @@ typedef uint rf_SetTimer;
#define SIZEOF_CHARP 4 #define SIZEOF_CHARP 4
#endif #endif
#define HAVE_BROKEN_NETINET_INCLUDES #define HAVE_BROKEN_NETINET_INCLUDES
#ifdef __NT__ #ifdef _WIN32
#define HAVE_NAMED_PIPE /* We can only create pipes on NT */ #define HAVE_NAMED_PIPE /* We can only create pipes on NT */
#endif #endif
...@@ -316,7 +338,7 @@ inline ulonglong double2ulonglong(double d) ...@@ -316,7 +338,7 @@ inline ulonglong double2ulonglong(double d)
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#ifndef __NT__ #ifndef _WIN32
#undef FILE_SHARE_DELETE #undef FILE_SHARE_DELETE
#define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */ #define FILE_SHARE_DELETE 0 /* Not implemented on Win 98/ME */
#endif #endif
...@@ -368,7 +390,7 @@ inline ulonglong double2ulonglong(double d) ...@@ -368,7 +390,7 @@ inline ulonglong double2ulonglong(double d)
#define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V)) #define thread_safe_increment(V,L) InterlockedIncrement((long*) &(V))
#define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V)) #define thread_safe_decrement(V,L) InterlockedDecrement((long*) &(V))
/* The following is only used for statistics, so it should be good enough */ /* 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_add(V,C,L) InterlockedExchangeAdd((long*) &(V),(C))
#define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C)) #define thread_safe_sub(V,C,L) InterlockedExchangeAdd((long*) &(V),-(long) (C))
#endif #endif
......
...@@ -254,6 +254,7 @@ void do_tests() ...@@ -254,6 +254,7 @@ void do_tests()
diag("timeout_long=%lu us, deadlock_search_depth_long=%lu", diag("timeout_long=%lu us, deadlock_search_depth_long=%lu",
wt_timeout_long, wt_deadlock_search_depth_long); wt_timeout_long, wt_deadlock_search_depth_long);
#ifndef _WIN32
#define test_kill_strategy(X) \ #define test_kill_strategy(X) \
diag("kill strategy: " #X); \ diag("kill strategy: " #X); \
DBUG_EXECUTE("reset_file", \ DBUG_EXECUTE("reset_file", \
...@@ -261,6 +262,12 @@ void do_tests() ...@@ -261,6 +262,12 @@ void do_tests()
DBUG_PRINT("info", ("kill strategy: " #X)); \ DBUG_PRINT("info", ("kill strategy: " #X)); \
kill_strategy=X; \ kill_strategy=X; \
do_one_test(); 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(LATEST);
test_kill_strategy(RANDOM); test_kill_strategy(RANDOM);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment