Skip to content

Commit be35363

Browse files
Fix a couple of warnings found by PVS Studio (#6372)
1 parent 9b83481 commit be35363

File tree

9 files changed

+13
-12
lines changed

9 files changed

+13
-12
lines changed

.github/workflows/osrm-backend.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,6 @@ jobs:
607607
608608
# Linux dev packages
609609
if [ "${TARGET_ARCH}" != "i686" ] && [ "${ENABLE_CONAN}" != "ON" ]; then
610-
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
611610
sudo apt-get update -y
612611
sudo apt-get install -y libbz2-dev libxml2-dev libzip-dev liblua5.2-dev libboost-all-dev
613612
if [[ "${CCOMPILER}" != clang-* ]]; then

include/engine/phantom_node.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct PhantomNode
5454
forward_distance_offset(0), reverse_distance_offset(0),
5555
forward_duration(MAXIMAL_EDGE_DURATION), reverse_duration(MAXIMAL_EDGE_DURATION),
5656
forward_duration_offset(0), reverse_duration_offset(0),
57+
component({INVALID_COMPONENTID, 0}),
5758
fwd_segment_position(0), is_valid_forward_source{false}, is_valid_forward_target{false},
5859
is_valid_reverse_source{false}, is_valid_reverse_target{false}, bearing(0)
5960

include/extractor/node_based_edge.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,8 @@ struct NodeBasedEdgeWithOSM : NodeBasedEdge
135135

136136
inline NodeBasedEdgeClassification::NodeBasedEdgeClassification()
137137
: forward(false), backward(false), is_split(false), roundabout(false), circular(false),
138-
startpoint(false), restricted(false)
138+
startpoint(false), restricted(false), highway_turn_classification(0),
139+
access_turn_classification(0)
139140
{
140141
}
141142

include/extractor/restriction.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ struct TurnRestriction
2828
// The turn sequence that the restriction applies to.
2929
TurnPath turn_path;
3030
// Indicates if the restriction turn *must* or *must not* be taken.
31-
bool is_only;
31+
bool is_only = false;
3232
// We represent conditional and unconditional restrictions with the same structure.
3333
// Unconditional restrictions will have empty conditions.
3434
std::vector<util::OpeningHours> condition;

include/extractor/scripting_environment_lua.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,17 @@ struct LuaScriptingContext final
3838
RasterContainer raster_sources;
3939
sol::state state;
4040

41-
bool has_turn_penalty_function;
42-
bool has_node_function;
43-
bool has_way_function;
44-
bool has_segment_function;
41+
bool has_turn_penalty_function = false;
42+
bool has_node_function = false;
43+
bool has_way_function = false;
44+
bool has_segment_function = false;
4545

4646
sol::function turn_function;
4747
sol::function way_function;
4848
sol::function node_function;
4949
sol::function segment_function;
5050

51-
int api_version;
51+
int api_version = 4;
5252
sol::table profile_table;
5353

5454
// Reference to immutable location dependent data and locations memo

include/partitioner/multi_level_graph.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ class MultiLevelGraph : public util::StaticGraph<EdgeDataT, Ownership>
231231

232232
protected:
233233
Vector<EdgeOffset> node_to_edge_offset;
234-
std::uint32_t connectivity_checksum;
234+
std::uint32_t connectivity_checksum = 0;
235235
};
236236

237237
using MultiLevelEdgeBasedGraph =

include/server/server.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ class Server
107107
}
108108
}
109109

110+
RequestHandler request_handler;
110111
unsigned thread_pool_size;
111112
boost::asio::io_context io_context;
112113
boost::asio::ip::tcp::acceptor acceptor;
113114
std::shared_ptr<Connection> new_connection;
114-
RequestHandler request_handler;
115115
};
116116
} // namespace server
117117
} // namespace osrm

include/storage/shared_datatype.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ struct SharedRegion
211211

212212
char name[MAX_NAME_LENGTH + 1];
213213
std::uint64_t timestamp;
214-
std::uint16_t shm_key;
214+
std::uint16_t shm_key = 0;
215215
};
216216

217217
// Keeps a list of all shared regions in a fixed-sized struct

include/updater/updater_config.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct UpdaterConfig final : storage::IOConfig
6666
IOConfig::UseDefaultOutputNames(base);
6767
}
6868

69-
double log_edge_updates_factor;
69+
double log_edge_updates_factor = 0.0;
7070
std::time_t valid_now;
7171

7272
std::vector<std::string> segment_speed_lookup_paths;

0 commit comments

Comments
 (0)