From 835f4beef18821a3b42db73f1d6176f62e172fb4 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Thu, 4 Apr 2019 14:30:47 +0300
Subject: [PATCH] All code now works in Visual Studio

---
 cv-node/include/elas.h         | 16 ++++++++--------
 cv-node/lib/elas/descriptor.h  | 16 ++++++++--------
 cv-node/lib/elas/filter.cpp    | 22 +++++++++++-----------
 cv-node/lib/elas/filter.h      | 22 +++++++++++-----------
 cv-node/lib/elas/matrix.h      | 16 ++++++++--------
 cv-node/src/main.cpp           |  4 ++++
 net/cpp/src/main.cpp           |  6 ++++++
 net/cpp/test/CMakeLists.txt    |  1 -
 net/cpp/test/p2p_base_unit.cpp |  5 +++++
 9 files changed, 61 insertions(+), 47 deletions(-)

diff --git a/cv-node/include/elas.h b/cv-node/include/elas.h
index a88439e6a..e10acf0c7 100644
--- a/cv-node/include/elas.h
+++ b/cv-node/include/elas.h
@@ -35,14 +35,14 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA
 #ifndef _MSC_VER
   #include <stdint.h>
 #else
-  typedef __int8            int8_t;
-  typedef __int16           int16_t;
-  typedef __int32           int32_t;
-  typedef __int64           int64_t;
-  typedef unsigned __int8   uint8_t;
-  typedef unsigned __int16  uint16_t;
-  typedef unsigned __int32  uint32_t;
-  typedef unsigned __int64  uint64_t;
+//  typedef __int8            int8_t;
+//  typedef __int16           int16_t;
+//  typedef __int32           int32_t;
+//  typedef __int64           int64_t;
+//  typedef unsigned __int8   uint8_t;
+//  typedef unsigned __int16  uint16_t;
+//  typedef unsigned __int32  uint32_t;
+//  typedef unsigned __int64  uint64_t;
 #endif
 
 #ifdef PROFILE
diff --git a/cv-node/lib/elas/descriptor.h b/cv-node/lib/elas/descriptor.h
index 7abb0e718..fe2c0ab12 100644
--- a/cv-node/lib/elas/descriptor.h
+++ b/cv-node/lib/elas/descriptor.h
@@ -36,14 +36,14 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA
 #ifndef _MSC_VER
   #include <stdint.h>
 #else
-  typedef __int8            int8_t;
-  typedef __int16           int16_t;
-  typedef __int32           int32_t;
-  typedef __int64           int64_t;
-  typedef unsigned __int8   uint8_t;
-  typedef unsigned __int16  uint16_t;
-  typedef unsigned __int32  uint32_t;
-  typedef unsigned __int64  uint64_t;
+//  typedef __int8            int8_t;
+//  typedef __int16           int16_t;
+//  typedef __int32           int32_t;
+//  typedef __int64           int64_t;
+//  typedef unsigned __int8   uint8_t;
+//  typedef unsigned __int16  uint16_t;
+//  typedef unsigned __int32  uint32_t;
+//  typedef unsigned __int64  uint64_t;
 #endif
 
 class Descriptor {
diff --git a/cv-node/lib/elas/filter.cpp b/cv-node/lib/elas/filter.cpp
index d4f795418..f98a21a49 100644
--- a/cv-node/lib/elas/filter.cpp
+++ b/cv-node/lib/elas/filter.cpp
@@ -26,18 +26,18 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA
 #include "filter.h"
 
 // define fixed-width datatypes for Visual Studio projects
-#ifndef _MSC_VER
+//#ifndef _MSC_VER
   #include <stdint.h>
-#else
-  typedef __int8            int8_t;
-  typedef __int16           int16_t;
-  typedef __int32           int32_t;
-  typedef __int64           int64_t;
-  typedef unsigned __int8   uint8_t;
-  typedef unsigned __int16  uint16_t;
-  typedef unsigned __int32  uint32_t;
-  typedef unsigned __int64  uint64_t;
-#endif
+//#else
+//  typedef __int8            int8_t;
+//  typedef __int16           int16_t;
+//  typedef __int32           int32_t;
+//  typedef __int64           int64_t;
+//  typedef unsigned __int8   uint8_t;
+//  typedef unsigned __int16  uint16_t;
+//  typedef unsigned __int32  uint32_t;
+//  typedef unsigned __int64  uint64_t;
+//#endif
 
 // fast filters: implements 3x3 and 5x5 sobel filters and 
 //               5x5 blob and corner filters based on SSE2/3 instructions
diff --git a/cv-node/lib/elas/filter.h b/cv-node/lib/elas/filter.h
index 59af83ef0..4567bd9b7 100644
--- a/cv-node/lib/elas/filter.h
+++ b/cv-node/lib/elas/filter.h
@@ -26,18 +26,18 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA
 #include <pmmintrin.h>
 
 // define fixed-width datatypes for Visual Studio projects
-#ifndef _MSC_VER
+//#ifndef _MSC_VER
   #include <stdint.h>
-#else
-  typedef __int8            int8_t;
-  typedef __int16           int16_t;
-  typedef __int32           int32_t;
-  typedef __int64           int64_t;
-  typedef unsigned __int8   uint8_t;
-  typedef unsigned __int16  uint16_t;
-  typedef unsigned __int32  uint32_t;
-  typedef unsigned __int64  uint64_t;
-#endif
+//#else
+//  typedef __int8            int8_t;
+//  typedef __int16           int16_t;
+//  typedef __int32           int32_t;
+//  typedef __int64           int64_t;
+//  typedef unsigned __int8   uint8_t;
+//  typedef unsigned __int16  uint16_t;
+//  typedef unsigned __int32  uint32_t;
+//  typedef unsigned __int64  uint64_t;
+//#endif
 
 // fast filters: implements 3x3 and 5x5 sobel filters and 
 //               5x5 blob and corner filters based on SSE2/3 instructions
diff --git a/cv-node/lib/elas/matrix.h b/cv-node/lib/elas/matrix.h
index 5ec306cf1..c559de7e9 100644
--- a/cv-node/lib/elas/matrix.h
+++ b/cv-node/lib/elas/matrix.h
@@ -31,14 +31,14 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA
 #ifndef _MSC_VER
   #include <stdint.h>
 #else
-  typedef __int8            int8_t;
-  typedef __int16           int16_t;
-  typedef __int32           int32_t;
-  typedef __int64           int64_t;
-  typedef unsigned __int8   uint8_t;
-  typedef unsigned __int16  uint16_t;
-  typedef unsigned __int32  uint32_t;
-  typedef unsigned __int64  uint64_t;
+//  typedef __int8            int8_t;
+//  typedef __int16           int16_t;
+//  typedef __int32           int32_t;
+//  typedef __int64           int64_t;
+//  typedef unsigned __int8   uint8_t;
+//  typedef unsigned __int16  uint16_t;
+//  typedef unsigned __int32  uint32_t;
+//  typedef unsigned __int64  uint64_t;
 #endif
 
 #define endll endl << endl // double end line definition
diff --git a/cv-node/src/main.cpp b/cv-node/src/main.cpp
index 2db3b03c8..ddc805e4d 100644
--- a/cv-node/src/main.cpp
+++ b/cv-node/src/main.cpp
@@ -26,6 +26,10 @@
 #include "opencv2/highgui.hpp"
 #include "opencv2/core/utility.hpp"
 
+#ifdef WIN32
+#pragma comment(lib, "Rpcrt4.lib")
+#endif
+
 using ftl::Calibrate;
 using ftl::LocalSource;
 using ftl::Display;
diff --git a/net/cpp/src/main.cpp b/net/cpp/src/main.cpp
index 74730cbdd..e5f0e4b7b 100644
--- a/net/cpp/src/main.cpp
+++ b/net/cpp/src/main.cpp
@@ -12,6 +12,7 @@
 
 #ifdef WIN32
 #pragma comment(lib, "Ws2_32.lib")
+#pragma comment(lib, "Rpcrt4.lib")
 #endif
 
 using std::string;
@@ -78,7 +79,12 @@ int main(int argc, const char **argv) {
 	std::thread nthread(run);
 	
 	while (!stop) {
+#ifndef WIN32
 		char *line = readline("> ");
+#else
+		char line[300];
+		fgets(line, 299, stdin);
+#endif
 		if (!line) break;
 		
 		handle_command(line);
diff --git a/net/cpp/test/CMakeLists.txt b/net/cpp/test/CMakeLists.txt
index 4b5777180..c87241f4d 100644
--- a/net/cpp/test/CMakeLists.txt
+++ b/net/cpp/test/CMakeLists.txt
@@ -32,7 +32,6 @@ add_dependencies(p2p_base_unit ftlnet)
 target_link_libraries(p2p_base_unit
 	ftlnet
 	${URIPARSER_LIBRARIES}
-	gflags
 	glog::glog
 	${UUID_LIBRARIES})
 
diff --git a/net/cpp/test/p2p_base_unit.cpp b/net/cpp/test/p2p_base_unit.cpp
index ee360c553..911360ffa 100644
--- a/net/cpp/test/p2p_base_unit.cpp
+++ b/net/cpp/test/p2p_base_unit.cpp
@@ -11,6 +11,11 @@
 typedef int ssize_t;
 #endif
 
+#ifdef WIN32
+#pragma comment(lib, "Ws2_32.lib")
+#pragma comment(lib, "Rpcrt4.lib")
+#endif
+
 using ftl::net::Dispatcher;
 using ftl::net::Protocol;
 using ftl::net::Socket;
-- 
GitLab