From be353630d5e845b1dc64a4b5e467b6a4bc1addbf Mon Sep 17 00:00:00 2001 From: Siarhei Fedartsou Date: Thu, 22 Sep 2022 23:28:12 +0200 Subject: [PATCH] Fix a couple of warnings found by PVS Studio (#6372) --- .github/workflows/osrm-backend.yml | 1 - include/engine/phantom_node.hpp | 1 + include/extractor/node_based_edge.hpp | 3 ++- include/extractor/restriction.hpp | 2 +- include/extractor/scripting_environment_lua.hpp | 10 +++++----- include/partitioner/multi_level_graph.hpp | 2 +- include/server/server.hpp | 2 +- include/storage/shared_datatype.hpp | 2 +- include/updater/updater_config.hpp | 2 +- 9 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/osrm-backend.yml b/.github/workflows/osrm-backend.yml index 663bdd6ea..6dc5bb528 100644 --- a/.github/workflows/osrm-backend.yml +++ b/.github/workflows/osrm-backend.yml @@ -607,7 +607,6 @@ jobs: # Linux dev packages if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then - sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y sudo apt-get update -y sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev if [[ "${CCOMPILER}" != clang-* ]]; then diff --git a/include/engine/phantom_node.hpp b/include/engine/phantom_node.hpp index 5d6c09839..345068f9f 100644 --- a/include/engine/phantom_node.hpp +++ b/include/engine/phantom_node.hpp @@ -54,6 +54,7 @@ struct PhantomNode forward_distance_offset(0), reverse_distance_offset(0), forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION), forward_duration_offset(0), reverse_duration_offset(0), + component({INVALID_COMPONENTID, 0}), fwd_segment_position(0), is_valid_forward_source{false}, is_valid_forward_target{false}, is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0) diff --git a/include/extractor/node_based_edge.hpp b/include/extractor/node_based_edge.hpp index cafb06e12..94fc3728e 100644 --- a/include/extractor/node_based_edge.hpp +++ b/include/extractor/node_based_edge.hpp @@ -135,7 +135,8 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge inline NodeBasedEdgeClassification::NodeBasedEdgeClassification() : forward(false), backward(false), is_split(false), roundabout(false), circular(false), - startpoint(false), restricted(false) + startpoint(false), restricted(false), highway_turn_classification(0), + access_turn_classification(0) { } diff --git a/include/extractor/restriction.hpp b/include/extractor/restriction.hpp index 4dd73f747..c00fd20a4 100644 --- a/include/extractor/restriction.hpp +++ b/include/extractor/restriction.hpp @@ -28,7 +28,7 @@ struct TurnRestriction // The turn sequence that the restriction applies to. TurnPath turn_path; // Indicates if the restriction turn *must* or *must not* be taken. - bool is_only; + bool is_only = false; // We represent conditional and unconditional restrictions with the same structure. // Unconditional restrictions will have empty conditions. std::vector condition; diff --git a/include/extractor/scripting_environment_lua.hpp b/include/extractor/scripting_environment_lua.hpp index f3b19ee6e..f3ac12f95 100644 --- a/include/extractor/scripting_environment_lua.hpp +++ b/include/extractor/scripting_environment_lua.hpp @@ -38,17 +38,17 @@ struct LuaScriptingContext final RasterContainer raster_sources; sol::state state; - bool has_turn_penalty_function; - bool has_node_function; - bool has_way_function; - bool has_segment_function; + bool has_turn_penalty_function = false; + bool has_node_function = false; + bool has_way_function = false; + bool has_segment_function = false; sol::function turn_function; sol::function way_function; sol::function node_function; sol::function segment_function; - int api_version; + int api_version = 4; sol::table profile_table; // Reference to immutable location dependent data and locations memo diff --git a/include/partitioner/multi_level_graph.hpp b/include/partitioner/multi_level_graph.hpp index 48a9c3ae4..d4a9bcf4e 100644 --- a/include/partitioner/multi_level_graph.hpp +++ b/include/partitioner/multi_level_graph.hpp @@ -231,7 +231,7 @@ class MultiLevelGraph : public util::StaticGraph protected: Vector node_to_edge_offset; - std::uint32_t connectivity_checksum; + std::uint32_t connectivity_checksum = 0; }; using MultiLevelEdgeBasedGraph = diff --git a/include/server/server.hpp b/include/server/server.hpp index 280b48668..0b87e50ae 100644 --- a/include/server/server.hpp +++ b/include/server/server.hpp @@ -107,11 +107,11 @@ class Server } } + RequestHandler request_handler; unsigned thread_pool_size; boost::asio::io_context io_context; boost::asio::ip::tcp::acceptor acceptor; std::shared_ptr new_connection; - RequestHandler request_handler; }; } // namespace server } // namespace osrm diff --git a/include/storage/shared_datatype.hpp b/include/storage/shared_datatype.hpp index 8ffb9bf24..2ee55f40d 100644 --- a/include/storage/shared_datatype.hpp +++ b/include/storage/shared_datatype.hpp @@ -211,7 +211,7 @@ struct SharedRegion char name[MAX_NAME_LENGTH + 1]; std::uint64_t timestamp; - std::uint16_t shm_key; + std::uint16_t shm_key = 0; }; // Keeps a list of all shared regions in a fixed-sized struct diff --git a/include/updater/updater_config.hpp b/include/updater/updater_config.hpp index 30c2cec9f..3fc3e5b71 100644 --- a/include/updater/updater_config.hpp +++ b/include/updater/updater_config.hpp @@ -66,7 +66,7 @@ struct UpdaterConfig final : storage::IOConfig IOConfig::UseDefaultOutputNames(base); } - double log_edge_updates_factor; + double log_edge_updates_factor = 0.0; std::time_t valid_now; std::vector segment_speed_lookup_paths;