[Tile-serving] [openstreetmap/osm2pgsql] Use fmt library instead of boost::format (#1004)

Sarah Hoffmann notifications at github.com
Sun Dec 1 15:19:22 UTC 2019


lonvia commented on this pull request.



> @@ -42,9 +42,9 @@ void output_gazetteer_t::delete_unused_classes(char const *osm_type,
     if (!clslist.empty()) {
         clslist[clslist.size() - 1] = '\0';
         // Delete places where classes have disappeared for this object.
-        m_conn->exec("DELETE FROM place WHERE osm_type = '%1%' "
-                     "AND osm_id = %2% and class = any(ARRAY[%3%])",
-                     osm_type, osm_id, clslist);
+        m_conn->exec("DELETE FROM place WHERE osm_type = '{}'"
+                     " AND osm_id = {} and class = any(ARRAY[{}])"_format(
+                         osm_type, osm_id, clslist));

This actually broke the gazetteer output because of the hacky line 43. Apparently boost:format ended the string at the first \0 while fmt now (correctly) prints everything in the std::string according to its size. Postgresql does not quite like the additional \0 in the copy stream.
This is already fixed in #1008, so no need to do anything. Just thought I mention it as an example why one should not mess with \0 in strings.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1004#pullrequestreview-324946035
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20191201/867d313a/attachment.html>


More information about the Tile-serving mailing list