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)
{
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* filename2)
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))
......
......@@ -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 d)
#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 d)
#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
......
......@@ -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);
......
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