Fix a couple of warnings found by PVS Studio

This commit is contained in:
Siarhei Fedartsou 2022-09-21 21:34:52 +02:00
parent 9b834810d5
commit 8390a9507e
9 changed files with 14 additions and 12 deletions

View File

@ -54,6 +54,7 @@ struct PhantomNode
forward_distance_offset(0), reverse_distance_offset(0), forward_distance_offset(0), reverse_distance_offset(0),
forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION), forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION),
forward_duration_offset(0), reverse_duration_offset(0), 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}, 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) is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0)

View File

@ -135,7 +135,8 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge
inline NodeBasedEdgeClassification::NodeBasedEdgeClassification() inline NodeBasedEdgeClassification::NodeBasedEdgeClassification()
: forward(false), backward(false), is_split(false), roundabout(false), circular(false), : 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)
{ {
} }

View File

@ -28,7 +28,7 @@ struct TurnRestriction
// The turn sequence that the restriction applies to. // The turn sequence that the restriction applies to.
TurnPath turn_path; TurnPath turn_path;
// Indicates if the restriction turn *must* or *must not* be taken. // 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. // We represent conditional and unconditional restrictions with the same structure.
// Unconditional restrictions will have empty conditions. // Unconditional restrictions will have empty conditions.
std::vector<util::OpeningHours> condition; std::vector<util::OpeningHours> condition;

View File

@ -38,17 +38,17 @@ struct LuaScriptingContext final
RasterContainer raster_sources; RasterContainer raster_sources;
sol::state state; sol::state state;
bool has_turn_penalty_function; bool has_turn_penalty_function = false;
bool has_node_function; bool has_node_function = false;
bool has_way_function; bool has_way_function = false;
bool has_segment_function; bool has_segment_function = false;
sol::function turn_function; sol::function turn_function;
sol::function way_function; sol::function way_function;
sol::function node_function; sol::function node_function;
sol::function segment_function; sol::function segment_function;
int api_version; int api_version = 4;
sol::table profile_table; sol::table profile_table;
// Reference to immutable location dependent data and locations memo // Reference to immutable location dependent data and locations memo

View File

@ -231,7 +231,7 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
protected: protected:
Vector<EdgeOffset> node_to_edge_offset; Vector<EdgeOffset> node_to_edge_offset;
std::uint32_t connectivity_checksum; std::uint32_t connectivity_checksum = 0;
}; };
using MultiLevelEdgeBasedGraph = using MultiLevelEdgeBasedGraph =

View File

@ -107,11 +107,11 @@ class Server
} }
} }
RequestHandler request_handler;
unsigned thread_pool_size; unsigned thread_pool_size;
boost::asio::io_context io_context; boost::asio::io_context io_context;
boost::asio::ip::tcp::acceptor acceptor; boost::asio::ip::tcp::acceptor acceptor;
std::shared_ptr<Connection> new_connection; std::shared_ptr<Connection> new_connection;
RequestHandler request_handler;
}; };
} // namespace server } // namespace server
} // namespace osrm } // namespace osrm

View File

@ -211,7 +211,7 @@ struct SharedRegion
char name[MAX_NAME_LENGTH + 1]; char name[MAX_NAME_LENGTH + 1];
std::uint64_t timestamp; 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 // Keeps a list of all shared regions in a fixed-sized struct

View File

@ -66,7 +66,7 @@ struct UpdaterConfig final : storage::IOConfig
IOConfig::UseDefaultOutputNames(base); IOConfig::UseDefaultOutputNames(base);
} }
double log_edge_updates_factor; double log_edge_updates_factor = 0.0;
std::time_t valid_now; std::time_t valid_now;
std::vector<std::string> segment_speed_lookup_paths; std::vector<std::string> segment_speed_lookup_paths;

View File

@ -372,7 +372,7 @@ bool areParallel(const iterator_type lhs_begin,
const auto slope_rhs = get_slope(null_island, rotated_difference_rhs); const auto slope_rhs = get_slope(null_island, rotated_difference_rhs);
// the left hand side has a slope of `0` after the rotation. We can check the slope of the right // the left hand side has a slope of `0` after the rotation. We can check the slope of the right
// hand side to ensure we only considering slight slopes // hand side to ensure we only considering slight slopes
return std::abs(slope_rhs) < 0.20; // twenty percent incline at the most return std::fabs(slope_rhs) < 0.20; // twenty percent incline at the most
} }
double computeArea(const std::vector<Coordinate> &polygon); double computeArea(const std::vector<Coordinate> &polygon);