summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.gitignore3
-rw-r--r--ext/kissdb/kissdb.c13
-rw-r--r--node/Demarc.cpp4
-rw-r--r--node/Demarc.hpp4
-rw-r--r--node/Node.cpp2
-rw-r--r--node/Utils.cpp6
-rw-r--r--node/Utils.hpp2
-rw-r--r--selftest.cpp10
-rw-r--r--vsprojects/SelfTest/SelfTest.cpp11
-rw-r--r--vsprojects/SelfTest/SelfTest.vcxproj13
-rw-r--r--vsprojects/SelfTest/SelfTest.vcxproj.filters21
-rw-r--r--vsprojects/SelfTest/stdafx.cpp8
-rw-r--r--vsprojects/SelfTest/stdafx.h15
13 files changed, 51 insertions, 61 deletions
diff --git a/.gitignore b/.gitignore
index c27c197b..78bab478 100755
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,6 @@ mac-tap/tuntap/tap.kext
/ipch
/ZeroTierOne.v11.suo
/ZeroTierOne.opensdf
+/vsprojects/SelfTest/Debug
+/vsprojects/SelfTest/SelfTest.vcxproj.user
+/Debug
diff --git a/ext/kissdb/kissdb.c b/ext/kissdb/kissdb.c
index ab33a5b3..28346a47 100644
--- a/ext/kissdb/kissdb.c
+++ b/ext/kissdb/kissdb.c
@@ -47,10 +47,21 @@ int KISSDB_open(
uint64_t *httmp;
uint64_t *hash_tables_rea;
+#ifdef _WIN32
+ db->f = (FILE *)0;
+ fopen_s(&db->f,path,((mode == KISSDB_OPEN_MODE_RWREPLACE) ? "w+b" : (((mode == KISSDB_OPEN_MODE_RDWR)||(mode == KISSDB_OPEN_MODE_RWCREAT)) ? "r+b" : "rb")));
+#else
db->f = fopen(path,((mode == KISSDB_OPEN_MODE_RWREPLACE) ? "w+b" : (((mode == KISSDB_OPEN_MODE_RDWR)||(mode == KISSDB_OPEN_MODE_RWCREAT)) ? "r+b" : "rb")));
+#endif
if (!db->f) {
- if (mode == KISSDB_OPEN_MODE_RWCREAT)
+ if (mode == KISSDB_OPEN_MODE_RWCREAT) {
+#ifdef _WIN32
+ db->f = (FILE *)0;
+ fopen_s(&db->f,path,"w+b");
+#else
db->f = fopen(path,"w+b");
+#endif
+ }
if (!db->f)
return KISSDB_ERROR_IO;
}
diff --git a/node/Demarc.cpp b/node/Demarc.cpp
index 9c78fb65..0bb1646d 100644
--- a/node/Demarc.cpp
+++ b/node/Demarc.cpp
@@ -44,8 +44,8 @@
namespace ZeroTier {
-const Demarc::Port Demarc::ANY_PORT;
-const Demarc::Port Demarc::NULL_PORT;
+const Demarc::Port Demarc::ANY_PORT = (Port)0xffffffffffffffffULL;
+const Demarc::Port Demarc::NULL_PORT = (Port)0;
Demarc::Demarc(const RuntimeEnvironment *renv) :
_r(renv)
diff --git a/node/Demarc.hpp b/node/Demarc.hpp
index 721dc0c8..670e5b0a 100644
--- a/node/Demarc.hpp
+++ b/node/Demarc.hpp
@@ -64,12 +64,12 @@ public:
/**
* Port identifier used to refer to any port
*/
- static const Port ANY_PORT = (Port)0xffffffffffffffffULL;
+ static const Port ANY_PORT;
/**
* Port identifier used to refer to null port / port not found
*/
- static const Port NULL_PORT = (Port)0;
+ static const Port NULL_PORT;
Demarc(const RuntimeEnvironment *renv);
~Demarc();
diff --git a/node/Node.cpp b/node/Node.cpp
index e6910a56..bb68cdaf 100644
--- a/node/Node.cpp
+++ b/node/Node.cpp
@@ -351,7 +351,7 @@ Node::ReasonForTermination Node::run()
// Make sure networks.d exists
#ifdef __WINDOWS__
- CreateDirectory((_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str(),NULL);
+ CreateDirectoryA((_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str(),NULL);
#else
mkdir((_r->homePath + ZT_PATH_SEPARATOR_S + "networks.d").c_str(),0700);
#endif
diff --git a/node/Utils.cpp b/node/Utils.cpp
index 4f04fb0c..32cfe2d1 100644
--- a/node/Utils.cpp
+++ b/node/Utils.cpp
@@ -220,11 +220,11 @@ std::map<std::string,bool> Utils::listDirectory(const char *path)
#ifdef __WINDOWS__
HANDLE hFind;
- WIN32_FIND_DATA ffd;
- if ((hFind = FindFirstFile((std::string(path) + "\\*").c_str(),&ffd)) != INVALID_HANDLE_VALUE) {
+ WIN32_FIND_DATAA ffd;
+ if ((hFind = FindFirstFileA((std::string(path) + "\\*").c_str(),&ffd)) != INVALID_HANDLE_VALUE) {
do {
r[std::string(ffd.cFileName)] = ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
- } while (FindNextFile(hFind,&ffd));
+ } while (FindNextFileA(hFind,&ffd));
FindClose(hFind);
}
#else
diff --git a/node/Utils.hpp b/node/Utils.hpp
index 9d565636..76448294 100644
--- a/node/Utils.hpp
+++ b/node/Utils.hpp
@@ -75,7 +75,7 @@ public:
throw()
{
#ifdef __WINDOWS__
- return (DeleteFile(path) != FALSE);
+ return (DeleteFileA(path) != FALSE);
#else
return (unlink(path) == 0);
#endif
diff --git a/selftest.cpp b/selftest.cpp
index 0792c1ee..305b9fad 100644
--- a/selftest.cpp
+++ b/selftest.cpp
@@ -51,6 +51,10 @@
#include <openssl/rand.h>
+#ifdef __WINDOWS__
+#include <tchar.h>
+#endif
+
using namespace ZeroTier;
// ---------------------------------------------------------------------------
@@ -394,12 +398,16 @@ static int testRateLimiter()
return 0;
}
+#ifdef __WINDOWS__
+int _tmain(int argc, _TCHAR* argv[])
+#else
int main(int argc,char **argv)
+#endif
{
int r = 0;
_initLibCrypto();
- srand(time(0));
+ srand((unsigned int)time(0));
r |= testCrypto();
r |= testPacket();
diff --git a/vsprojects/SelfTest/SelfTest.cpp b/vsprojects/SelfTest/SelfTest.cpp
deleted file mode 100644
index 60a736c5..00000000
--- a/vsprojects/SelfTest/SelfTest.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
-// SelfTest.cpp : Defines the entry point for the console application.
-//
-
-#include "stdafx.h"
-
-
-int _tmain(int argc, _TCHAR* argv[])
-{
- return 0;
-}
-
diff --git a/vsprojects/SelfTest/SelfTest.vcxproj b/vsprojects/SelfTest/SelfTest.vcxproj
index b8e23141..0be2d739 100644
--- a/vsprojects/SelfTest/SelfTest.vcxproj
+++ b/vsprojects/SelfTest/SelfTest.vcxproj
@@ -47,7 +47,7 @@
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
- <PrecompiledHeader>Use</PrecompiledHeader>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -57,6 +57,7 @@
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
+ <AdditionalDependencies>$(SolutionDir)\ext\bin\libcrypto\win32-vs2012\libeay32.lib;wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -119,10 +120,12 @@
<ClInclude Include="..\..\node\Topology.hpp" />
<ClInclude Include="..\..\node\UdpSocket.hpp" />
<ClInclude Include="..\..\node\Utils.hpp" />
- <ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
+ <ClCompile Include="..\..\ext\kissdb\kissdb.c" />
+ <ClCompile Include="..\..\ext\lz4\lz4.c" />
+ <ClCompile Include="..\..\ext\lz4\lz4hc.c" />
<ClCompile Include="..\..\node\Defaults.cpp" />
<ClCompile Include="..\..\node\Demarc.cpp" />
<ClCompile Include="..\..\node\EllipticCurveKeyPair.cpp" />
@@ -145,11 +148,7 @@
<ClCompile Include="..\..\node\Topology.cpp" />
<ClCompile Include="..\..\node\UdpSocket.cpp" />
<ClCompile Include="..\..\node\Utils.cpp" />
- <ClCompile Include="SelfTest.cpp" />
- <ClCompile Include="stdafx.cpp">
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
- <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
- </ClCompile>
+ <ClCompile Include="..\..\selftest.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
diff --git a/vsprojects/SelfTest/SelfTest.vcxproj.filters b/vsprojects/SelfTest/SelfTest.vcxproj.filters
index f84bfebb..3704863e 100644
--- a/vsprojects/SelfTest/SelfTest.vcxproj.filters
+++ b/vsprojects/SelfTest/SelfTest.vcxproj.filters
@@ -15,9 +15,6 @@
</Filter>
</ItemGroup>
<ItemGroup>
- <ClInclude Include="stdafx.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -149,12 +146,6 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
- <ClCompile Include="stdafx.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="SelfTest.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="..\..\node\Defaults.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -221,5 +212,17 @@
<ClCompile Include="..\..\node\Utils.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\..\selftest.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\ext\kissdb\kissdb.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\ext\lz4\lz4.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\ext\lz4\lz4hc.c">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/vsprojects/SelfTest/stdafx.cpp b/vsprojects/SelfTest/stdafx.cpp
deleted file mode 100644
index c502d9fe..00000000
--- a/vsprojects/SelfTest/stdafx.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-// stdafx.cpp : source file that includes just the standard includes
-// SelfTest.pch will be the pre-compiled header
-// stdafx.obj will contain the pre-compiled type information
-
-#include "stdafx.h"
-
-// TODO: reference any additional headers you need in STDAFX.H
-// and not in this file
diff --git a/vsprojects/SelfTest/stdafx.h b/vsprojects/SelfTest/stdafx.h
deleted file mode 100644
index b005a839..00000000
--- a/vsprojects/SelfTest/stdafx.h
+++ /dev/null
@@ -1,15 +0,0 @@
-// stdafx.h : include file for standard system include files,
-// or project specific include files that are used frequently, but
-// are changed infrequently
-//
-
-#pragma once
-
-#include "targetver.h"
-
-#include <stdio.h>
-#include <tchar.h>
-
-
-
-// TODO: reference additional headers your program requires here