Merge pull request #1740 from c0nk/develop

Fix various bugs
This commit is contained in:
Patrick Niklaus 2015-10-19 20:31:23 +02:00
commit 3f82570469
3 changed files with 7 additions and 15 deletions

View File

@ -429,7 +429,7 @@ class AlternativeRouting final
// partial unpacking, compute sharing // partial unpacking, compute sharing
// First partially unpack s-->v until paths deviate, note length of common path. // First partially unpack s-->v until paths deviate, note length of common path.
const int64_t s_v_min_path_size = const int64_t s_v_min_path_size =
std::min(packed_s_v_path.size(), packed_shortest_path.size()) - 1; static_cast<int64_t>(std::min(packed_s_v_path.size(), packed_shortest_path.size())) - 1;
for (const int64_t current_node : osrm::irange<int64_t>(0, s_v_min_path_size)) for (const int64_t current_node : osrm::irange<int64_t>(0, s_v_min_path_size))
{ {
if (packed_s_v_path[current_node] == packed_shortest_path[current_node] && if (packed_s_v_path[current_node] == packed_shortest_path[current_node] &&
@ -455,7 +455,8 @@ class AlternativeRouting final
} }
// traverse partially unpacked edge and note common prefix // traverse partially unpacked edge and note common prefix
const int64_t packed_path_length = const int64_t packed_path_length =
std::min(partially_unpacked_via_path.size(), partially_unpacked_shortest_path.size()) - static_cast<int64_t>(std::min(partially_unpacked_via_path.size(),
partially_unpacked_shortest_path.size())) -
1; 1;
for (int64_t current_node = 0; (current_node < packed_path_length) && for (int64_t current_node = 0; (current_node < packed_path_length) &&
(partially_unpacked_via_path[current_node] == (partially_unpacked_via_path[current_node] ==
@ -471,8 +472,8 @@ class AlternativeRouting final
} }
// Second, partially unpack v-->t in reverse order until paths deviate and note lengths // Second, partially unpack v-->t in reverse order until paths deviate and note lengths
int64_t via_path_index = packed_v_t_path.size() - 1; int64_t via_path_index = static_cast<int64_t>(packed_v_t_path.size()) - 1;
int64_t shortest_path_index = packed_shortest_path.size() - 1; int64_t shortest_path_index = static_cast<int64_t>(packed_shortest_path.size()) - 1;
for (; via_path_index > 0 && shortest_path_index > 0; for (; via_path_index > 0 && shortest_path_index > 0;
--via_path_index, --shortest_path_index) --via_path_index, --shortest_path_index)
{ {

View File

@ -76,7 +76,7 @@ struct Renderer : mapbox::util::static_visitor<>
void operator()(const Array &array) const void operator()(const Array &array) const
{ {
out << "["; out << "[";
for (auto it = array.values.cend(), end = array.values.cend(); it != end;) for (auto it = array.values.cbegin(), end = array.values.cend(); it != end;)
{ {
mapbox::util::apply_visitor(Renderer(out), *it); mapbox::util::apply_visitor(Renderer(out), *it);
if (++it != end) if (++it != end)

View File

@ -80,16 +80,7 @@ inline void populate_base_path(ServerPaths &server_paths)
if (path_iterator == server_paths.end() || if (path_iterator == server_paths.end() ||
!boost::filesystem::is_regular_file(path_iterator->second)) !boost::filesystem::is_regular_file(path_iterator->second))
{ {
if (path_iterator == server_paths.end()) throw osrm::exception(".hsgr not found");
{
SimpleLogger().Write() << "hsgrdata unset";
}
if (!boost::filesystem::is_regular_file(path_iterator->second))
{
SimpleLogger().Write() << "not a regular file";
}
throw osrm::exception(".hsgr not found: " + path_iterator->second.string());
} }
path_iterator = server_paths.find("nodesdata"); path_iterator = server_paths.find("nodesdata");