aboutsummaryrefslogtreecommitdiff
path: root/src/common/util.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-04-28 20:13:21 +0000
committerNick Mathewson <nickm@torproject.org>2004-04-28 20:13:21 +0000
commit7055f837abeca974d3b73ed26b6d26898daa9e89 (patch)
treec087acf0452d4da39409c5e68f67c06e7da17d1d /src/common/util.c
parentca8d50abeb260898a6657a06423667479a621a22 (diff)
downloadtor-7055f837abeca974d3b73ed26b6d26898daa9e89.tar
tor-7055f837abeca974d3b73ed26b6d26898daa9e89.tar.gz
Make Tor build on win32 with VC6 without warnings.
svn:r1739
Diffstat (limited to 'src/common/util.c')
-rw-r--r--src/common/util.c37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 64e3a9b5a..9c834db58 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3,6 +3,23 @@
/* $Id$ */
#include "orconfig.h"
+
+#ifdef MS_WINDOWS
+#define WIN32_WINNT 0x400
+#define _WIN32_WINNT 0x400
+#define WIN32_LEAN_AND_MEAN
+#if _MSC_VER > 1300
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#elif defined(_MSC_VER)
+#include <winsock.h>
+#endif
+#include <io.h>
+#include <process.h>
+#include <direct.h>
+#include <windows.h>
+#endif
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -27,6 +44,9 @@
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
#ifdef HAVE_SYS_LIMITS_H
#include <sys/limits.h>
#endif
@@ -57,17 +77,8 @@
#ifdef HAVE_GRP_H
#include <grp.h>
#endif
-
-#ifdef HAVE_WINSOCK_H
-#define WIN32_WINNT 0x400
-#define _WIN32_WINNT 0x400
-#define WIN32_LEAN_AND_MEAN
-#endif
-#if _MSC_VER > 1300
-#include <winsock2.h>
-#include <ws2tcpip.h>
-#elif defined(_MSC_VER)
-#include <winsock.h>
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
#endif
/* used by inet_addr, not defined on solaris anywhere!? */
@@ -152,13 +163,13 @@ void tor_strlower(char *s)
}
#ifndef UNALIGNED_INT_ACCESS_OK
-uint16_t get_uint16(char *cp)
+uint16_t get_uint16(const char *cp)
{
uint16_t v;
memcpy(&v,cp,2);
return v;
}
-uint32_t get_uint32(char *cp)
+uint32_t get_uint32(const char *cp)
{
uint32_t v;
memcpy(&v,cp,4);