summaryrefslogtreecommitdiff
path: root/src/win32
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-09-02 08:30:54 -0400
committerAdam <Adam@anope.org>2012-09-02 08:30:54 -0400
commit1af64a9bbb150b9daae3944d6aae86864c271103 (patch)
treec24a1ac6793e997f83ac66810b611f88855fcd90 /src/win32
parente3d5140dcc936ff411c438b7e3997104cb5f085a (diff)
Fix Windows
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/anope_windows.h16
-rw-r--r--src/win32/dl/dl.cpp1
-rw-r--r--src/win32/pipe/pipe.cpp21
-rw-r--r--src/win32/socket.h1
-rw-r--r--src/win32/windows.cpp6
5 files changed, 30 insertions, 15 deletions
diff --git a/src/win32/anope_windows.h b/src/win32/anope_windows.h
index e5c4d3b11..635dfb8e8 100644
--- a/src/win32/anope_windows.h
+++ b/src/win32/anope_windows.h
@@ -1,4 +1,4 @@
- /* POSIX emulation layer for Windows.
+/* POSIX emulation layer for Windows.
*
* Copyright (C) 2008-2011 Robin Burchell <w00t@inspircd.org>
* Copyright (C) 2008-2012 Anope Team <info@anope.org>
@@ -9,9 +9,11 @@
* Based on the original code of Services by Andy Church.
*/
- #ifndef WINDOWS_H
- #define WINDOWS_H
- #ifdef _WIN32
+#ifndef WINDOWS_H
+#define WINDOWS_H
+#ifdef _WIN32
+
+#define NOMINMAX
#include <winsock2.h>
#include <ws2tcpip.h>
@@ -40,6 +42,8 @@
/* VS2008 hates having this define before its own */
#define vsnprintf _vsnprintf
+#define anope_close windows_close
+
#define stat _stat
#define S_ISREG(x) ((x) & _S_IFREG)
@@ -48,6 +52,8 @@
#endif
#define EINPROGRESS WSAEWOULDBLOCK
+#include "extensible.h"
+
#include "socket.h"
#include "dir/dir.h"
#include "dl/dl.h"
@@ -71,5 +77,7 @@ extern int unsetenv(const char *name);
extern int mkstemp(char *input);
extern void getcwd(char *buf, size_t sz);
+template struct ExtensibleItemClass<Anope::string>;
+
#endif // _WIN32
#endif // WINDOWS_H
diff --git a/src/win32/dl/dl.cpp b/src/win32/dl/dl.cpp
index 93e2939d0..a6cbe48ce 100644
--- a/src/win32/dl/dl.cpp
+++ b/src/win32/dl/dl.cpp
@@ -6,6 +6,7 @@
*/
#include "services.h"
+#include "anope.h"
void *dlopen(const char *filename, int)
{
diff --git a/src/win32/pipe/pipe.cpp b/src/win32/pipe/pipe.cpp
index 36e6ef5ec..6c4a9a3f1 100644
--- a/src/win32/pipe/pipe.cpp
+++ b/src/win32/pipe/pipe.cpp
@@ -6,6 +6,7 @@
*/
#include "services.h"
+#include "sockets.h"
int pipe(int fds[2])
{
@@ -14,22 +15,22 @@ int pipe(int fds[2])
int cfd = socket(AF_INET, SOCK_STREAM, 0), lfd = socket(AF_INET, SOCK_STREAM, 0);
if (cfd == -1 || lfd == -1)
{
- close(cfd);
- close(lfd);
+ anope_close(cfd);
+ anope_close(lfd);
return -1;
}
if (bind(lfd, &localhost.sa, localhost.size()) == -1)
{
- close(cfd);
- close(lfd);
+ anope_close(cfd);
+ anope_close(lfd);
return -1;
}
if (listen(lfd, 1) == -1)
{
- close(cfd);
- close(lfd);
+ anope_close(cfd);
+ anope_close(lfd);
return -1;
}
@@ -39,16 +40,16 @@ int pipe(int fds[2])
if (connect(cfd, &lfd_addr.sa, lfd_addr.size()))
{
- close(cfd);
- close(lfd);
+ anope_close(cfd);
+ anope_close(lfd);
return -1;
}
int afd = accept(lfd, NULL, NULL);
- close(lfd);
+ anope_close(lfd);
if (afd == -1)
{
- close(cfd);
+ anope_close(cfd);
return -1;
}
diff --git a/src/win32/socket.h b/src/win32/socket.h
index 50262a708..4c1f182eb 100644
--- a/src/win32/socket.h
+++ b/src/win32/socket.h
@@ -25,7 +25,6 @@ extern CoreExport const char *windows_inet_ntop(int af, const void *src, char *d
extern CoreExport int fcntl(int fd, int cmd, int arg);
#ifndef WIN32_NO_OVERRIDE
-# define close windows_close
# define accept windows_accept
# define inet_pton windows_inet_pton
# define inet_ntop windows_inet_ntop
diff --git a/src/win32/windows.cpp b/src/win32/windows.cpp
index 1e621945e..785a38969 100644
--- a/src/win32/windows.cpp
+++ b/src/win32/windows.cpp
@@ -11,6 +11,12 @@
#ifdef _WIN32
#include "services.h"
+#include "anope.h"
+
+#include <io.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
static struct WindowsLanguage
{