]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - win/inspircd_win32wrapper.h
Merge pull request #1094 from SISheogorath/insp20+fixed-Override
[user/henk/code/inspircd.git] / win / inspircd_win32wrapper.h
index 1f9936caf20e5f5d033cb57c8609376621fd2212..d7ceb73aa46170a437f9468c9f958825e75bc20e 100644 (file)
@@ -63,6 +63,7 @@
 
 /* Disable the deprecation warnings.. it spams :P */
 #define _CRT_SECURE_NO_DEPRECATE
+#define _WINSOCK_DEPRECATED_NO_WARNINGS
 
 /* Normal windows (platform-specific) includes */
 #include <winsock2.h>
@@ -78,6 +79,8 @@
 #define strcasecmp _stricmp
 #define strncasecmp _strnicmp
 
+typedef int ssize_t;
+
 /* Convert formatted (xxx.xxx.xxx.xxx) string to in_addr struct */
 CoreExport int insp_inet_pton(int af, const char * src, void * dst);
 
@@ -88,9 +91,11 @@ CoreExport const char * insp_inet_ntop(int af, const void * src, char * dst, soc
 #define inet_pton insp_inet_pton
 #define inet_ntop insp_inet_ntop
 
-/* Safe printf functions aren't defined in VC++ */
+/* Safe printf functions aren't defined in VC++ releases older than v14 */
+#if _MSC_VER <= 1800
 #define snprintf _snprintf
 #define vsnprintf _vsnprintf
+#endif
 
 /* Unix-style sleep (argument is in seconds) */
 __inline void sleep(int seconds) { Sleep(seconds * 1000); }
@@ -106,9 +111,6 @@ __inline int inet_aton(const char *cp, struct in_addr *addr)
        return (addr->s_addr == INADDR_NONE) ? 0 : 1;
 };
 
-/* Handles colors in printf */
-int printf_c(const char * format, ...);
-
 /* getopt() wrapper */
 #define no_argument            0
 #define required_argument      1
@@ -137,11 +139,13 @@ struct DIR
        bool first;
 };
 
+#if _MSC_VER <= 1800
 struct timespec
 {
        time_t tv_sec;
        long tv_nsec;
 };
+#endif
 
 CoreExport DIR * opendir(const char * path);
 CoreExport dirent * readdir(DIR * handle);
@@ -189,5 +193,20 @@ void ::operator delete(void * ptr);
 
 #define DISABLE_WRITEV
 
+#include <exception>
+
+class CWin32Exception : public std::exception
+{
+public:
+       CWin32Exception();
+       CWin32Exception(const CWin32Exception& other);
+       virtual const char* what() const throw();
+       DWORD GetErrorCode();
+
+private:
+       char szErrorString[500];
+       DWORD dwErrorCode;
+};
+
 #endif