From: Charles-Henri Bruyand Date: Tue, 18 Dec 2018 16:18:23 +0000 (+0100) Subject: Revert some changes as suggested by rgacogne X-Git-Tag: rec-4.2.0-alpha1~49^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3cbe2773a275710648e7fd6489c76333af005238;p=pdns Revert some changes as suggested by rgacogne --- diff --git a/pdns/dnsdist.hh b/pdns/dnsdist.hh index 0be157419..914fa7440 100644 --- a/pdns/dnsdist.hh +++ b/pdns/dnsdist.hh @@ -283,7 +283,7 @@ enum class PrometheusMetricType: int { // Keeps additional information about metrics struct MetricDefinition { - MetricDefinition(PrometheusMetricType prometheusType, const std::string& description): description(description), prometheusType(prometheusType) { + MetricDefinition(PrometheusMetricType _prometheusType, const std::string& _description): description(_description), prometheusType(_prometheusType) { } MetricDefinition() = default; diff --git a/pdns/histog.hh b/pdns/histog.hh index 62df2a8fe..f96e4beab 100644 --- a/pdns/histog.hh +++ b/pdns/histog.hh @@ -21,7 +21,7 @@ struct LogHistogramBin template std::vector createLogHistogram(const T& bins, - std::deque& percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999}) + std::deque percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999}) { uint64_t totcumul=0, sum=0; @@ -60,7 +60,7 @@ std::vector createLogHistogram(const T& bins, } template -void writeLogHistogramFile(const T& bins, std::ostream& out, std::deque& percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999} ) +void writeLogHistogramFile(const T& bins, std::ostream& out, std::deque percentiles={0.001, 0.01, 0.1, 0.2, 0.5, 1, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 94, 95, 96, 97, 97.5, 98, 98.5, 99, 99.5, 99.6, 99.9, 99.99, 99.999, 99.9999} ) { auto vec = createLogHistogram(bins, percentiles); diff --git a/pdns/lazy_allocator.hh b/pdns/lazy_allocator.hh index 17ef07aa6..1b9308851 100644 --- a/pdns/lazy_allocator.hh +++ b/pdns/lazy_allocator.hh @@ -35,12 +35,12 @@ struct lazy_allocator { "lazy_allocator must only be used with trivial types"); pointer - allocate (size_type const& n) { + allocate (size_type const n) { return static_cast(::operator new (n * sizeof(value_type))); } void - deallocate (pointer const ptr, size_type const& n) noexcept { + deallocate (pointer const ptr, size_type const n) noexcept { #if defined(__cpp_sized_deallocation) && (__cpp_sized_deallocation >= 201309) ::operator delete (ptr, n * sizeof(value_type)); #else diff --git a/pdns/rcpgenerator.cc b/pdns/rcpgenerator.cc index a21d1ab87..a7f9c364b 100644 --- a/pdns/rcpgenerator.cc +++ b/pdns/rcpgenerator.cc @@ -545,7 +545,8 @@ void RecordTextWriter::xfrTime(const uint32_t& val) time_t time=val; // Y2038 bug! gmtime_r(&time, &tm); - d_string += boost::str(boost::format("%04d%02d%02d" "%02d%02d%02d") % (tm.tm_year+1900) % (tm.tm_mon+1) % tm.tm_mday % tm.tm_hour % tm.tm_min % tm.tm_sec); + static const boost::format fmt("%04d%02d%02d" "%02d%02d%02d"); + d_string += boost::str(boost::format(fmt) % (tm.tm_year+1900) % (tm.tm_mon+1) % tm.tm_mday % tm.tm_hour % tm.tm_min % tm.tm_sec); } diff --git a/pdns/sillyrecords.cc b/pdns/sillyrecords.cc index 5b5d38a25..334e3e199 100644 --- a/pdns/sillyrecords.cc +++ b/pdns/sillyrecords.cc @@ -319,8 +319,9 @@ string LOCRecordContent::getZoneRepresentation(bool noDot) const double remlat=60.0*(latitude-(int)latitude); double remlong=60.0*(longitude-(int)longitude); + static const boost::format fmt("%d %d %2.03f %c %d %d %2.03f %c %.2fm %.2fm %.2fm %.2fm"); std::string ret = boost::str( - boost::format("%d %d %2.03f %c %d %d %2.03f %c %.2fm %.2fm %.2fm %.2fm") + boost::format(fmt) % abs((int)latitude) % abs((int) ((latitude-(int)latitude)*60)) % fabs((double)((remlat-(int)remlat)*60.0)) % (latitude>0 ? 'N' : 'S') % abs((int)longitude) % abs((int) ((longitude-(int)longitude)*60)) diff --git a/pdns/ssqlite3.cc b/pdns/ssqlite3.cc index 860d25452..c5f86f67c 100644 --- a/pdns/ssqlite3.cc +++ b/pdns/ssqlite3.cc @@ -53,7 +53,7 @@ public: d_prepared(false), d_query(query), d_dolog(dolog), - d_stmt(NULL), + d_stmt(nullptr), d_rc(0), d_db(db) { diff --git a/pdns/syncres.hh b/pdns/syncres.hh index d9bbebf06..106320e8e 100644 --- a/pdns/syncres.hh +++ b/pdns/syncres.hh @@ -72,7 +72,7 @@ typedef map< template class Throttle : public boost::noncopyable { public: - Throttle() : d_limit(3), d_ttl(60), d_last_clean(time(0)) + Throttle() : d_limit(3), d_ttl(60), d_last_clean(time(nullptr)) { }