Use _WIN32 macro instead of WIN32 to check for windows platform.

This commit is contained in:
Sergey Popov 2008-08-21 07:12:13 +00:00
parent e86ea79456
commit 1f30c95bef
8 changed files with 17 additions and 17 deletions

View File

@ -371,7 +371,7 @@ std::string copy_from_clipboard(const bool mouse)
}
#endif
#ifdef WIN32
#ifdef _WIN32
#include <windows.h>
#define CLIPBOARD_FUNCS_DEFINED

View File

@ -230,7 +230,7 @@ void show_objectives(game_display& disp, const config& level, const std::string&
bool is_illegal_file_char(char c)
{
return c == '/' || c == '\\' || c == ':'
#ifdef WIN32
#ifdef _WIN32
|| c == '?' || c == '|' || c == '<' || c == '>' || c == '*' || c == '"'
#endif
;

View File

@ -212,7 +212,7 @@ void check_send_buffer_size(TCPsocket& s)
return;
_TCPsocket* sock = reinterpret_cast<_TCPsocket*>(s);
socklen_t len = sizeof(system_send_buffer_size);
#ifdef WIN32
#ifdef _WIN32
getsockopt(sock->channel, SOL_SOCKET, SO_RCVBUF,reinterpret_cast<char*>(&system_send_buffer_size), &len);
#else
getsockopt(sock->channel, SOL_SOCKET, SO_RCVBUF,&system_send_buffer_size, &len);

View File

@ -254,7 +254,7 @@ size_t sound_buffer_size()
{
// Sounds don't sound good on Windows unless the buffer size is 4k,
// but this seems to cause crashes on other systems...
#ifdef WIN32
#ifdef _WIN32
const size_t buf_size = 4096;
#else
const size_t buf_size = 1024;
@ -265,7 +265,7 @@ size_t sound_buffer_size()
void save_sound_buffer_size(const size_t size)
{
#ifdef WIN32
#ifdef _WIN32
const char* buf_size = "4096";
#else
const char* buf_size = "1024";

View File

@ -29,7 +29,7 @@
namespace jwsmtp {
bool Connect(SOCKET sockfd, const SOCKADDR_IN& addr) {
#ifdef WIN32
#ifdef _WIN32
return bool(connect(sockfd, (sockaddr*)&addr, addr.get_size()) != SOCKET_ERROR);
#else
return bool(connect(sockfd, (sockaddr*)&addr, addr.get_size()) == 0);
@ -38,7 +38,7 @@ bool Connect(SOCKET sockfd, const SOCKADDR_IN& addr) {
bool Socket(SOCKET& s, int /*domain*/, int type, int protocol) {
s = socket(AF_INET, type, protocol);
#ifdef WIN32
#ifdef _WIN32
return bool(s != INVALID_SOCKET);
#else
return bool(s != -1);
@ -47,7 +47,7 @@ bool Socket(SOCKET& s, int /*domain*/, int type, int protocol) {
bool Send(int &CharsSent, SOCKET s, const char *msg, size_t len, int flags) {
CharsSent = send(s, msg, len, flags);
#ifdef WIN32
#ifdef _WIN32
return bool((CharsSent != SOCKET_ERROR));
#else
return bool((CharsSent != -1));
@ -56,7 +56,7 @@ bool Send(int &CharsSent, SOCKET s, const char *msg, size_t len, int flags) {
bool Recv(int &CharsRecv, SOCKET s, char *buf, size_t len, int flags) {
CharsRecv = recv(s, buf, len, flags);
#ifdef WIN32
#ifdef _WIN32
return bool((CharsRecv != SOCKET_ERROR));
#else
return bool((CharsRecv != -1));
@ -66,7 +66,7 @@ bool Recv(int &CharsRecv, SOCKET s, char *buf, size_t len, int flags) {
// just wrap the call to shutdown the connection on a socket
// this way I don't have to call it this way everywhere.
void Closesocket(const SOCKET& s) {
#ifdef WIN32
#ifdef _WIN32
closesocket(s);
#else
close(s);
@ -76,7 +76,7 @@ void Closesocket(const SOCKET& s) {
// This does nothing on unix.
// for windoze only, to initialise networking, snore
void initNetworking() {
#ifdef WIN32
#ifdef _WIN32
class socks
{
public:

View File

@ -25,7 +25,7 @@
#ifndef __COMPAT_H__
#define __COMPAT_H__
#ifdef WIN32
#ifdef _WIN32
#pragma warning( disable : 4786 )
// tell the linker which libraries to find functions in
#pragma comment(lib, "ws2_32.lib")
@ -91,7 +91,7 @@ struct SOCKADDR_IN {
SOCKADDR_IN(const std::string& address, unsigned short port, short family = AF_INET) {
ADDR.sin_port = port;
ADDR.sin_family = family;
#ifdef WIN32
#ifdef _WIN32
ADDR.sin_addr.S_un.S_addr = inet_addr(address.c_str());
ok = (ADDR.sin_addr.S_un.S_addr != INADDR_NONE);
#else
@ -126,7 +126,7 @@ struct SOCKADDR_IN {
}
void set_port(unsigned short newport) {ADDR.sin_port = newport;}
void set_ip(const std::string& newip) {
#ifdef WIN32
#ifdef _WIN32
ADDR.sin_addr.S_un.S_addr = inet_addr(newip.c_str());
ok = (ADDR.sin_addr.S_un.S_addr != INADDR_NONE);
#else
@ -134,7 +134,7 @@ struct SOCKADDR_IN {
#endif
}
void zeroaddress() {
#ifdef WIN32
#ifdef _WIN32
ADDR.sin_addr.S_un.S_addr = 0;
#else
ADDR.sin_addr.s_addr = 0;

View File

@ -21,7 +21,7 @@
// http://johnwiggins.net
// smtplib@johnwiggins.net
//
#ifdef WIN32
#ifdef _WIN32
// std::vector<std::string> This gives this warning in VC..
// bloody annoying, there is a way round it according to MS.
// The debugger basically cannot browse anything with a name

View File

@ -22,7 +22,7 @@
#include <map>
#include <string>
#ifdef WIN32
#ifdef _WIN32
#include <time.h>
#endif