]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
geoipbackend: boost > std optional
authorRosen Penev <rosenp@gmail.com>
Fri, 13 Dec 2024 18:46:22 +0000 (10:46 -0800)
committerRosen Penev <rosenp@gmail.com>
Fri, 13 Dec 2024 21:04:31 +0000 (13:04 -0800)
Signed-off-by: Rosen Penev <rosenp@gmail.com>
modules/geoipbackend/geoipbackend.cc
modules/geoipbackend/geoipinterface-dat.cc
modules/geoipbackend/geoipinterface-mmdb.cc
modules/geoipbackend/geoipinterface.hh

index 83e3aee7983584f71886a17f1b8ab3fe5081699d..e0219de1490da02643fb629e0fd4d570acf97b66 100644 (file)
@@ -647,7 +647,8 @@ static string queryGeoIP(const Netmask& addr, GeoIPInterface::GeoIPQueryAttribut
       break;
     case GeoIPInterface::Location:
       double lat = 0, lon = 0;
-      boost::optional<int> alt, prec;
+      std::optional<int> alt;
+      std::optional<int> prec;
       if (addr.isIPv6())
         found = gi->queryLocationV6(gl, ip, lat, lon, alt, prec);
       else
@@ -691,7 +692,7 @@ string getGeoForLua(const std::string& ip, int qaint)
 }
 
 static bool queryGeoLocation(const Netmask& addr, GeoIPNetmask& gl, double& lat, double& lon,
-                             boost::optional<int>& alt, boost::optional<int>& prec)
+                             std::optional<int>& alt, std::optional<int>& prec)
 {
   for (auto const& gi : s_geoip_files) {
     string val;
@@ -708,7 +709,8 @@ static bool queryGeoLocation(const Netmask& addr, GeoIPNetmask& gl, double& lat,
 string GeoIPBackend::format2str(string sformat, const Netmask& addr, GeoIPNetmask& gl, const GeoIPDomain& dom)
 {
   string::size_type cur, last;
-  boost::optional<int> alt, prec;
+  std::optional<int> alt;
+  std::optional<int> prec;
   double lat, lon;
   time_t t = time(nullptr);
   GeoIPNetmask tmp_gl; // largest wins
index 61c98a6bb249684fb444b954c5eca85803ad309c..f694eca883980bfadf5b21df93b0dac03f4305d7 100644 (file)
@@ -433,7 +433,7 @@ public:
 
   bool queryLocationV6(GeoIPNetmask& gl, const string& ip,
                        double& latitude, double& longitude,
-                       boost::optional<int>& /* alt */, boost::optional<int>& /* prec */) override
+                       std::optional<int>& /* alt */, std::optional<int>& /* prec */) override
   {
     if (d_db_type == GEOIP_REGION_EDITION_REV0 || d_db_type == GEOIP_REGION_EDITION_REV1 || d_db_type == GEOIP_CITY_EDITION_REV0_V6 || d_db_type == GEOIP_CITY_EDITION_REV1_V6) {
       std::unique_ptr<GeoIPRecord, geoiprecord_deleter> gir(GeoIP_record_by_addr_v6(d_gi.get(), ip.c_str()));
@@ -449,7 +449,7 @@ public:
 
   bool queryLocation(GeoIPNetmask& gl, const string& ip,
                      double& latitude, double& longitude,
-                     boost::optional<int>& /* alt */, boost::optional<int>& /* prec */) override
+                     std::optional<int>& /* alt */, std::optional<int>& /* prec */) override
   {
     if (d_db_type == GEOIP_REGION_EDITION_REV0 || d_db_type == GEOIP_REGION_EDITION_REV1 || d_db_type == GEOIP_CITY_EDITION_REV0 || d_db_type == GEOIP_CITY_EDITION_REV1) {
       std::unique_ptr<GeoIPRecord, geoiprecord_deleter> gir(GeoIP_record_by_addr(d_gi.get(), ip.c_str()));
index b3f08fb1cc985cb177f9fdefa67599cb0ce1e119..95f1b56daf10284473908b790a7d9edb73da4865 100644 (file)
@@ -208,7 +208,7 @@ public:
 
   bool queryLocation(GeoIPNetmask& gl, const string& ip,
                      double& latitude, double& longitude,
-                     boost::optional<int>& /* alt */, boost::optional<int>& prec) override
+                     std::optional<int>& /* alt */, std::optional<int>& prec) override
   {
     MMDB_entry_data_s data;
     MMDB_lookup_result_s res;
@@ -228,7 +228,7 @@ public:
 
   bool queryLocationV6(GeoIPNetmask& gl, const string& ip,
                        double& latitude, double& longitude,
-                       boost::optional<int>& /* alt */, boost::optional<int>& prec) override
+                       std::optional<int>& /* alt */, std::optional<int>& prec) override
   {
     MMDB_entry_data_s data;
     MMDB_lookup_result_s res;
index da745ada6189ef21e7370e7b50dc744ec4fa87ce..76fe01f1756ec3f4937992ec729949fc927335a1 100644 (file)
@@ -55,11 +55,11 @@ public:
   virtual bool queryCityV6(string& ret, GeoIPNetmask& gl, const string& ip) = 0;
   virtual bool queryLocation(GeoIPNetmask& gl, const string& ip,
                              double& latitude, double& longitude,
-                             boost::optional<int>& alt, boost::optional<int>& prec)
+                             std::optional<int>& alt, std::optional<int>& prec)
     = 0;
   virtual bool queryLocationV6(GeoIPNetmask& gl, const string& ip,
                                double& latitude, double& longitude,
-                               boost::optional<int>& alt, boost::optional<int>& prec)
+                               std::optional<int>& alt, std::optional<int>& prec)
     = 0;
 
   virtual ~GeoIPInterface() = default;