From cce4fa719d447c55d93458b25fa92717a2d61a60 Mon Sep 17 00:00:00 2001
From: Jonas Witschel <diabonas@archlinux.org>
Date: Tue, 14 Jul 2020 14:20:16 +0200
Subject: [PATCH] Fix compilation with GCC 10 by providing explicit cast of
 _bindingCount
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Compilation with GCC 10 fails with the following error:

service/../osdep/Binder.hpp: In member function ‘void ZeroTier::Binder::refresh(ZeroTier::Phy<PHY_HANDLER_TYPE>&, unsigned int*, unsigned int, std::vector<ZeroTier::InetAddress>, INTERFACE_CHECKER&)’:
service/../osdep/Binder.hpp:376:30: internal compiler error: unexpected expression ‘(std::__atomic_base<unsigned int>::__int_type)((ZeroTier::Binder*)this)->ZeroTier::Binder::_bindingCount’ of kind implicit_conv_expr
  376 |       _bindings[_bindingCount].udpSock = udps;
      |                              ^

Help the compiler by providing an explicit cast to the appropriate type like it
is already done in l. 338 of the same file.
---
 osdep/Binder.hpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/osdep/Binder.hpp b/osdep/Binder.hpp
index 660e6f0c..a5bc85c9 100644
--- a/osdep/Binder.hpp
+++ b/osdep/Binder.hpp
@@ -373,9 +373,9 @@ class Binder
 					}
 #endif // __LINUX__
 					if (_bindingCount < ZT_BINDER_MAX_BINDINGS) {
-						_bindings[_bindingCount].udpSock = udps;
-						_bindings[_bindingCount].tcpListenSock = tcps;
-						_bindings[_bindingCount].address = ii->first;
+						_bindings[(unsigned int)_bindingCount].udpSock = udps;
+						_bindings[(unsigned int)_bindingCount].tcpListenSock = tcps;
+						_bindings[(unsigned int)_bindingCount].address = ii->first;
 						phy.setIfName(udps,(char*)ii->second.c_str(),(int)ii->second.length());
 						++_bindingCount;
 					}
