From 02a5b5c7f263913bd3d9b6977a1c6935e90c97eb Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Thu, 12 Nov 2015 14:42:58 +0100
Subject: 3rdParty fixes to enable compatibility with VS 2015

Included patches for future reference.

Test-Information:

Tested patches with VS 2015 Community and unit tests for
32 bit and 64 bit builds.

Change-Id: Ifa8d0ca3bf33010af8d8094c6df45f2a5702976c

diff --git a/3rdParty/Boost/03_boost_silence_VS2015_compat_warning.diff b/3rdParty/Boost/03_boost_silence_VS2015_compat_warning.diff
new file mode 100644
index 0000000..7cbfbdd
--- /dev/null
+++ b/3rdParty/Boost/03_boost_silence_VS2015_compat_warning.diff
@@ -0,0 +1,13 @@
+diff --git a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp
+index 842f086..3c0fbce 100644
+--- a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp
++++ b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp
+@@ -253,7 +253,7 @@
+ 
+ //
+ // last known and checked version is 18.00.20827.3 (VC12 RC, aka 2013 RC):
+-#if (_MSC_VER > 1800 && _MSC_FULL_VER > 180020827)
++#if (_MSC_VER > 1900)
+ #  if defined(BOOST_ASSERT_CONFIG)
+ #     error "Unknown compiler version - please run the configure tests and report the results"
+ #  else
diff --git a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp
index 842f086..3c0fbce 100644
--- a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp
+++ b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp
@@ -253,7 +253,7 @@
 
 //
 // last known and checked version is 18.00.20827.3 (VC12 RC, aka 2013 RC):
-#if (_MSC_VER > 1800 && _MSC_FULL_VER > 180020827)
+#if (_MSC_VER > 1900)
 #  if defined(BOOST_ASSERT_CONFIG)
 #     error "Unknown compiler version - please run the configure tests and report the results"
 #  else
diff --git a/3rdParty/LibIDN/01_libidn_VS2015_64bit_fixes.diff b/3rdParty/LibIDN/01_libidn_VS2015_64bit_fixes.diff
new file mode 100644
index 0000000..0d864bc
--- /dev/null
+++ b/3rdParty/LibIDN/01_libidn_VS2015_64bit_fixes.diff
@@ -0,0 +1,36 @@
+diff --git a/3rdParty/LibIDN/src/stringprep.c b/3rdParty/LibIDN/src/stringprep.c
+old mode 100644
+new mode 100755
+index 8ff28e6..19bf0d9
+--- a/3rdParty/LibIDN/src/stringprep.c
++++ b/3rdParty/LibIDN/src/stringprep.c
+@@ -33,6 +33,7 @@
+ 
+ #include <stdlib.h>
+ #include <string.h>
++#include <assert.h>
+ 
+ #include "stringprep.h"
+ 
+@@ -372,7 +373,7 @@ stringprep (char *in,
+   int rc;
+   char *utf8 = NULL;
+   uint32_t *ucs4 = NULL;
+-  size_t ucs4len, maxucs4len, adducs4len = 50;
++  size_t ucs4len = SIZE_MAX, maxucs4len = SIZE_MAX, adducs4len = 50;
+ 
+   do
+     {
+@@ -380,8 +381,10 @@ stringprep (char *in,
+ 
+       free (ucs4);
+       ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
+-      if (ucs4 == NULL)
+-	return STRINGPREP_ICONV_ERROR;
++	  if (ucs4 == NULL) {
++		  return STRINGPREP_ICONV_ERROR;
++	  }
++	  assert(ucs4len != SIZE_MAX);
+       maxucs4len = ucs4len + adducs4len;
+       newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
+       if (!newp)
diff --git a/3rdParty/LibIDN/SConscript b/3rdParty/LibIDN/SConscript
index cfe189b..e3ed839 100644
--- a/3rdParty/LibIDN/SConscript
+++ b/3rdParty/LibIDN/SConscript
@@ -19,6 +19,8 @@ if env.get("LIBIDN_BUNDLED", False) :
 
 		if env["PLATFORM"] == "win32" :
 			env["LIBIDN_FLAGS"]["CPPPATH"] += [Dir("stubs/win32")]
+			if float(env["MSVC_VERSION"]) < 14:
+				env["LIBIDN_FLAGS"]["CPPPATH"] += [Dir("stubs/win32/stdbool")]
 			if env["MSVC_VERSION"][:3] == "9.0" :
 				env["LIBIDN_FLAGS"]["CPPPATH"] += [Dir("stubs/win32/VC2008")]
 
@@ -52,6 +54,8 @@ if env.get("LIBIDN_BUNDLED", False) :
 		myenv.Append(CPPPATH = ["src", "stubs", "src/gl"])
 		if myenv["PLATFORM"] == "win32" :
 			myenv.Append(CPPPATH = "stubs/win32")
+			if float(env["MSVC_VERSION"]) < 14:
+				myenv.Append(CPPPATH = "stubs/win32/stdbool")
 			if myenv["MSVC_VERSION"][:3] == "9.0" :
 				myenv.Append(CPPPATH = "stubs/win32/VC2008")
 
diff --git a/3rdParty/LibIDN/src/stringprep.c b/3rdParty/LibIDN/src/stringprep.c
old mode 100644
new mode 100755
index 8ff28e6..19bf0d9
--- a/3rdParty/LibIDN/src/stringprep.c
+++ b/3rdParty/LibIDN/src/stringprep.c
@@ -33,6 +33,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <assert.h>
 
 #include "stringprep.h"
 
@@ -372,7 +373,7 @@ stringprep (char *in,
   int rc;
   char *utf8 = NULL;
   uint32_t *ucs4 = NULL;
-  size_t ucs4len, maxucs4len, adducs4len = 50;
+  size_t ucs4len = SIZE_MAX, maxucs4len = SIZE_MAX, adducs4len = 50;
 
   do
     {
@@ -380,8 +381,10 @@ stringprep (char *in,
 
       free (ucs4);
       ucs4 = stringprep_utf8_to_ucs4 (in, -1, &ucs4len);
-      if (ucs4 == NULL)
-	return STRINGPREP_ICONV_ERROR;
+	  if (ucs4 == NULL) {
+		  return STRINGPREP_ICONV_ERROR;
+	  }
+	  assert(ucs4len != SIZE_MAX);
       maxucs4len = ucs4len + adducs4len;
       newp = realloc (ucs4, maxucs4len * sizeof (uint32_t));
       if (!newp)
diff --git a/3rdParty/LibIDN/stubs/win32/stdbool.h b/3rdParty/LibIDN/stubs/win32/stdbool.h
deleted file mode 100644
index c789c92..0000000
--- a/3rdParty/LibIDN/stubs/win32/stdbool.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
-   Written by Adam Strzelecki <ono@java.pl>
-
-   This file is part of GNU Libidn.
-
-   GNU Libidn is free software: you can redistribute it and/or
-   modify it under the terms of either:
-
-     * the GNU Lesser General Public License as published by the Free
-       Software Foundation; either version 3 of the License, or (at
-       your option) any later version.
-
-   or
-
-     * the GNU General Public License as published by the Free
-       Software Foundation; either version 2 of the License, or (at
-       your option) any later version.
-
-   or both in parallel, as here.
-
-   GNU Libidn is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received copies of the GNU General Public License and
-   the GNU Lesser General Public License along with this program.  If
-   not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _STDBOOL_H
-#define _STDBOOL_H
-
-#define _Bool signed char
-enum { false = 0, true = 1 };
-#define bool _Bool
-#define false 0
-#define true 1
-#define __bool_true_false_are_defined 1
-
-#endif /* _STDBOOL_H */
diff --git a/3rdParty/LibIDN/stubs/win32/stdbool/stdbool.h b/3rdParty/LibIDN/stubs/win32/stdbool/stdbool.h
new file mode 100644
index 0000000..c789c92
--- /dev/null
+++ b/3rdParty/LibIDN/stubs/win32/stdbool/stdbool.h
@@ -0,0 +1,40 @@
+/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
+   Written by Adam Strzelecki <ono@java.pl>
+
+   This file is part of GNU Libidn.
+
+   GNU Libidn is free software: you can redistribute it and/or
+   modify it under the terms of either:
+
+     * the GNU Lesser General Public License as published by the Free
+       Software Foundation; either version 3 of the License, or (at
+       your option) any later version.
+
+   or
+
+     * the GNU General Public License as published by the Free
+       Software Foundation; either version 2 of the License, or (at
+       your option) any later version.
+
+   or both in parallel, as here.
+
+   GNU Libidn is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received copies of the GNU General Public License and
+   the GNU Lesser General Public License along with this program.  If
+   not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef _STDBOOL_H
+#define _STDBOOL_H
+
+#define _Bool signed char
+enum { false = 0, true = 1 };
+#define bool _Bool
+#define false 0
+#define true 1
+#define __bool_true_false_are_defined 1
+
+#endif /* _STDBOOL_H */
-- 
cgit v0.10.2-6-g49f6