From b7bc71e9879e135d0d0dfada79205980858c4ebb Mon Sep 17 00:00:00 2001
From: Stefan Weil <sw@weilnetz.de>
Date: Wed, 24 Apr 2019 11:24:47 +0200
Subject: [PATCH] Fix build for Windows

* winsock2.h is case sensitive, lower case is required for cross build.
* ws2tcpip.h is required for addrinfo.
* FreeAddrInfo conflicts with existing freeaddrinfo, so rename it.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 src/viewer/svutil.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/viewer/svutil.cpp b/src/viewer/svutil.cpp
index 22de1d441f..9612929119 100644
--- a/src/viewer/svutil.cpp
+++ b/src/viewer/svutil.cpp
@@ -35,7 +35,8 @@
 
 #ifdef _WIN32
 #pragma comment(lib, "Ws2_32.lib")
-#  include <WinSock2.h>  // for fd_set, send, ..
+#  include <winsock2.h>  // for fd_set, send, ..
+#  include <ws2tcpip.h>  // for addrinfo
 #else
 #include <arpa/inet.h>
 #include <netdb.h>
@@ -316,7 +317,7 @@ static std::string ScrollViewCommand(std::string scrollview_path) {
 
 
 // Platform-independent freeaddrinfo()
-static void FreeAddrInfo(struct addrinfo* addr_info) {
+static void TessFreeAddrInfo(struct addrinfo* addr_info) {
   #if defined(__linux__)
   freeaddrinfo(addr_info);
   #else
@@ -352,7 +353,7 @@ static int GetAddrInfoNonLinux(const char* hostname, int port,
 #endif
 
   if (name == nullptr) {
-    FreeAddrInfo(*addr_info);
+    TessFreeAddrInfo(*addr_info);
     *addr_info = nullptr;
     return -1;
   }
@@ -441,7 +442,7 @@ SVNetwork::SVNetwork(const char* hostname, int port) {
       }
     }
   }
-  FreeAddrInfo(addr_info);
+  TessFreeAddrInfo(addr_info);
 }
 
 SVNetwork::~SVNetwork() {