summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <remko@synopsys.com>2011-09-30 17:10:20 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-09-30 17:15:59 (GMT)
commit75818abb4baa26649baf8d3bf6709aefcda7195f (patch)
tree25cf8cc224100688d813ab57f3ccf32771f1bdf1 /Swiften/Network
parenta98f648f5cfbf474c566bd63193047e5381e7d5e (diff)
downloadswift-contrib-75818abb4baa26649baf8d3bf6709aefcda7195f.zip
swift-contrib-75818abb4baa26649baf8d3bf6709aefcda7195f.tar.bz2
Fixed some Windows issues with FT.
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/NATPMPInterface.h6
-rw-r--r--Swiften/Network/WindowsNetworkEnvironment.cpp8
2 files changed, 8 insertions, 6 deletions
diff --git a/Swiften/Network/NATPMPInterface.h b/Swiften/Network/NATPMPInterface.h
index 55f5b87..6e7fb73 100644
--- a/Swiften/Network/NATPMPInterface.h
+++ b/Swiften/Network/NATPMPInterface.h
@@ -7,11 +7,13 @@
#pragma once
#include <boost/optional.hpp>
-#include <natpmp.h>
-
#include <Swiften/Network/NATPortMapping.h>
#include <Swiften/Network/NATTraversalInterface.h>
+// This has to be included after the previous headers, because of WIN32 macro
+// being defined somewhere.
+#include <natpmp.h>
+
namespace Swift {
class NATPMPInterface : public NATTraversalInterface {
public:
diff --git a/Swiften/Network/WindowsNetworkEnvironment.cpp b/Swiften/Network/WindowsNetworkEnvironment.cpp
index a202015..20f559d 100644
--- a/Swiften/Network/WindowsNetworkEnvironment.cpp
+++ b/Swiften/Network/WindowsNetworkEnvironment.cpp
@@ -23,19 +23,19 @@ namespace Swift {
std::vector<NetworkInterface> WindowsNetworkEnvironment::getNetworkInterfaces() const {
std::vector<NetworkInterface> result;
- std::vector<IP_ADAPTER_ADDRESSES> adapters;
+ ByteArray adapters;
ULONG bufferSize = 0;
ULONG ret;
ULONG flags = GAA_FLAG_INCLUDE_ALL_INTERFACES | GAA_FLAG_INCLUDE_PREFIX | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER;
- while ((ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, vecptr(adapters), &bufferSize)) == ERROR_BUFFER_OVERFLOW) {
- adapters.resize(bufferSize / sizeof(IP_ADAPTER_ADDRESSES));
+ while ((ret = GetAdaptersAddresses(AF_UNSPEC, flags, NULL, reinterpret_cast<IP_ADAPTER_ADDRESSES*>(vecptr(adapters)), &bufferSize)) == ERROR_BUFFER_OVERFLOW) {
+ adapters.resize(bufferSize);
};
if (ret != ERROR_SUCCESS) {
return result;
}
std::map<std::string,NetworkInterface> interfaces;
- for (IP_ADAPTER_ADDRESSES* adapter = vecptr(adapters); adapter; adapter = adapter->Next) {
+ for (IP_ADAPTER_ADDRESSES* adapter = reinterpret_cast<IP_ADAPTER_ADDRESSES*>(vecptr(adapters)); adapter; adapter = adapter->Next) {
std::string name(adapter->AdapterName);
if (adapter->OperStatus != IfOperStatusUp) {
continue;