From 627e5feaab79101c58507dfaba492eb63d32cfa5 Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Fri, 30 Sep 2016 20:02:44 +0200 Subject: Change custom memory copy loop to std::memcpy Test-Information: Swift builds with test=all on macOS 10.12 and all tests pass. Change-Id: I9d7e8c49e65ac272a7ee672a95da5e24609d0a22 diff --git a/Swiften/Network/HostAddress.cpp b/Swiften/Network/HostAddress.cpp index 7738079..a6c77f3 100644 --- a/Swiften/Network/HostAddress.cpp +++ b/Swiften/Network/HostAddress.cpp @@ -7,13 +7,9 @@ #include #include +#include #include -#include -#include -#include - -#include #include static boost::asio::ip::address localhost4 = boost::asio::ip::address(boost::asio::ip::address_v4::loopback()); @@ -36,16 +32,12 @@ HostAddress::HostAddress(const unsigned char* address, size_t length) { assert(length == 4 || length == 16); if (length == 4) { boost::asio::ip::address_v4::bytes_type data; - for (size_t i = 0; i < length; ++i) { - data[i] = address[i]; - } + std::memcpy(data.data(), address, length); address_ = boost::asio::ip::address(boost::asio::ip::address_v4(data)); } else { boost::asio::ip::address_v6::bytes_type data; - for (size_t i = 0; i < length; ++i) { - data[i] = address[i]; - } + std::memcpy(data.data(), address, length); address_ = boost::asio::ip::address(boost::asio::ip::address_v6(data)); } } -- cgit v0.10.2-6-g49f6