From: Remi Gacogne Date: Thu, 29 Aug 2019 09:48:26 +0000 (+0200) Subject: dnsdist: Fix KVS compilation on Boost < 1.56 X-Git-Tag: dnsdist-1.4.0-rc2~7^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F8248%2Fhead;p=thirdparty%2Fpdns.git dnsdist: Fix KVS compilation on Boost < 1.56 When neither the C++ 17 nor Boost >= 1.61 string_view are available, we fall back to boost::string_ref. Unfortunately it didn't have the to_string() method before 1.56. Since we end up converting it to a string anyway, let's just skip the string_view/string_ref part. --- diff --git a/pdns/dnsdistdist/dnsdist-kvs.cc b/pdns/dnsdistdist/dnsdist-kvs.cc index 814551bfec..a99047ffaa 100644 --- a/pdns/dnsdistdist/dnsdist-kvs.cc +++ b/pdns/dnsdistdist/dnsdist-kvs.cc @@ -72,13 +72,13 @@ std::vector KeyValueLookupKeySuffix::getKeys(const DNSName& qname) bool LMDBKVStore::getValue(const std::string& key, std::string& value) { - string_view result; try { auto transaction = d_env.getROTransaction(); auto dbi = transaction.openDB(d_dbName, 0); + MDBOutVal result; int rc = transaction.get(dbi, MDBInVal(key), result); if (rc == 0) { - value = result.to_string(); + value = result.get(); return true; } else if (rc == MDB_NOTFOUND) { @@ -93,10 +93,10 @@ bool LMDBKVStore::getValue(const std::string& key, std::string& value) bool LMDBKVStore::keyExists(const std::string& key) { - string_view result; try { auto transaction = d_env.getROTransaction(); auto dbi = transaction.openDB(d_dbName, 0); + MDBOutVal result; int rc = transaction.get(dbi, MDBInVal(key), result); if (rc == 0) { return true;