mirror of https://github.com/BOINC/boinc.git
Added #ifdefs and explicit inclusion of "boinc_win.h" to files to help those
trying to compile under windows with alternate compilers. svn path=/trunk/boinc/; revision=9077
This commit is contained in:
parent
bb5862d6fe
commit
6e30e66599
|
@ -4,12 +4,12 @@
|
||||||
include $(top_srcdir)/Makefile.incl
|
include $(top_srcdir)/Makefile.incl
|
||||||
|
|
||||||
#if HAVE_NSL
|
#if HAVE_NSL
|
||||||
nslprogs=boinc_cmd
|
nslprogs=boinc_cmd$(EXEEXT)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bin_PROGRAMS = crypt_prog $(nslprogs)
|
bin_PROGRAMS = crypt_prog$(EXEEXT) $(nslprogs)
|
||||||
|
|
||||||
EXTRA_PROGRAMS = md5_test shmem_test msg_test
|
EXTRA_PROGRAMS = md5_test$(EXEEXT) shmem_test$(EXEEXT) msg_test$(EXEEXT)
|
||||||
|
|
||||||
all-local: client-bin
|
all-local: client-bin
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ boinc_cmd_SOURCES = \
|
||||||
boinc_cmd_LDADD = $(lib_LIBRARIES) $(PTHREAD_LIBS)
|
boinc_cmd_LDADD = $(lib_LIBRARIES) $(PTHREAD_LIBS)
|
||||||
|
|
||||||
# make a hard link to the client name.
|
# make a hard link to the client name.
|
||||||
@CLIENT_CMD_BIN_FILENAME@: boinc_cmd
|
@CLIENT_CMD_BIN_FILENAME@: boinc_cmd$(EXEEXT)
|
||||||
rm -f $@
|
rm -f $@
|
||||||
rm -f $@.unmodified
|
rm -f $@.unmodified
|
||||||
cp $? $@.unmodified
|
cp $? $@.unmodified
|
||||||
|
|
|
@ -147,7 +147,7 @@ int main(int argc, char** argv) {
|
||||||
strcpy(passwd_buf, "");
|
strcpy(passwd_buf, "");
|
||||||
read_password_from_file(passwd_buf);
|
read_password_from_file(passwd_buf);
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
WSADATA wsdata;
|
WSADATA wsdata;
|
||||||
retval = WSAStartup( MAKEWORD( 1, 1 ), &wsdata);
|
retval = WSAStartup( MAKEWORD( 1, 1 ), &wsdata);
|
||||||
if (retval) {
|
if (retval) {
|
||||||
|
@ -429,7 +429,7 @@ int main(int argc, char** argv) {
|
||||||
show_error(retval);
|
show_error(retval);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -24,6 +24,11 @@
|
||||||
#ifndef _BOINC_WIN_
|
#ifndef _BOINC_WIN_
|
||||||
#define _BOINC_WIN_
|
#define _BOINC_WIN_
|
||||||
|
|
||||||
|
// Under CYGWIN we need to include config.h first.
|
||||||
|
#ifdef __CYGWIN32__
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// Windows System Libraries
|
// Windows System Libraries
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -58,26 +63,52 @@
|
||||||
#define WIN32_EXTRA_LEAN // Trims even farther.
|
#define WIN32_EXTRA_LEAN // Trims even farther.
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#if !defined(__CYGWIN32__) || defined(USE_WINSOCK)
|
||||||
|
/* If we're not running under CYGWIN use windows networking */
|
||||||
|
#undef USE_WINSOCK
|
||||||
|
#define USE_WINSOCK 1
|
||||||
#include <winsock.h>
|
#include <winsock.h>
|
||||||
#include <wininet.h>
|
#include <wininet.h>
|
||||||
|
|
||||||
|
#else
|
||||||
|
/* Under cygwin, curl was probably compiled to use <sys/socket.h> */
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
#include <netdb.h>
|
||||||
|
#define _WINSOCK_H
|
||||||
|
#define _WINSOCKAPI_
|
||||||
|
#define _WINSOCK2_H
|
||||||
|
#define _WININET_H
|
||||||
|
#define _WININETAPI_
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <process.h>
|
#include <process.h>
|
||||||
#ifdef __MINGW32__
|
#if defined(__MINGW32__) || defined(__CYGWIN32__)
|
||||||
#include <pbt.h>
|
#include <pbt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#include <raserror.h>
|
#include <raserror.h>
|
||||||
#include <mmsystem.h>
|
#include <mmsystem.h>
|
||||||
|
#if !defined(__CYGWIN32__)
|
||||||
#include <direct.h>
|
#include <direct.h>
|
||||||
|
#endif
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#ifndef __MINGW32__
|
#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(__CYGWIN32__)
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
#ifndef __MINGW32__
|
#endif
|
||||||
|
#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
|
||||||
#include <crtdbg.h>
|
#include <crtdbg.h>
|
||||||
#endif
|
#endif
|
||||||
#ifndef __MINGW32__
|
#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
|
||||||
#include <delayimp.h>
|
#include <delayimp.h>
|
||||||
#endif
|
#endif
|
||||||
// All projects should be using std::min and std::max instead of the Windows
|
// All projects should be using std::min and std::max instead of the Windows
|
||||||
|
@ -136,9 +167,11 @@
|
||||||
#include <set>
|
#include <set>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __CYGWIN32__
|
||||||
#define vsnprintf _vsnprintf
|
#define vsnprintf _vsnprintf
|
||||||
#define snprintf _snprintf
|
#define snprintf _snprintf
|
||||||
|
#define stprintf _stprintf
|
||||||
|
#define stricmp _stricmp
|
||||||
#define fdopen _fdopen
|
#define fdopen _fdopen
|
||||||
#define dup _dup
|
#define dup _dup
|
||||||
#define unlink _unlink
|
#define unlink _unlink
|
||||||
|
@ -147,7 +180,7 @@
|
||||||
#define stat _stat
|
#define stat _stat
|
||||||
#define finite _finite
|
#define finite _finite
|
||||||
#define chdir _chdir
|
#define chdir _chdir
|
||||||
|
#endif
|
||||||
|
|
||||||
// On the Win32 platform include file and line number information for each
|
// On the Win32 platform include file and line number information for each
|
||||||
// memory allocation/deallocation
|
// memory allocation/deallocation
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__MINGW32__)
|
#if defined(_WIN32) && !defined(__MINGW32__) && !defined(__CYGWIN32__)
|
||||||
#include "stackwalker_win.h"
|
#include "stackwalker_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -392,7 +392,7 @@ LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *pExPtrs) {
|
||||||
}
|
}
|
||||||
fflush( stderr );
|
fflush( stderr );
|
||||||
|
|
||||||
#ifndef __MINGW32__
|
#if !defined(__MINGW32__) && !defined(__CYGWIN32__)
|
||||||
// Unwind the stack and spew it to stderr
|
// Unwind the stack and spew it to stderr
|
||||||
if (flags & BOINC_DIAG_DUMPCALLSTACKENABLED )
|
if (flags & BOINC_DIAG_DUMPCALLSTACKENABLED )
|
||||||
StackwalkFilter( pExPtrs, EXCEPTION_EXECUTE_HANDLER, NULL );
|
StackwalkFilter( pExPtrs, EXCEPTION_EXECUTE_HANDLER, NULL );
|
||||||
|
@ -469,7 +469,7 @@ void boinc_trace(const char *pszFormat, ...) {
|
||||||
va_list ptr;
|
va_list ptr;
|
||||||
va_start(ptr, pszFormat);
|
va_start(ptr, pszFormat);
|
||||||
|
|
||||||
_vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
|
vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
|
||||||
|
|
||||||
va_end(ptr);
|
va_end(ptr);
|
||||||
|
|
||||||
|
@ -489,7 +489,7 @@ void boinc_info_debug(const char *pszFormat, ...){
|
||||||
va_list ptr;
|
va_list ptr;
|
||||||
va_start(ptr, pszFormat);
|
va_start(ptr, pszFormat);
|
||||||
|
|
||||||
_vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
|
vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
|
||||||
|
|
||||||
va_end(ptr);
|
va_end(ptr);
|
||||||
|
|
||||||
|
@ -511,7 +511,7 @@ void boinc_info_release(const char *pszFormat, ...){
|
||||||
va_list ptr;
|
va_list ptr;
|
||||||
va_start(ptr, pszFormat);
|
va_start(ptr, pszFormat);
|
||||||
|
|
||||||
_vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
|
vsnprintf(szBuffer, sizeof(szBuffer), pszFormat, ptr);
|
||||||
|
|
||||||
va_end(ptr);
|
va_end(ptr);
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ extern void boinc_info_release(const char *pszFormat, ...);
|
||||||
|
|
||||||
#else // _DEBUG
|
#else // _DEBUG
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#if defined(__MINGW32__) || defined(__CYGWIN32__)
|
||||||
#define BOINCASSERT(expr)
|
#define BOINCASSERT(expr)
|
||||||
#define BOINCTRACE(...)
|
#define BOINCTRACE(...)
|
||||||
#define BOINCINFO boinc_info_release
|
#define BOINCINFO boinc_info_release
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "boinc_win.h"
|
#include "boinc_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#if !defined(_WIN32) || defined(__CYGWIN32__)
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -100,8 +100,7 @@ DIRREF dir_open(const char* p) {
|
||||||
#ifdef HAVE_DIRENT_H
|
#ifdef HAVE_DIRENT_H
|
||||||
dirp = opendir(p);
|
dirp = opendir(p);
|
||||||
if (!dirp) return NULL;
|
if (!dirp) return NULL;
|
||||||
#endif
|
#elif defined(_WIN32)
|
||||||
#ifdef _WIN32
|
|
||||||
if (!is_dir(p)) return NULL;
|
if (!is_dir(p)) return NULL;
|
||||||
dirp = (DIR_DESC*) calloc(sizeof(DIR_DESC), 1);
|
dirp = (DIR_DESC*) calloc(sizeof(DIR_DESC), 1);
|
||||||
dirp->first = true;
|
dirp->first = true;
|
||||||
|
@ -127,8 +126,7 @@ int dir_scan(char* p, DIRREF dirp, int p_len) {
|
||||||
return ERR_READDIR;
|
return ERR_READDIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(_WIN32)
|
||||||
#ifdef _WIN32
|
|
||||||
WIN32_FIND_DATA data;
|
WIN32_FIND_DATA data;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (dirp->first) {
|
if (dirp->first) {
|
||||||
|
@ -167,8 +165,7 @@ void dir_close(DIRREF dirp) {
|
||||||
if (dirp) {
|
if (dirp) {
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(_WIN32)
|
||||||
#ifdef _WIN32
|
|
||||||
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
if (dirp->handle != INVALID_HANDLE_VALUE) {
|
||||||
FindClose(dirp->handle);
|
FindClose(dirp->handle);
|
||||||
dirp->handle = INVALID_HANDLE_VALUE;
|
dirp->handle = INVALID_HANDLE_VALUE;
|
||||||
|
@ -180,9 +177,7 @@ void dir_close(DIRREF dirp) {
|
||||||
DirScanner::DirScanner(string const& path) {
|
DirScanner::DirScanner(string const& path) {
|
||||||
#ifdef HAVE_DIRENT_H
|
#ifdef HAVE_DIRENT_H
|
||||||
dirp = opendir(path.c_str());
|
dirp = opendir(path.c_str());
|
||||||
#endif
|
#elif defined(_WIN32)
|
||||||
|
|
||||||
#ifdef _WIN32
|
|
||||||
first = true;
|
first = true;
|
||||||
handle = INVALID_HANDLE_VALUE;
|
handle = INVALID_HANDLE_VALUE;
|
||||||
if (!is_dir((char*)path.c_str())) {
|
if (!is_dir((char*)path.c_str())) {
|
||||||
|
@ -208,8 +203,7 @@ bool DirScanner::scan(string& s) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(_WIN32)
|
||||||
#ifdef _WIN32
|
|
||||||
WIN32_FIND_DATA data;
|
WIN32_FIND_DATA data;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (first) {
|
if (first) {
|
||||||
|
@ -243,8 +237,7 @@ DirScanner::~DirScanner() {
|
||||||
if (dirp) {
|
if (dirp) {
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
}
|
}
|
||||||
#endif
|
#elif defined(_WIN32)
|
||||||
#ifdef _WIN32
|
|
||||||
if (handle != INVALID_HANDLE_VALUE) {
|
if (handle != INVALID_HANDLE_VALUE) {
|
||||||
FindClose(handle);
|
FindClose(handle);
|
||||||
}
|
}
|
||||||
|
@ -488,7 +481,7 @@ int boinc_make_dirs(const char* dirpath, const char* filepath) {
|
||||||
|
|
||||||
int FILE_LOCK::lock(const char* filename) {
|
int FILE_LOCK::lock(const char* filename) {
|
||||||
int retval=0;
|
int retval=0;
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||||
handle = CreateFile(
|
handle = CreateFile(
|
||||||
filename, GENERIC_WRITE,
|
filename, GENERIC_WRITE,
|
||||||
0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
|
0, 0, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0
|
||||||
|
@ -513,7 +506,7 @@ int FILE_LOCK::lock(const char* filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int FILE_LOCK::unlock(const char* filename) {
|
int FILE_LOCK::unlock(const char* filename) {
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||||
if (!CloseHandle(handle)) {
|
if (!CloseHandle(handle)) {
|
||||||
perror("FILE_LOCK::unlock(): close failed.");
|
perror("FILE_LOCK::unlock(): close failed.");
|
||||||
}
|
}
|
||||||
|
@ -529,7 +522,7 @@ int FILE_LOCK::unlock(const char* filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void relative_to_absolute(const char* relname, char* path) {
|
void relative_to_absolute(const char* relname, char* path) {
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||||
_getcwd(path, 256);
|
_getcwd(path, 256);
|
||||||
#else
|
#else
|
||||||
getcwd(path, 256);
|
getcwd(path, 256);
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
#endif /* defined(_MSC_VER) && (_MSC_VER > 1020) */
|
#endif /* defined(_MSC_VER) && (_MSC_VER > 1020) */
|
||||||
#endif /* (!defined __cplusplus) && (!defined bool) */
|
#endif /* (!defined __cplusplus) && (!defined bool) */
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||||
|
|
||||||
typedef struct _DIR_DESC {
|
typedef struct _DIR_DESC {
|
||||||
char path[256];
|
char path[256];
|
||||||
|
@ -97,7 +97,7 @@ extern void dir_close(DIRREF);
|
||||||
|
|
||||||
|
|
||||||
class DirScanner {
|
class DirScanner {
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||||
std::string dir;
|
std::string dir;
|
||||||
bool first;
|
bool first;
|
||||||
void* handle;
|
void* handle;
|
||||||
|
@ -111,7 +111,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FILE_LOCK {
|
struct FILE_LOCK {
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && !defined(__CYGWIN32__)
|
||||||
HANDLE handle;
|
HANDLE handle;
|
||||||
#else
|
#else
|
||||||
int fd;
|
int fd;
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
// This file is the underlying mechanism of GUI RPC client
|
// This file is the underlying mechanism of GUI RPC client
|
||||||
// (not the actual RPCs)
|
// (not the actual RPCs)
|
||||||
|
|
||||||
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
|
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
|
||||||
#include "boinc_win.h"
|
#include "boinc_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ void RPC_CLIENT::close() {
|
||||||
int RPC_CLIENT::init(const char* host, int port) {
|
int RPC_CLIENT::init(const char* host, int port) {
|
||||||
double client_time = 0.0;
|
double client_time = 0.0;
|
||||||
int retval;
|
int retval;
|
||||||
memset(&addr, 0, sizeof(addr));
|
memset(&addr, 0, sizeof(addr));
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
if (port) {
|
if (port) {
|
||||||
addr.sin_port = htons(port);
|
addr.sin_port = htons(port);
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
// a C++ interface to BOINC GUI RPC
|
// a C++ interface to BOINC GUI RPC
|
||||||
|
|
||||||
#ifndef _WIN32
|
#if !defined(_WIN32) || defined (__CYGWIN__)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "error_numbers.h"
|
#include "error_numbers.h"
|
||||||
|
@ -38,7 +39,7 @@
|
||||||
|
|
||||||
const char* socket_error_str() {
|
const char* socket_error_str() {
|
||||||
static char buf[80];
|
static char buf[80];
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
int e = WSAGetLastError();
|
int e = WSAGetLastError();
|
||||||
switch (e) {
|
switch (e) {
|
||||||
case WSANOTINITIALISED:
|
case WSANOTINITIALISED:
|
||||||
|
@ -74,6 +75,11 @@ const char* socket_error_str() {
|
||||||
return "a nonrecoverable error occurred";
|
return "a nonrecoverable error occurred";
|
||||||
case TRY_AGAIN:
|
case TRY_AGAIN:
|
||||||
return "host not found or server failure";
|
return "host not found or server failure";
|
||||||
|
#ifdef NETDB_INTERNAL
|
||||||
|
case NETDB_INTERNAL:
|
||||||
|
sprintf(buf,"network internal error %d",errno);
|
||||||
|
return buf;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
sprintf(buf, "error %d", h_errno);
|
sprintf(buf, "error %d", h_errno);
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -113,7 +119,7 @@ int boinc_socket(int& fd) {
|
||||||
|
|
||||||
int boinc_socket_asynch(int fd, bool asynch) {
|
int boinc_socket_asynch(int fd, bool asynch) {
|
||||||
if (asynch) {
|
if (asynch) {
|
||||||
#ifdef WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
unsigned long one = 1;
|
unsigned long one = 1;
|
||||||
ioctlsocket(fd, FIONBIO, &one);
|
ioctlsocket(fd, FIONBIO, &one);
|
||||||
#else
|
#else
|
||||||
|
@ -127,7 +133,7 @@ int boinc_socket_asynch(int fd, bool asynch) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
#ifdef WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
unsigned long zero = 0;
|
unsigned long zero = 0;
|
||||||
ioctlsocket(fd, FIONBIO, &zero);
|
ioctlsocket(fd, FIONBIO, &zero);
|
||||||
#else
|
#else
|
||||||
|
@ -145,7 +151,7 @@ int boinc_socket_asynch(int fd, bool asynch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void boinc_close_socket(int sock) {
|
void boinc_close_socket(int sock) {
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
closesocket(sock);
|
closesocket(sock);
|
||||||
#else
|
#else
|
||||||
close(sock);
|
close(sock);
|
||||||
|
@ -155,7 +161,7 @@ void boinc_close_socket(int sock) {
|
||||||
int get_socket_error(int fd) {
|
int get_socket_error(int fd) {
|
||||||
boinc_socklen_t intsize = sizeof(int);
|
boinc_socklen_t intsize = sizeof(int);
|
||||||
int n;
|
int n;
|
||||||
#ifdef WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&n, &intsize);
|
getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *)&n, &intsize);
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
getsockopt(fd, SOL_SOCKET, SO_ERROR, &n, (int *)&intsize);
|
getsockopt(fd, SOL_SOCKET, SO_ERROR, &n, (int *)&intsize);
|
||||||
|
@ -170,7 +176,7 @@ int get_socket_error(int fd) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
|
|
||||||
typedef BOOL (WINAPI *GetStateProc)( OUT LPDWORD lpdwFlags, IN DWORD dwReserved);
|
typedef BOOL (WINAPI *GetStateProc)( OUT LPDWORD lpdwFlags, IN DWORD dwReserved);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#else
|
||||||
|
#include "boinc_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct FDSET_GROUP {
|
struct FDSET_GROUP {
|
||||||
|
@ -47,7 +49,7 @@ extern void boinc_close_socket(int sock);
|
||||||
extern int get_socket_error(int fd);
|
extern int get_socket_error(int fd);
|
||||||
extern const char* socket_error_str();
|
extern const char* socket_error_str();
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
typedef int boinc_socklen_t;
|
typedef int boinc_socklen_t;
|
||||||
#define SHUT_WR SD_SEND
|
#define SHUT_WR SD_SEND
|
||||||
#elif defined( __APPLE__)
|
#elif defined( __APPLE__)
|
||||||
|
@ -62,7 +64,7 @@ typedef BOINC_SOCKLEN_T boinc_socklen_t;
|
||||||
|
|
||||||
extern int get_connected_state();
|
extern int get_connected_state();
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) && defined(USE_WINSOCK)
|
||||||
extern int WinsockInitialize();
|
extern int WinsockInitialize();
|
||||||
extern int WinsockCleanup();
|
extern int WinsockCleanup();
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#else
|
||||||
|
#include "boinc_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern bool parse(char* , char* );
|
extern bool parse(char* , char* );
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include "boinc_win.h"
|
#include "boinc_win.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifndef M_LN2
|
||||||
#define M_LN2 0.693147180559945309417
|
#define M_LN2 0.693147180559945309417
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue