clang -cc1 -cc1 -triple x86_64-pc-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name OsmParser.cpp -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -fhalf-no-semantic-interposition -mframe-pointer=all -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/gilles/devel/GIT/8.x/build.scan/core/utilities/geolocation/engine/plugins/runner/osm -fcoverage-compilation-dir=/home/gilles/devel/GIT/8.x/build.scan/core/utilities/geolocation/engine/plugins/runner/osm -resource-dir /usr/lib/llvm-18/lib/clang/18 -isystem /opt/qt6/include -isystem /opt/qt6/include/QtCore -isystem /opt/qt6/mkspecs/linux-g++ -isystem /opt/qt6/include/QtGui -isystem /opt/qt6/include/QtNetwork -isystem /opt/qt6/include/QtWidgets -isystem /opt/qt6/include/QtXml -isystem /opt/qt6/include/QtSvg -isystem /opt/qt6/include/KF6/KI18n -isystem /opt/qt6/include/QtSvgWidgets -D CMS_NO_REGISTER_KEYWORD=1 -D HAVE_FFMPEG_VERSION5 -D LIBPGF_DISABLE_OPENMP -D MAGICKCORE_HDRI_ENABLE=0 -D MAGICKCORE_QUANTUM_DEPTH=16 -D OsmPlugin_EXPORTS -D QT_CORE_LIB -D QT_DEPRECATED_WARNINGS -D QT_DEPRECATED_WARNINGS_SINCE=0x060000 -D QT_DISABLE_DEPRECATED_BEFORE=0x050E00 -D QT_GUI_LIB -D QT_NETWORK_LIB -D QT_NO_CAST_FROM_ASCII -D QT_NO_CAST_FROM_BYTEARRAY -D QT_NO_CAST_TO_ASCII -D QT_NO_KEYWORDS -D QT_NO_NARROWING_CONVERSIONS_IN_CONNECT -D QT_NO_URL_CAST_FROM_STRING -D QT_STRICT_ITERATORS -D QT_SVGWIDGETS_LIB -D QT_SVG_LIB -D QT_USE_QSTRINGBUILDER -D QT_WIDGETS_LIB -D QT_XML_LIB -D TRANSLATION_DOMAIN="digikam" -D USE_JASPER -D USE_JPEG -D USE_JPEG8 -D _GNU_SOURCE -D _LARGEFILE64_SOURCE -I /home/gilles/devel/GIT/8.x/build.scan/core/utilities/geolocation/engine/plugins/runner/osm -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/osm -I /home/gilles/devel/GIT/8.x/build.scan/core/utilities/geolocation/engine/plugins/runner/osm/OsmPlugin_autogen/include -I /home/gilles/devel/GIT/8.x/core/libs/video/player/qtmm -I /home/gilles/devel/GIT/8.x/core/libs/album/engine -I /home/gilles/devel/GIT/8.x/core/libs/album/manager -I /home/gilles/devel/GIT/8.x/core/libs/album/treeview -I /home/gilles/devel/GIT/8.x/core/libs/album/widgets -I /home/gilles/devel/GIT/8.x/core/libs/database/collection -I /home/gilles/devel/GIT/8.x/core/libs/database/coredb -I /home/gilles/devel/GIT/8.x/core/libs/database/dbjobs -I /home/gilles/devel/GIT/8.x/core/libs/database/engine -I /home/gilles/devel/GIT/8.x/core/libs/database/haar -I /home/gilles/devel/GIT/8.x/core/libs/database/history -I /home/gilles/devel/GIT/8.x/core/libs/database/item/containers -I /home/gilles/devel/GIT/8.x/core/libs/database/item/lister -I /home/gilles/devel/GIT/8.x/core/libs/database/item/query -I /home/gilles/devel/GIT/8.x/core/libs/database/item/scanner -I /home/gilles/devel/GIT/8.x/core/libs/database/models -I /home/gilles/devel/GIT/8.x/core/libs/database/server -I /home/gilles/devel/GIT/8.x/core/libs/database/similaritydb -I /home/gilles/devel/GIT/8.x/core/libs/database/tags -I /home/gilles/devel/GIT/8.x/core/libs/database/thumbsdb -I /home/gilles/devel/GIT/8.x/core/libs/database/utils/ifaces -I /home/gilles/devel/GIT/8.x/core/libs/database/utils/scan -I /home/gilles/devel/GIT/8.x/core/libs/database/utils/widgets -I /home/gilles/devel/GIT/8.x/core/libs/dialogs -I /home/gilles/devel/GIT/8.x/core/libs/dimg/color -I /home/gilles/devel/GIT/8.x/core/libs/dimg -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/auto -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/bcg -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/bw -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/cb -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/curves -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/decorate -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/film -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/fx -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/greycstoration/cimg -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/greycstoration -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/hotpixels -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/hsl -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/icc -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/lc -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/lens -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/levels -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/nr -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/raw -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/redeye -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/sharp -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/transform -I /home/gilles/devel/GIT/8.x/core/libs/dimg/filters/wb -I /home/gilles/devel/GIT/8.x/core/libs/dimg/history -I /home/gilles/devel/GIT/8.x/core/libs/dimg/loaders -I /home/gilles/devel/GIT/8.x/core/libs/dngwriter -I /home/gilles/devel/GIT/8.x/core/libs/dplugins/core -I /home/gilles/devel/GIT/8.x/core/libs/dplugins/iface -I /home/gilles/devel/GIT/8.x/core/libs/dplugins/setup -I /home/gilles/devel/GIT/8.x/core/libs/dplugins/webservices -I /home/gilles/devel/GIT/8.x/core/libs/dplugins/widgets -I /home/gilles/devel/GIT/8.x/core/libs/dragdrop -I /home/gilles/devel/GIT/8.x/core/libs/dtrash -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/common -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/detection -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/detection/opencv-dnn -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/facedb -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/preprocessing -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/preprocessing/recognition -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/preprocessing/shape-predictor -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/recognition -I /home/gilles/devel/GIT/8.x/core/libs/facesengine/recognition/opencv-dnn -I /home/gilles/devel/GIT/8.x/core/libs/fileactionmanager -I /home/gilles/devel/GIT/8.x/core/libs/filters -I /home/gilles/devel/GIT/8.x/core/libs/imgqsort/detectors -I /home/gilles/devel/GIT/8.x/core/libs/imgqsort -I /home/gilles/devel/GIT/8.x/core/libs/iojobs -I /home/gilles/devel/GIT/8.x/core/libs/jpegutils -I /home/gilles/devel/GIT/8.x/core/libs/metadataengine/containers -I /home/gilles/devel/GIT/8.x/core/libs/metadataengine/dmetadata -I /home/gilles/devel/GIT/8.x/core/libs/metadataengine/engine -I /home/gilles/devel/GIT/8.x/core/libs/metadataengine/exiftool -I /home/gilles/devel/GIT/8.x/core/libs/metadataengine/focuspoint -I /home/gilles/devel/GIT/8.x/core/libs/models -I /home/gilles/devel/GIT/8.x/core/libs/networkmanager -I /home/gilles/devel/GIT/8.x/core/libs/notificationmanager -I /home/gilles/devel/GIT/8.x/core/libs/onlineversion -I /home/gilles/devel/GIT/8.x/core/libs/pgfutils -I /home/gilles/devel/GIT/8.x/core/libs/progressmanager -I /home/gilles/devel/GIT/8.x/core/libs/properties/captions -I /home/gilles/devel/GIT/8.x/core/libs/properties/geolocation -I /home/gilles/devel/GIT/8.x/core/libs/properties/history -I /home/gilles/devel/GIT/8.x/core/libs/properties/import -I /home/gilles/devel/GIT/8.x/core/libs/properties -I /home/gilles/devel/GIT/8.x/core/libs/rawengine -I /home/gilles/devel/GIT/8.x/core/libs/settings -I /home/gilles/devel/GIT/8.x/core/libs/tags/autoassignment -I /home/gilles/devel/GIT/8.x/core/libs/tags/autoassignment/model -I /home/gilles/devel/GIT/8.x/core/libs/tags/engine -I /home/gilles/devel/GIT/8.x/core/libs/tags/manager/models -I /home/gilles/devel/GIT/8.x/core/libs/tags/manager -I /home/gilles/devel/GIT/8.x/core/libs/tags/widgets -I /home/gilles/devel/GIT/8.x/core/libs/template -I /home/gilles/devel/GIT/8.x/core/libs/threadimageio/engine -I /home/gilles/devel/GIT/8.x/core/libs/threadimageio/fileio -I /home/gilles/devel/GIT/8.x/core/libs/threadimageio/preview -I /home/gilles/devel/GIT/8.x/core/libs/threadimageio/thumb -I /home/gilles/devel/GIT/8.x/core/libs/threadimageio/video -I /home/gilles/devel/GIT/8.x/core/libs/threads -I /home/gilles/devel/GIT/8.x/core/libs/timeadjust -I /home/gilles/devel/GIT/8.x/core/libs/transitionmngr -I /home/gilles/devel/GIT/8.x/core/libs/versionmanager -I /home/gilles/devel/GIT/8.x/core/libs/video -I /home/gilles/devel/GIT/8.x/core/libs/video/manager -I /home/gilles/devel/GIT/8.x/core/libs/video/osd -I /home/gilles/devel/GIT/8.x/core/libs/video/player -I /home/gilles/devel/GIT/8.x/core/libs/widgets/colors -I /home/gilles/devel/GIT/8.x/core/libs/widgets/combo -I /home/gilles/devel/GIT/8.x/core/libs/widgets/files -I /home/gilles/devel/GIT/8.x/core/libs/widgets/fonts -I /home/gilles/devel/GIT/8.x/core/libs/widgets/graphicsview -I /home/gilles/devel/GIT/8.x/core/libs/widgets/history -I /home/gilles/devel/GIT/8.x/core/libs/widgets/iccprofiles -I /home/gilles/devel/GIT/8.x/core/libs/widgets/itemview -I /home/gilles/devel/GIT/8.x/core/libs/widgets/layout -I /home/gilles/devel/GIT/8.x/core/libs/widgets/mainview -I /home/gilles/devel/GIT/8.x/core/libs/widgets/metadata/config -I /home/gilles/devel/GIT/8.x/core/libs/widgets/metadata/exiftool -I /home/gilles/devel/GIT/8.x/core/libs/widgets/metadata/exiv2 -I /home/gilles/devel/GIT/8.x/core/libs/widgets/metadata/labels -I /home/gilles/devel/GIT/8.x/core/libs/widgets/metadata/utils -I /home/gilles/devel/GIT/8.x/core/libs/widgets/range -I /home/gilles/devel/GIT/8.x/core/libs/widgets/text -I /home/gilles/devel/GIT/8.x/core/libs/jpegutils/libjpeg/84 -I /home/gilles/devel/GIT/8.x/core/app/utils -I /home/gilles/devel/GIT/8.x/build.scan/core/app/utils -I /home/gilles/devel/GIT/8.x/core/utilities/advancedrename -I /home/gilles/devel/GIT/8.x/core/utilities/advancedrename/common -I /home/gilles/devel/GIT/8.x/core/utilities/advancedrename/parser -I /home/gilles/devel/GIT/8.x/core/utilities/advancedrename/parser/modifiers -I /home/gilles/devel/GIT/8.x/core/utilities/advancedrename/parser/options -I /home/gilles/devel/GIT/8.x/core/utilities/advancedrename/parser/options/database -I /home/gilles/devel/GIT/8.x/core/utilities/advancedrename/parser/options/database/keys -I /home/gilles/devel/GIT/8.x/core/utilities/extrasupport/addressbook -I /home/gilles/devel/GIT/8.x/core/utilities/extrasupport/filesindexer -I /home/gilles/devel/GIT/8.x/core/utilities/facemanagement/bench -I /home/gilles/devel/GIT/8.x/core/utilities/facemanagement/database -I /home/gilles/devel/GIT/8.x/core/utilities/facemanagement/items -I /home/gilles/devel/GIT/8.x/core/utilities/facemanagement/threads -I /home/gilles/devel/GIT/8.x/core/utilities/facemanagement/widgets -I /home/gilles/devel/GIT/8.x/core/utilities/facemanagement/workers -I /home/gilles/devel/GIT/8.x/core/utilities/firstrun -I /home/gilles/devel/GIT/8.x/core/utilities/focuspointmanagement -I /home/gilles/devel/GIT/8.x/core/utilities/fuzzysearch -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/astro -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/blendings -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/core -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/data -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/graphicsitem -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/handlers/dgml -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/handlers/kml -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/parser -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/scene -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/writer -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/writers/dgml -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/geodata/writers/kml -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/graphicsview -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/layers -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/models -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/osm -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/atmosphere -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/compass -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/crosshairs -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/graticule -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/mapscale -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/measure -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/navigation -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/overviewmap -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/render/progress -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/cache -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/gpsbabel -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/gpx -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/gpx/handlers -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/json -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/kml -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/nominatim-reversegeocoding -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/osm/o5mreader -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/osm/translators -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/osm/writers -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/pn2 -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/pnt -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/projections -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/runners -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/settings -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/storage -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/tile -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/backends -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/bookmark -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/core -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/correlator -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/dragdrop -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/items -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/lookup -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/reversegeocoding -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/tiles -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/tracks -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geoiface/widgets -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/geomapwrapper -I /home/gilles/devel/GIT/8.x/core/utilities/geolocation/mapsearches -I /home/gilles/devel/GIT/8.x/core/utilities/imageeditor/core -I /home/gilles/devel/GIT/8.x/core/utilities/imageeditor/dialogs -I /home/gilles/devel/GIT/8.x/core/utilities/imageeditor/editor -I /home/gilles/devel/GIT/8.x/core/utilities/imageeditor/main -I /home/gilles/devel/GIT/8.x/core/utilities/imageeditor/widgets -I /home/gilles/devel/GIT/8.x/core/utilities/import/backend -I /home/gilles/devel/GIT/8.x/core/utilities/import/dialogs -I /home/gilles/devel/GIT/8.x/core/utilities/import/items -I /home/gilles/devel/GIT/8.x/core/utilities/import/main -I /home/gilles/devel/GIT/8.x/core/utilities/import/models -I /home/gilles/devel/GIT/8.x/core/utilities/import/views -I /home/gilles/devel/GIT/8.x/core/utilities/import/widgets -I /home/gilles/devel/GIT/8.x/core/utilities/lighttable -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/main -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/manager -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/autotags -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/dbcleaner -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/dbscan -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/duplicates -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/facesmanagement -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/fingerprints -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/imgqsort -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/metaremover -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/metasync -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/tools/thumbs -I /home/gilles/devel/GIT/8.x/core/utilities/maintenance/utils -I /home/gilles/devel/GIT/8.x/core/utilities/queuemanager/dplugins -I /home/gilles/devel/GIT/8.x/core/utilities/queuemanager/main -I /home/gilles/devel/GIT/8.x/core/utilities/queuemanager/manager -I /home/gilles/devel/GIT/8.x/core/utilities/queuemanager/views -I /home/gilles/devel/GIT/8.x/core/utilities/searchwindow -I /home/gilles/devel/GIT/8.x/core/utilities/setup/album -I /home/gilles/devel/GIT/8.x/core/utilities/setup/camera -I /home/gilles/devel/GIT/8.x/core/utilities/setup/collections -I /home/gilles/devel/GIT/8.x/core/utilities/setup/downloader -I /home/gilles/devel/GIT/8.x/core/utilities/setup/editor -I /home/gilles/devel/GIT/8.x/core/utilities/setup/metadata -I /home/gilles/devel/GIT/8.x/core/utilities/setup/misc -I /home/gilles/devel/GIT/8.x/core/utilities/setup -I /home/gilles/devel/GIT/8.x/core/app/main -I /home/gilles/devel/GIT/8.x/core/app/date -I /home/gilles/devel/GIT/8.x/core/app/dragdrop -I /home/gilles/devel/GIT/8.x/core/app/views/stack -I /home/gilles/devel/GIT/8.x/core/app/views/utils -I /home/gilles/devel/GIT/8.x/core/app/views/sidebar -I /home/gilles/devel/GIT/8.x/core/app/items/utils -I /home/gilles/devel/GIT/8.x/core/app/items/overlays -I /home/gilles/devel/GIT/8.x/core/app/items/views -I /home/gilles/devel/GIT/8.x/core/app/items/thumbbar -I /home/gilles/devel/GIT/8.x/core/app/views/preview -I /home/gilles/devel/GIT/8.x/build.scan/core/app -I /home/gilles/devel/GIT/8.x/core/app -I /usr/include/opencv4 -I /usr/include/ImageMagick-6 -I /usr/include/x86_64-linux-gnu/ImageMagick-6 -I /opt/qt6/include/QtMultimedia -I /opt/qt6/include/QtMultimediaWidgets -I /opt/qt6/include/QtConcurrent -I /opt/qt6/include/KF6/KConfig -I /opt/qt6/include/KF6/KConfigCore -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/x86_64-linux-gnu/c++/13 -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/backward -internal-isystem /usr/lib/llvm-18/lib/clang/18/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-long-long -Wno-deprecated-copy -std=c++20 -fdeprecated-macro -ferror-limit 19 -fvisibility=hidden -fvisibility-inlines-hidden -fno-operator-names -fopenmp -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /mnt/data2/devel/GIT/8.x/project/reports/report.scan/2024-07-19-181803-1488604-1 -x c++ /home/gilles/devel/GIT/8.x/core/utilities/geolocation/engine/plugins/runner/osm/OsmParser.cpp
1 | |
2 | |
3 | |
4 | |
5 | |
6 | |
7 | |
8 | |
9 | |
10 | |
11 | |
12 | |
13 | |
14 | |
15 | |
16 | |
17 | #include "OsmParser.h" |
18 | |
19 | |
20 | |
21 | #include <QColor> |
22 | #include <QFile> |
23 | #include <QFileInfo> |
24 | #include <QBuffer> |
25 | #include <QSet> |
26 | |
27 | |
28 | |
29 | #include <klocalizedstring.h> |
30 | |
31 | |
32 | |
33 | #include "OsmElementDictionary.h" |
34 | #include "OsmObjectManager.h" |
35 | #include "GeoDataDocument.h" |
36 | #include "GeoDataPoint.h" |
37 | #include "GeoDataStyle.h" |
38 | #include "GeoDataPolyStyle.h" |
39 | #include "MarbleZipReader.h" |
40 | #include "o5mreader.h" |
41 | #include "OsmPbfParser.h" |
42 | |
43 | namespace Marble |
44 | { |
45 | |
46 | GeoDataDocument* OsmParser::parse(const QString& filename, QString& error) |
47 | { |
48 | QFileInfo const fileInfo(filename); |
49 | |
50 | if (!fileInfo.exists() || !fileInfo.isReadable()) |
51 | { |
52 | error = QString::fromUtf8("Cannot read file %1").arg(filename); |
53 | return nullptr; |
54 | } |
55 | |
56 | if (fileInfo.suffix() == QLatin1String("o5m")) |
57 | { |
58 | return parseO5m(filename, error); |
59 | } |
60 | |
61 | else if (filename.endsWith(QLatin1String(".osm.pbf"))) |
62 | { |
63 | return parseOsmPbf(filename, error); |
64 | } |
65 | |
66 | else |
67 | { |
68 | return parseXml(filename, error); |
69 | } |
70 | } |
71 | |
72 | GeoDataDocument* OsmParser::parseO5m(const QString& filename, QString& error) |
73 | { |
74 | O5mreader* reader; |
75 | O5mreaderDataset data; |
76 | O5mreaderIterateRet outerState, innerState; |
77 | char* key, *value; |
78 | |
79 | QSet<QString> stringPool; |
80 | |
81 | OsmNodes nodes; |
82 | OsmWays ways; |
83 | OsmRelations relations; |
84 | QHash<uint8_t, QString> relationTypes; |
85 | relationTypes[O5MREADER_DS_NODE] = QStringLiteral("node"); |
86 | relationTypes[O5MREADER_DS_WAY] = QStringLiteral("way"); |
87 | relationTypes[O5MREADER_DS_REL] = QStringLiteral("relation"); |
88 | |
89 | auto file = fopen(filename.toStdString().c_str(), "rb"); |
90 | o5mreader_open(&reader, file); |
91 | |
92 | while ((outerState = o5mreader_iterateDataSet(reader, &data)) == O5MREADER_ITERATE_RET_NEXT) |
93 | { |
94 | switch (data.type) |
95 | { |
96 | case O5MREADER_DS_NODE: |
97 | { |
98 | OsmNode& node = nodes[data.id]; |
99 | node.osmData().setId(data.id); |
100 | node.setCoordinates(GeoDataCoordinates(data.lon * 1.0e-7, data.lat * 1.0e-7, |
101 | 0.0, GeoDataCoordinates::Degree)); |
102 | |
103 | while ((innerState = o5mreader_iterateTags(reader, &key, &value)) == O5MREADER_ITERATE_RET_NEXT) |
104 | { |
105 | const QString keyString = *stringPool.insert(QString::fromUtf8(key)); |
106 | const QString valueString = *stringPool.insert(QString::fromUtf8(value)); |
107 | node.osmData().addTag(keyString, valueString); |
108 | } |
109 | } |
110 | break; |
111 | |
112 | case O5MREADER_DS_WAY: |
113 | { |
114 | OsmWay& way = ways[data.id]; |
115 | way.osmData().setId(data.id); |
116 | uint64_t nodeId; |
117 | |
118 | while ((innerState = o5mreader_iterateNds(reader, &nodeId)) == O5MREADER_ITERATE_RET_NEXT) |
119 | { |
120 | way.addReference(nodeId); |
121 | } |
122 | |
123 | while ((innerState = o5mreader_iterateTags(reader, &key, &value)) == O5MREADER_ITERATE_RET_NEXT) |
124 | { |
125 | const QString keyString = *stringPool.insert(QString::fromUtf8(key)); |
126 | const QString valueString = *stringPool.insert(QString::fromUtf8(value)); |
127 | way.osmData().addTag(keyString, valueString); |
128 | } |
129 | } |
130 | break; |
131 | |
132 | case O5MREADER_DS_REL: |
133 | { |
134 | OsmRelation& relation = relations[data.id]; |
135 | relation.osmData().setId(data.id); |
136 | char* role; |
137 | uint8_t type; |
138 | uint64_t refId; |
139 | |
140 | while ((innerState = o5mreader_iterateRefs(reader, &refId, &type, &role)) == O5MREADER_ITERATE_RET_NEXT) |
| Although the value stored to 'innerState' is used in the enclosing expression, the value is never actually read from 'innerState' |
141 | { |
142 | const QString roleString = *stringPool.insert(QString::fromUtf8(role)); |
143 | relation.addMember(refId, roleString, relationTypes[type]); |
144 | } |
145 | |
146 | while ((innerState = o5mreader_iterateTags(reader, &key, &value)) == O5MREADER_ITERATE_RET_NEXT) |
147 | { |
148 | const QString keyString = *stringPool.insert(QString::fromUtf8(key)); |
149 | const QString valueString = *stringPool.insert(QString::fromUtf8(value)); |
150 | relation.osmData().addTag(keyString, valueString); |
151 | } |
152 | } |
153 | break; |
154 | } |
155 | } |
156 | |
157 | fclose(file); |
158 | error = QString::fromUtf8(reader->errMsg); |
159 | o5mreader_close(reader); |
160 | return createDocument(nodes, ways, relations); |
161 | } |
162 | |
163 | GeoDataDocument* OsmParser::parseXml(const QString& filename, QString& error) |
164 | { |
165 | QXmlStreamReader parser; |
166 | QFile file; |
167 | QBuffer buffer; |
168 | QFileInfo fileInfo(filename); |
169 | |
170 | if (fileInfo.completeSuffix() == QLatin1String("osm.zip")) |
171 | { |
172 | MarbleZipReader zipReader(filename); |
173 | |
174 | if (zipReader.fileInfoList().size() != 1) |
175 | { |
176 | int const fileNumber = zipReader.fileInfoList().size(); |
177 | error = QStringLiteral("Unexpected number of files (%1) in %2").arg(fileNumber).arg(filename); |
178 | return nullptr; |
179 | } |
180 | |
181 | QByteArray const data = zipReader.fileData(zipReader.fileInfoList().first().filePath); |
182 | buffer.setData(data); |
183 | buffer.open(QBuffer::ReadOnly); |
184 | parser.setDevice(&buffer); |
185 | } |
186 | |
187 | else |
188 | { |
189 | file.setFileName(filename); |
190 | |
191 | if (!file.open(QFile::ReadOnly)) |
192 | { |
193 | error = QStringLiteral("Cannot open file %1").arg(filename); |
194 | return nullptr; |
195 | } |
196 | |
197 | parser.setDevice(&file); |
198 | } |
199 | |
200 | OsmPlacemarkData* osmData(nullptr); |
201 | QString parentTag; |
202 | qint64 parentId(0); |
203 | |
204 | QSet<QString> stringPool; |
205 | |
206 | OsmNodes m_nodes; |
207 | OsmWays m_ways; |
208 | OsmRelations m_relations; |
209 | |
210 | while (!parser.atEnd()) |
211 | { |
212 | parser.readNext(); |
213 | |
214 | if (!parser.isStartElement()) |
215 | { |
216 | continue; |
217 | } |
218 | |
219 | QStringView const tagName = parser.name(); |
220 | |
221 | if (tagName == QString::fromUtf8(osm::osmTag_node) || tagName == QString::fromUtf8(osm::osmTag_way) || tagName == QString::fromUtf8(osm::osmTag_relation)) |
222 | { |
223 | parentTag = parser.name().toString(); |
224 | parentId = parser.attributes().value(QLatin1String("id")).toLongLong(); |
225 | |
226 | if (tagName == QString::fromUtf8(osm::osmTag_node)) |
227 | { |
228 | m_nodes[parentId].osmData() = OsmPlacemarkData::fromParserAttributes(parser.attributes()); |
229 | m_nodes[parentId].parseCoordinates(parser.attributes()); |
230 | osmData = &m_nodes[parentId].osmData(); |
231 | } |
232 | |
233 | else if (tagName == QString::fromUtf8(osm::osmTag_way)) |
234 | { |
235 | m_ways[parentId].osmData() = OsmPlacemarkData::fromParserAttributes(parser.attributes()); |
236 | osmData = &m_ways[parentId].osmData(); |
237 | } |
238 | |
239 | else |
240 | { |
241 | Q_ASSERT(tagName == QString::fromUtf8(osm::osmTag_relation)); |
242 | m_relations[parentId].osmData() = OsmPlacemarkData::fromParserAttributes(parser.attributes()); |
243 | osmData = &m_relations[parentId].osmData(); |
244 | } |
245 | } |
246 | |
247 | else if (osmData && tagName == QString::fromUtf8(osm::osmTag_tag)) |
248 | { |
249 | const QXmlStreamAttributes& attributes = parser.attributes(); |
250 | const QString keyString = *stringPool.insert(attributes.value(QLatin1String("k")).toString()); |
251 | const QString valueString = *stringPool.insert(attributes.value(QLatin1String("v")).toString()); |
252 | osmData->addTag(keyString, valueString); |
253 | } |
254 | |
255 | else if (tagName == QString::fromUtf8(osm::osmTag_nd) && parentTag == QString::fromUtf8(osm::osmTag_way)) |
256 | { |
257 | m_ways[parentId].addReference(parser.attributes().value(QLatin1String("ref")).toLongLong()); |
258 | } |
259 | |
260 | else if (tagName == QString::fromUtf8(osm::osmTag_member) && parentTag == QString::fromUtf8(osm::osmTag_relation)) |
261 | { |
262 | m_relations[parentId].parseMember(parser.attributes()); |
263 | } |
264 | } |
265 | |
266 | if (parser.hasError()) |
267 | { |
268 | error = parser.errorString(); |
269 | return nullptr; |
270 | } |
271 | |
272 | return createDocument(m_nodes, m_ways, m_relations); |
273 | } |
274 | |
275 | GeoDataDocument* OsmParser::parseOsmPbf(const QString& filename, QString& error) |
276 | { |
277 | QFile f(filename); |
278 | |
279 | if (!f.open(QFile::ReadOnly)) |
280 | { |
281 | error = f.errorString(); |
282 | return nullptr; |
283 | } |
284 | |
285 | const auto data = f.map(0, f.size()); |
286 | OsmPbfParser p; |
287 | p.parse(data, f.size()); |
288 | return createDocument(p.m_nodes, p.m_ways, p.m_relations); |
289 | } |
290 | |
291 | GeoDataDocument* OsmParser::createDocument(OsmNodes& nodes, OsmWays& ways, OsmRelations& relations) |
292 | { |
293 | GeoDataDocument* document = new GeoDataDocument; |
294 | GeoDataPolyStyle backgroundPolyStyle; |
295 | backgroundPolyStyle.setFill(true); |
296 | backgroundPolyStyle.setOutline(false); |
297 | backgroundPolyStyle.setColor(QStringLiteral("#f1eee8")); |
298 | GeoDataStyle::Ptr backgroundStyle(new GeoDataStyle); |
299 | backgroundStyle->setPolyStyle(backgroundPolyStyle); |
300 | backgroundStyle->setId(QStringLiteral("background")); |
301 | document->addStyle(backgroundStyle); |
302 | |
303 | QSet<qint64> usedNodes, usedWays; |
304 | |
305 | for (auto const& relation : relations) |
306 | { |
307 | relation.createMultipolygon(document, ways, nodes, usedNodes, usedWays); |
308 | } |
309 | |
310 | for (auto id : usedWays) |
311 | { |
312 | ways.remove(id); |
313 | } |
314 | |
315 | QHash<qint64, GeoDataPlacemark*> placemarks; |
316 | |
317 | for (auto iter = ways.constBegin(), end = ways.constEnd(); iter != end; ++iter) |
318 | { |
319 | auto placemark = iter.value().create(nodes, usedNodes); |
320 | |
321 | if (placemark) |
322 | { |
323 | document->append(placemark); |
324 | placemarks[placemark->osmData().oid()] = placemark; |
325 | } |
326 | } |
327 | |
328 | for (auto id : usedNodes) |
329 | { |
330 | if (nodes[id].osmData().isEmpty()) |
331 | { |
332 | nodes.remove(id); |
333 | } |
334 | } |
335 | |
336 | for (auto const& node : nodes) |
337 | { |
338 | auto placemark = node.create(); |
339 | |
340 | if (placemark) |
341 | { |
342 | document->append(placemark); |
343 | placemarks[placemark->osmData().oid()] = placemark; |
344 | } |
345 | } |
346 | |
347 | for (auto const& relation : relations) |
348 | { |
349 | relation.createRelation(document, placemarks); |
350 | } |
351 | |
352 | return document; |
353 | } |
354 | |
355 | } |