]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[497-kea-uses-deprecated-header] Fixed boost/{integer,math}/common_factor.h 497-kea-uses-deprecated-header
authorFrancis Dupont <fdupont@isc.org>
Sun, 6 Oct 2019 19:53:12 +0000 (21:53 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Fri, 18 Oct 2019 17:37:50 +0000 (19:37 +0200)
m4macros/ax_boost_for_kea.m4
src/lib/asiolink/Makefile.am
src/lib/util/encode/base_n.cc

index f5d307260aea614fdbdcf5569f606618a0c20af3..7090eecebe627ee4d284875f82a221930f63c13c 100644 (file)
@@ -79,6 +79,8 @@ AC_CHECK_HEADERS([boost/shared_ptr.hpp boost/foreach.hpp boost/interprocess/sync
 
 AC_CHECK_HEADERS(boost/asio/coroutine.hpp,,AC_MSG_RESULT(not found, using built-in header.))
 
+AC_CHECK_HEADERS(boost/integer/common_factor.hpp)
+
 # Verify that the path does not include standard headers by mistake.
 # There are two regex.h headers: one is a standard system header (usually
 # in /usr/include) and the second one is provided by boost. If you specify the
index b625f6ffd8fab7b2ed321433b7d248822a881cd5..d04aacf3448dd880332087293674730a6cb85312 100644 (file)
@@ -3,7 +3,7 @@ SUBDIRS = . testutils tests
 AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
 AM_CPPFLAGS += $(BOOST_INCLUDES)
 
-AM_CXXFLAGS = $(KEA_CXXFLAGS)
+AM_CXXFLAGS = $(KEA_CXXFLAGS) -Wno-non-virtual-dtor
 
 CLEANFILES = *.gcno *.gcda
 
index 5a78e882cd71f9a0ff4dcdcf968b1d92d0c31abc..82e54824922460a8d39b5a458888a2f284a6d7b0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2010-2019 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 #include <boost/archive/iterators/base64_from_binary.hpp>
 #include <boost/archive/iterators/binary_from_base64.hpp>
 #include <boost/archive/iterators/transform_width.hpp>
+#ifdef HAVE_BOOST_INTEGER_COMMON_FACTOR_HPP
+#include <boost/integer/common_factor.hpp>
+#else
 #include <boost/math/common_factor.hpp>
+#endif
 
 #include <stdint.h>
 #include <stdexcept>
@@ -68,7 +72,7 @@ class IncompleteBaseInput : public std::exception {
 //
 // Its dereference operator
 //   retrieves BitsIn bits from the result of "*Base" (if necessary it
-//   internally calls ++Base) 
+//   internally calls ++Base)
 //
 // A conceptual description of how the encoding and decoding work is as
 // follows:
@@ -93,7 +97,7 @@ namespace {
 // Common constants used for all baseN encoding.
 const char BASE_PADDING_CHAR = '=';
 const uint8_t BINARY_ZERO_CODE = 0;
-  
+
 // EncodeNormalizer is an input iterator intended to be used as a filter
 // between the binary stream and baseXX_from_binary translator (via
 // transform_width).  An EncodeNormalizer object is configured with two
@@ -267,7 +271,11 @@ struct BaseNTransformer {
     // without padding.  It's the least common multiple of 8 and BitsPerChunk,
     // e.g. 24 for base64.
     static const int BITS_PER_GROUP =
+#ifdef HAVE_BOOST_INTEGER_COMMON_FACTOR_HPP
+        boost::integer::static_lcm<BitsPerChunk, 8>::value;
+#else
         boost::math::static_lcm<BitsPerChunk, 8>::value;
+#endif
 
     // MAX_PADDING_CHARS is the maximum number of padding characters
     // that can appear in a valid baseN encoded text.
@@ -281,7 +289,7 @@ struct BaseNTransformer {
     static const int MAX_PADDING_CHARS =
         BITS_PER_GROUP / BitsPerChunk -
         (8 / BitsPerChunk + ((8 % BitsPerChunk) == 0 ? 0 : 1));
-}; 
+};
 
 template <int BitsPerChunk, char BaseZeroCode,
           typename Encoder, typename Decoder>
@@ -341,7 +349,7 @@ BaseNTransformer<BitsPerChunk, BaseZeroCode, Encoder, Decoder>::decode(
     // 0000...0 0......0 000...
     // 0      7 8     15 16.... (bits)
     // The number of bits for the '==...' part is padchars * BitsPerChunk.
-    // So the total number of padding bits is the smallest multiple of 8 
+    // So the total number of padding bits is the smallest multiple of 8
     // that is >= padchars * BitsPerChunk.
     // (Below, note the common idiom of the bitwise AND with ~7.  It clears the
     // lowest three bits, so has the effect of rounding the result down to the