summaryrefslogtreecommitdiff
path: root/src/compat
diff options
context:
space:
mode:
authorAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
committerAlberto Gonzalez Iniesta <agi@inittab.org>2016-12-27 18:25:47 +0100
commit79f3537f69e125f19f59c36aa090120a63186a54 (patch)
tree2089a3b7dac990841dbc2e4d9b2f535b82dbb0af /src/compat
parentf2137fedb30cb87448eb03b2f288920df6187571 (diff)
parent3a2bbdb05ca6a6996e424c9fb225cb0d53804125 (diff)
Merge tag 'upstream/2.4.0'
Upstream version 2.4.0
Diffstat (limited to 'src/compat')
-rw-r--r--src/compat/Makefile.am2
-rw-r--r--src/compat/Makefile.in8
-rw-r--r--src/compat/compat-basename.c15
-rw-r--r--src/compat/compat-daemon.c79
-rw-r--r--src/compat/compat-dirname.c151
-rw-r--r--src/compat/compat-gettimeofday.c98
-rw-r--r--src/compat/compat-inet_ntop.c42
-rw-r--r--src/compat/compat-inet_pton.c42
-rw-r--r--src/compat/compat-versionhelpers.h51
-rw-r--r--src/compat/compat.h14
10 files changed, 281 insertions, 221 deletions
diff --git a/src/compat/Makefile.am b/src/compat/Makefile.am
index 0a9d1c2..444a8f8 100644
--- a/src/compat/Makefile.am
+++ b/src/compat/Makefile.am
@@ -5,7 +5,7 @@
# packet encryption, packet authentication, and
# packet compression.
#
-# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+# Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
#
diff --git a/src/compat/Makefile.in b/src/compat/Makefile.in
index 9232d31..e9d589f 100644
--- a/src/compat/Makefile.in
+++ b/src/compat/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.14.1 from Makefile.am.
+# Makefile.in generated by automake 1.13.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994-2013 Free Software Foundation, Inc.
@@ -21,7 +21,7 @@
# packet encryption, packet authentication, and
# packet compression.
#
-# Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+# Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
# Copyright (C) 2006-2012 Alon Bar-Lev <alon.barlev@gmail.com>
#
@@ -438,14 +438,14 @@ distclean-compile:
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c $<
.c.obj:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c `$(CYGPATH_W) '$<'`
.c.lo:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
diff --git a/src/compat/compat-basename.c b/src/compat/compat-basename.c
index a057691..b7b5c43 100644
--- a/src/compat/compat-basename.c
+++ b/src/compat/compat-basename.c
@@ -37,14 +37,15 @@
* This version is extended to handle both / and \ in path names
*/
char *
-basename (char *filename)
+basename(char *filename)
{
- char *p = strrchr (filename, '/');
- if (!p) {
- /* If NULL, check for \ instead ... might be Windows a path */
- p = strrchr (filename, '\\');
- }
- return p ? p + 1 : (char *) filename;
+ char *p = strrchr(filename, '/');
+ if (!p)
+ {
+ /* If NULL, check for \ instead ... might be Windows a path */
+ p = strrchr(filename, '\\');
+ }
+ return p ? p + 1 : (char *) filename;
}
#endif /* HAVE_BASENAME */
diff --git a/src/compat/compat-daemon.c b/src/compat/compat-daemon.c
index dde96a2..5093942 100644
--- a/src/compat/compat-daemon.c
+++ b/src/compat/compat-daemon.c
@@ -58,43 +58,52 @@ int
daemon(int nochdir, int noclose)
{
#if defined(HAVE_FORK) && defined(HAVE_SETSID)
- switch (fork()) {
- case -1:
- return (-1);
- case 0:
- break;
- default:
- exit(0);
- }
-
- if (setsid() == -1)
- return (-1);
-
- if (!nochdir)
- chdir("/");
-
- if (!noclose) {
+ switch (fork()) {
+ case -1:
+ return (-1);
+
+ case 0:
+ break;
+
+ default:
+ exit(0);
+ }
+
+ if (setsid() == -1)
+ {
+ return (-1);
+ }
+
+ if (!nochdir)
+ {
+ chdir("/");
+ }
+
+ if (!noclose)
+ {
#if defined(HAVE_DUP) && defined(HAVE_DUP2)
- int fd;
- if ((fd = open ("/dev/null", O_RDWR, 0)) != -1) {
- dup2 (fd, 0);
- dup2 (fd, 1);
- dup2 (fd, 2);
- if (fd > 2) {
- close (fd);
- }
- }
-#endif
- }
-
- return 0;
-#else
- (void)nochdir;
- (void)noclose;
- errno = EFAULT;
- return -1;
+ int fd;
+ if ((fd = open("/dev/null", O_RDWR, 0)) != -1)
+ {
+ dup2(fd, 0);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ if (fd > 2)
+ {
+ close(fd);
+ }
+ }
#endif
+ }
+
+ return 0;
+#else /* if defined(HAVE_FORK) && defined(HAVE_SETSID) */
+ (void)nochdir;
+ (void)noclose;
+ errno = EFAULT;
+ return -1;
+#endif /* if defined(HAVE_FORK) && defined(HAVE_SETSID) */
}
-#endif
+#endif /* ifndef HAVE_DAEMON */
diff --git a/src/compat/compat-dirname.c b/src/compat/compat-dirname.c
index 8878595..7687108 100644
--- a/src/compat/compat-dirname.c
+++ b/src/compat/compat-dirname.c
@@ -41,79 +41,102 @@
static const char *
__memrchr(const char *str, int c, size_t n)
{
- const char *end = str;
-
- end += n - 1; /* Go to the end of the string */
- while (end >= str) {
- if(c == *end)
- return end;
- else
- end--;
- }
- return NULL;
+ const char *end = str;
+
+ end += n - 1; /* Go to the end of the string */
+ while (end >= str) {
+ if (c == *end)
+ {
+ return end;
+ }
+ else
+ {
+ end--;
+ }
+ }
+ return NULL;
}
/* Modified version based on glibc-2.14.1 by Ulrich Drepper <drepper@akkadia.org>
* This version is extended to handle both / and \ in path names.
*/
char *
-dirname (char *path)
+dirname(char *path)
{
- static const char dot[] = ".";
- char *last_slash;
- char separator = '/';
-
- /* Find last '/'. */
- last_slash = path != NULL ? strrchr (path, '/') : NULL;
- /* If NULL, check for \ instead ... might be Windows a path */
- if (!last_slash) {
- last_slash = path != NULL ? strrchr (path, '\\') : NULL;
- separator = last_slash ? '\\' : '/'; /* Change the separator if \ was found */
- }
-
- if (last_slash != NULL && last_slash != path && last_slash[1] == '\0') {
- /* Determine whether all remaining characters are slashes. */
- char *runp;
-
- for (runp = last_slash; runp != path; --runp)
- if (runp[-1] != separator)
- break;
-
- /* The '/' is the last character, we have to look further. */
- if (runp != path)
- last_slash = (char *) __memrchr (path, separator, runp - path);
+ static const char dot[] = ".";
+ char *last_slash;
+ char separator = '/';
+
+ /* Find last '/'. */
+ last_slash = path != NULL ? strrchr(path, '/') : NULL;
+ /* If NULL, check for \ instead ... might be Windows a path */
+ if (!last_slash)
+ {
+ last_slash = path != NULL ? strrchr(path, '\\') : NULL;
+ separator = last_slash ? '\\' : '/'; /* Change the separator if \ was found */
+ }
+
+ if (last_slash != NULL && last_slash != path && last_slash[1] == '\0')
+ {
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != separator)
+ {
+ break;
+ }
+
+ /* The '/' is the last character, we have to look further. */
+ if (runp != path)
+ {
+ last_slash = (char *) __memrchr(path, separator, runp - path);
+ }
+ }
+
+ if (last_slash != NULL)
+ {
+ /* Determine whether all remaining characters are slashes. */
+ char *runp;
+
+ for (runp = last_slash; runp != path; --runp)
+ if (runp[-1] != separator)
+ {
+ break;
+ }
+
+ /* Terminate the path. */
+ if (runp == path)
+ {
+ /* The last slash is the first character in the string. We have to
+ * return "/". As a special case we have to return "//" if there
+ * are exactly two slashes at the beginning of the string. See
+ * XBD 4.10 Path Name Resolution for more information. */
+ if (last_slash == path + 1)
+ {
+ ++last_slash;
+ }
+ else
+ {
+ last_slash = path + 1;
+ }
+ }
+ else
+ {
+ last_slash = runp;
+ }
+
+ last_slash[0] = '\0';
+ }
+ else
+ {
+ /* This assignment is ill-designed but the XPG specs require to
+ * return a string containing "." in any case no directory part is
+ * found and so a static and constant string is required. */
+ path = (char *) dot;
}
- if (last_slash != NULL) {
- /* Determine whether all remaining characters are slashes. */
- char *runp;
-
- for (runp = last_slash; runp != path; --runp)
- if (runp[-1] != separator)
- break;
-
- /* Terminate the path. */
- if (runp == path) {
- /* The last slash is the first character in the string. We have to
- return "/". As a special case we have to return "//" if there
- are exactly two slashes at the beginning of the string. See
- XBD 4.10 Path Name Resolution for more information. */
- if (last_slash == path + 1)
- ++last_slash;
- else
- last_slash = path + 1;
- }
- else
- last_slash = runp;
-
- last_slash[0] = '\0';
- } else
- /* This assignment is ill-designed but the XPG specs require to
- return a string containing "." in any case no directory part is
- found and so a static and constant string is required. */
- path = (char *) dot;
-
- return path;
+ return path;
}
#endif /* HAVE_DIRNAME */
diff --git a/src/compat/compat-gettimeofday.c b/src/compat/compat-gettimeofday.c
index 19feaae..d53e360 100644
--- a/src/compat/compat-gettimeofday.c
+++ b/src/compat/compat-gettimeofday.c
@@ -5,7 +5,7 @@
* packet encryption, packet authentication, and
* packet compression.
*
- * Copyright (C) 2002-2010 OpenVPN Technologies, Inc. <sales@openvpn.net>
+ * Copyright (C) 2002-2017 OpenVPN Technologies, Inc. <sales@openvpn.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
@@ -48,12 +48,12 @@ static unsigned int last_msec = 0;
static int bt_last = 0;
static void
-gettimeofday_calibrate (void)
+gettimeofday_calibrate(void)
{
- const time_t t = time(NULL);
- const DWORD gtc = GetTickCount();
- gtc_base = t - gtc/1000;
- gtc_last = gtc;
+ const time_t t = time(NULL);
+ const DWORD gtc = GetTickCount();
+ gtc_base = t - gtc/1000;
+ gtc_last = gtc;
}
/*
@@ -62,68 +62,72 @@ gettimeofday_calibrate (void)
* more processor cycles than GetTickCount.
*/
int
-gettimeofday (struct timeval *tv, void *tz)
+gettimeofday(struct timeval *tv, void *tz)
{
- const DWORD gtc = GetTickCount();
- int bt = 0;
- time_t sec;
- unsigned int msec;
- const int backtrack_hold_seconds = 10;
+ const DWORD gtc = GetTickCount();
+ int bt = 0;
+ time_t sec;
+ unsigned int msec;
+ const int backtrack_hold_seconds = 10;
- (void)tz;
+ (void)tz;
- /* recalibrate at the dreaded 49.7 day mark */
- if (!gtc_base || gtc < gtc_last)
- gettimeofday_calibrate ();
- gtc_last = gtc;
+ /* recalibrate at the dreaded 49.7 day mark */
+ if (!gtc_base || gtc < gtc_last)
+ {
+ gettimeofday_calibrate();
+ }
+ gtc_last = gtc;
- sec = gtc_base + gtc / 1000;
- msec = gtc % 1000;
+ sec = gtc_base + gtc / 1000;
+ msec = gtc % 1000;
- if (sec == last_sec)
+ if (sec == last_sec)
{
- if (msec < last_msec)
- {
- msec = last_msec;
- bt = 1;
- }
+ if (msec < last_msec)
+ {
+ msec = last_msec;
+ bt = 1;
+ }
}
- else if (sec < last_sec)
+ else if (sec < last_sec)
{
- /* We try to dampen out backtracks of less than backtrack_hold_seconds.
- Larger backtracks will be passed through and dealt with by the
- TIME_BACKTRACK_PROTECTION code (if enabled) */
- if (sec > last_sec - backtrack_hold_seconds)
- {
- sec = last_sec;
- msec = last_msec;
- }
- bt = 1;
+ /* We try to dampen out backtracks of less than backtrack_hold_seconds.
+ * Larger backtracks will be passed through and dealt with by the
+ * TIME_BACKTRACK_PROTECTION code (if enabled) */
+ if (sec > last_sec - backtrack_hold_seconds)
+ {
+ sec = last_sec;
+ msec = last_msec;
+ }
+ bt = 1;
}
- tv->tv_sec = (long)last_sec = (long)sec;
- tv->tv_usec = (last_msec = msec) * 1000;
+ tv->tv_sec = (long)last_sec = (long)sec;
+ tv->tv_usec = (last_msec = msec) * 1000;
- if (bt && !bt_last)
- gettimeofday_calibrate ();
- bt_last = bt;
+ if (bt && !bt_last)
+ {
+ gettimeofday_calibrate();
+ }
+ bt_last = bt;
- return 0;
+ return 0;
}
-#else
+#else /* ifdef _WIN32 */
#ifdef HAVE_TIME_H
#include <time.h>
#endif
int
-gettimeofday (struct timeval *tv, void *tz)
+gettimeofday(struct timeval *tv, void *tz)
{
- (void)tz;
- tv->tv_sec = time(NULL);
- tv->tv_usec = 0;
- return 0;
+ (void)tz;
+ tv->tv_sec = time(NULL);
+ tv->tv_usec = 0;
+ return 0;
}
#endif /* _WIN32 */
diff --git a/src/compat/compat-inet_ntop.c b/src/compat/compat-inet_ntop.c
index 786c973..dd7abb5 100644
--- a/src/compat/compat-inet_ntop.c
+++ b/src/compat/compat-inet_ntop.c
@@ -46,31 +46,33 @@
const char *
inet_ntop(int af, const void *src, char *dst, socklen_t size)
{
- struct sockaddr_storage ss;
- unsigned long s = size;
+ struct sockaddr_storage ss;
+ unsigned long s = size;
- ZeroMemory(&ss, sizeof(ss));
- ss.ss_family = af;
+ ZeroMemory(&ss, sizeof(ss));
+ ss.ss_family = af;
- switch(af) {
- case AF_INET:
- ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
- break;
- case AF_INET6:
- ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
- break;
- default:
- return NULL;
- }
- /* cannot direclty use &size because of strict aliasing rules */
- return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0)?
- dst : NULL;
+ switch (af) {
+ case AF_INET:
+ ((struct sockaddr_in *)&ss)->sin_addr = *(struct in_addr *)src;
+ break;
+
+ case AF_INET6:
+ ((struct sockaddr_in6 *)&ss)->sin6_addr = *(struct in6_addr *)src;
+ break;
+
+ default:
+ return NULL;
+ }
+ /* cannot direclty use &size because of strict aliasing rules */
+ return (WSAAddressToString((struct sockaddr *)&ss, sizeof(ss), NULL, dst, &s) == 0) ?
+ dst : NULL;
}
-#else
+#else /* ifdef _WIN32 */
#error no emulation for inet_ntop
-#endif
+#endif /* ifdef _WIN32 */
-#endif
+#endif /* ifndef HAVE_INET_NTOP */
diff --git a/src/compat/compat-inet_pton.c b/src/compat/compat-inet_pton.c
index 5965f0d..1e41fa2 100644
--- a/src/compat/compat-inet_pton.c
+++ b/src/compat/compat-inet_pton.c
@@ -48,32 +48,34 @@
int
inet_pton(int af, const char *src, void *dst)
{
- struct sockaddr_storage ss;
- int size = sizeof(ss);
- char src_copy[INET6_ADDRSTRLEN+1];
+ struct sockaddr_storage ss;
+ int size = sizeof(ss);
+ char src_copy[INET6_ADDRSTRLEN+1];
- ZeroMemory(&ss, sizeof(ss));
- /* stupid non-const API */
- strncpy (src_copy, src, INET6_ADDRSTRLEN+1);
- src_copy[INET6_ADDRSTRLEN] = 0;
+ ZeroMemory(&ss, sizeof(ss));
+ /* stupid non-const API */
+ strncpy(src_copy, src, INET6_ADDRSTRLEN+1);
+ src_copy[INET6_ADDRSTRLEN] = 0;
- if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) {
- switch(af) {
- case AF_INET:
- *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
- return 1;
- case AF_INET6:
- *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
- return 1;
+ if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0)
+ {
+ switch (af) {
+ case AF_INET:
+ *(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr;
+ return 1;
+
+ case AF_INET6:
+ *(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr;
+ return 1;
+ }
}
- }
- return 0;
+ return 0;
}
-#else
+#else /* ifdef _WIN32 */
#error no emulation for inet_ntop
-#endif
+#endif /* ifdef _WIN32 */
-#endif
+#endif /* ifndef HAVE_INET_PTON */
diff --git a/src/compat/compat-versionhelpers.h b/src/compat/compat-versionhelpers.h
index f634091..a793056 100644
--- a/src/compat/compat-versionhelpers.h
+++ b/src/compat/compat-versionhelpers.h
@@ -18,64 +18,77 @@
#define _WIN32_WINNT_WINBLUE 0x0603
-VERSIONHELPERAPI IsWindowsVersionOrGreater(WORD major, WORD minor, WORD servpack)
+VERSIONHELPERAPI
+IsWindowsVersionOrGreater(WORD major, WORD minor, WORD servpack)
{
OSVERSIONINFOEXW vi = {sizeof(vi),major,minor,0,0,{0},servpack};
return VerifyVersionInfoW(&vi, VER_MAJORVERSION|VER_MINORVERSION|VER_SERVICEPACKMAJOR,
- VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(0,
- VER_MAJORVERSION,VER_GREATER_EQUAL),
- VER_MINORVERSION,VER_GREATER_EQUAL),
- VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL));
+ VerSetConditionMask(VerSetConditionMask(VerSetConditionMask(0,
+ VER_MAJORVERSION,VER_GREATER_EQUAL),
+ VER_MINORVERSION,VER_GREATER_EQUAL),
+ VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL));
}
-VERSIONHELPERAPI IsWindowsXPOrGreater(void) {
+VERSIONHELPERAPI
+IsWindowsXPOrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 0);
}
-VERSIONHELPERAPI IsWindowsXPSP1OrGreater(void) {
+VERSIONHELPERAPI
+IsWindowsXPSP1OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 1);
}
-VERSIONHELPERAPI IsWindowsXPSP2OrGreater(void) {
+VERSIONHELPERAPI
+IsWindowsXPSP2OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 2);
}
-VERSIONHELPERAPI IsWindowsXPSP3OrGreater(void) {
+VERSIONHELPERAPI
+IsWindowsXPSP3OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINXP), LOBYTE(_WIN32_WINNT_WINXP), 3);
}
-VERSIONHELPERAPI IsWindowsVistaOrGreater(void) {
+VERSIONHELPERAPI
+IsWindowsVistaOrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0);
}
-VERSIONHELPERAPI IsWindowsVistaSP1OrGreater(void) {
+VERSIONHELPERAPI
+IsWindowsVistaSP1OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 1);
}
-VERSIONHELPERAPI IsWindowsVistaSP2OrGreater(void) {
+VERSIONHELPERAPI
+IsWindowsVistaSP2OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 2);
}
-VERSIONHELPERAPI IsWindows7OrGreater(void) {
+VERSIONHELPERAPI
+IsWindows7OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0);
}
-VERSIONHELPERAPI IsWindows7SP1OrGreater(void) {
+VERSIONHELPERAPI
+IsWindows7SP1OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 1);
}
-VERSIONHELPERAPI IsWindows8OrGreater(void) {
+VERSIONHELPERAPI
+IsWindows8OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN8), LOBYTE(_WIN32_WINNT_WIN8), 0);
}
-VERSIONHELPERAPI IsWindows8Point1OrGreater(void) {
+VERSIONHELPERAPI
+IsWindows8Point1OrGreater(void) {
return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WINBLUE), LOBYTE(_WIN32_WINNT_WINBLUE), 0);
}
-VERSIONHELPERAPI IsWindowsServer(void) {
+VERSIONHELPERAPI
+IsWindowsServer(void) {
OSVERSIONINFOEXW vi = {sizeof(vi),0,0,0,0,{0},0,0,0,VER_NT_WORKSTATION};
return !VerifyVersionInfoW(&vi, VER_PRODUCT_TYPE, VerSetConditionMask(0, VER_PRODUCT_TYPE, VER_EQUAL));
}
-#endif
-#endif
+#endif /* if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && !defined(__WIDL__) */
+#endif /* ifndef _INC_VERSIONHELPERS */
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 021573e..75bfaed 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -42,27 +42,33 @@
#endif
#ifndef HAVE_DIRNAME
-char * dirname(char *str);
+char *dirname(char *str);
+
#endif /* HAVE_DIRNAME */
#ifndef HAVE_BASENAME
-char * basename(char *str);
+char *basename(char *str);
+
#endif /* HAVE_BASENAME */
#ifndef HAVE_GETTIMEOFDAY
-int gettimeofday (struct timeval *tv, void *tz);
+int gettimeofday(struct timeval *tv, void *tz);
+
#endif
#ifndef HAVE_DAEMON
int daemon(int nochdir, int noclose);
+
#endif
#ifndef HAVE_INET_NTOP
-const char * inet_ntop(int af, const void *src, char *dst, socklen_t size);
+const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
+
#endif
#ifndef HAVE_INET_PTON
int inet_pton(int af, const char *src, void *dst);
+
#endif
#endif /* COMPAT_H */