Skip to content

Commit b0a4ad9

Browse files
authored
Merge pull request #5887 from dburnsii/upgrade_libsol2_v2.20.6
Upgrade libsol2 v2.20.6
2 parents 370081e + af5efd2 commit b0a4ad9

File tree

412 files changed

+386685
-14533
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

412 files changed

+386685
-14533
lines changed

features/testbot/nil.feature

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
@routing @testbot @nil
2-
Feature: Testbot - Check assigning nil values
3-
Scenario: Assign nil values to all way strings
2+
Feature: Testbot - Check assigning empty values
3+
Scenario: Assign empty values to all way strings
44
Given the profile file
55
"""
66
functions = require('testbot')
77
88
function way_function(profile, way, result)
9-
result.name = nil
10-
result.ref = nil
11-
result.destinations = nil
12-
result.exits = nil
13-
result.pronunciation = nil
14-
result.turn_lanes_forward = nil
15-
result.turn_lanes_backward = nil
9+
result.name = ""
10+
result.ref = ""
11+
result.destinations = ""
12+
result.exits = ""
13+
result.pronunciation = ""
14+
result.turn_lanes_forward = ""
15+
result.turn_lanes_backward = ""
1616
1717
result.forward_speed = 10
1818
result.backward_speed = 10

include/engine/datafacade_factory.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ template <template <typename A> class FacadeT, typename AlgorithmT> class DataFa
7070
"The exclude prefix needs to be a valid data path.");
7171
std::size_t index =
7272
std::stoi(exclude_prefix.substr(index_begin + 1, exclude_prefix.size()));
73-
BOOST_ASSERT(index >= 0 && index < facades.size());
73+
BOOST_ASSERT(index < facades.size());
7474
facades[index] = std::make_shared<const Facade>(allocator, metric_name, index);
7575
}
7676

include/extractor/extraction_turn.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ struct ExtractionTurnLeg
3333
{
3434
}
3535

36-
const bool is_restricted;
37-
const bool is_motorway;
38-
const bool is_link;
39-
const int number_of_lanes;
40-
const int highway_turn_classification;
41-
const int access_turn_classification;
42-
const int speed;
43-
const RoadPriorityClass::Enum priority_class;
44-
const bool is_incoming;
45-
const bool is_outgoing;
36+
bool is_restricted;
37+
bool is_motorway;
38+
bool is_link;
39+
int number_of_lanes;
40+
int highway_turn_classification;
41+
int access_turn_classification;
42+
int speed;
43+
RoadPriorityClass::Enum priority_class;
44+
bool is_incoming;
45+
bool is_outgoing;
4646
};
4747

4848
struct ExtractionTurn

include/extractor/scripting_environment_lua.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <mutex>
1313
#include <string>
1414

15-
#include <sol2/sol.hpp>
15+
#include <sol.hpp>
1616

1717
namespace osrm
1818
{

profiles/lib/measure.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function Measure.get_max_height(raw_value, element)
7272
if raw_value then
7373
if height_non_numerical_values[raw_value] then
7474
if element then
75-
return element:get_location_tag('maxheight') or default_maxheight
75+
return tonumber(element:get_location_tag('maxheight')) or default_maxheight
7676
else
7777
return default_maxheight
7878
end

src/extractor/scripting_environment_lua.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ struct to_lua_object : public boost::static_visitor<sol::object>
8888
{
8989
to_lua_object(sol::state &state) : state(state) {}
9090
template <typename T> auto operator()(T &v) const { return sol::make_object(state, v); }
91-
auto operator()(boost::blank &) const { return sol::nil; }
91+
auto operator()(boost::blank &) const { return sol::lua_nil; }
9292
sol::state &state;
9393
};
9494
} // namespace
@@ -236,7 +236,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
236236

237237
auto get_location_tag = [](auto &context, const auto &location, const char *key) {
238238
if (context.location_dependent_data.empty())
239-
return sol::object(sol::nil);
239+
return sol::object(context.state);
240240

241241
const LocationDependentData::point_t point{location.lon(), location.lat()};
242242
if (!boost::geometry::equals(context.last_location_point, point))
@@ -259,7 +259,7 @@ void Sol2ScriptingEnvironment::InitContext(LuaScriptingContext &context)
259259
"version",
260260
&osmium::Way::version,
261261
"get_nodes",
262-
[](const osmium::Way &way) { return sol::as_table(way.nodes()); },
262+
[](const osmium::Way &way) { return sol::as_table(&way.nodes()); },
263263
"get_location_tag",
264264
[&context, &get_location_tag](const osmium::Way &way, const char *key) {
265265
// HEURISTIC: use a single node (last) of the way to localize the way
@@ -927,7 +927,7 @@ std::vector<std::string>
927927
Sol2ScriptingEnvironment::GetStringListFromFunction(const std::string &function_name)
928928
{
929929
auto &context = GetSol2Context();
930-
BOOST_ASSERT(context.state.lua_state() != nullptr);
930+
BOOST_ASSERT(context.state.lua_state());
931931
std::vector<std::string> strings;
932932
sol::function function = context.state[function_name];
933933
if (function.valid())
@@ -943,6 +943,10 @@ Sol2ScriptingEnvironment::GetStringListFromTable(const std::string &table_name)
943943
auto &context = GetSol2Context();
944944
BOOST_ASSERT(context.state.lua_state() != nullptr);
945945
std::vector<std::string> strings;
946+
if (!context.profile_table[table_name])
947+
{
948+
return strings;
949+
}
946950
sol::table table = context.profile_table[table_name];
947951
if (table.valid())
948952
{
@@ -961,6 +965,10 @@ Sol2ScriptingEnvironment::GetStringListsFromTable(const std::string &table_name)
961965

962966
auto &context = GetSol2Context();
963967
BOOST_ASSERT(context.state.lua_state() != nullptr);
968+
if (!context.profile_table[table_name])
969+
{
970+
return string_lists;
971+
}
964972
sol::table table = context.profile_table[table_name];
965973
if (!table.valid())
966974
{

third_party/sol2/.clang-format

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# # # # sol2
2+
# The MIT License (MIT)
3+
#
4+
# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
7+
# this software and associated documentation files (the "Software"), to deal in
8+
# the Software without restriction, including without limitation the rights to
9+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+
# the Software, and to permit persons to whom the Software is furnished to do so,
11+
# subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
23+
---
24+
BasedOnStyle: WebKit
25+
IndentWidth: 5
26+
TabWidth: 5
27+
ContinuationIndentWidth: 5
28+
UseTab: Always
29+
30+
# Namespaces
31+
NamespaceIndentation: All
32+
CompactNamespaces: true
33+
FixNamespaceComments: true
34+
35+
# Overall Alignment
36+
ColumnLimit: 0
37+
AlignAfterOpenBracket: DontAlign # uses ContinuationIndentWidth for this instead
38+
AccessModifierOffset: -5 # do not push public: or private: around
39+
#AlignConsecutiveAssignments: true # affects more than what's expected: do not use
40+
#AlignConsecutiveDeclarations: true # affects more than what's expected: do not use
41+
42+
# Type Alignment
43+
DerivePointerAlignment: false
44+
PointerAlignment: Left
45+
AlwaysBreakTemplateDeclarations: true
46+
AlwaysBreakBeforeMultilineStrings: true
47+
48+
# Comments
49+
AlignTrailingComments: true
50+
ReflowComments: true
51+
52+
# Macros
53+
AlignEscapedNewlines: Left
54+
#IndentPPDirectives: None
55+
56+
# Functions
57+
AllowShortFunctionsOnASingleLine: None
58+
AlwaysBreakAfterReturnType: None
59+
BreakConstructorInitializers: BeforeComma
60+
ConstructorInitializerIndentWidth: 0
61+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
62+
BinPackArguments: true
63+
BinPackParameters: true
64+
65+
# Classes
66+
BreakBeforeInheritanceComma: false
67+
68+
# Braces
69+
Cpp11BracedListStyle: false
70+
BreakBeforeBraces: Custom
71+
BraceWrapping:
72+
AfterEnum: false
73+
AfterStruct: false
74+
AfterControlStatement: false
75+
AfterClass: false
76+
AfterNamespace: false
77+
AfterStruct: false
78+
AfterUnion: false
79+
BeforeElse: true
80+
BeforeCatch: true
81+
IndentBraces: false
82+
SplitEmptyFunction: false
83+
SplitEmptyRecord: false
84+
SplitEmptyNamespace: true
85+
86+
# Control Statements
87+
AllowShortIfStatementsOnASingleLine: false
88+
AllowShortLoopsOnASingleLine: false
89+
AllowShortCaseLabelsOnASingleLine: false
90+
IndentCaseLabels: false
91+
92+
# Spaces
93+
SpaceAfterCStyleCast: false
94+
SpacesInCStyleCastParentheses: false
95+
SpaceAfterTemplateKeyword: true
96+
SpaceBeforeAssignmentOperators: true
97+
SpaceBeforeParens: ControlStatements
98+
SpaceInEmptyParentheses: false
99+
SpacesInAngles: false
100+
SpacesInParentheses: false
101+
SpacesInSquareBrackets: false
102+
MaxEmptyLinesToKeep: 3
103+
104+
# OCD
105+
SortUsingDeclarations: true
106+
SortIncludes: false
107+
108+
---
109+
Language: Cpp
110+
Standard: Cpp11

third_party/sol2/.dockerignore

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# # # # sol2
2+
# The MIT License (MIT)
3+
#
4+
# Copyright (c) 2013-2018 Rapptz, ThePhD, and contributors
5+
#
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy of
7+
# this software and associated documentation files (the "Software"), to deal in
8+
# the Software without restriction, including without limitation the rights to
9+
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10+
# the Software, and to permit persons to whom the Software is furnished to do so,
11+
# subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18+
# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19+
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20+
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21+
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22+
23+
# Ignore literally everything
24+
**
25+
26+
# Except the script directory
27+
!scripts/preparation*
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Read these guidelines. They are relatively simple and will allow me to help you better:
2+
3+
1. Produce a simple, short, compilable test case that reproduces your problem.
4+
2. Make a descriptive title that summarises the bug as a whole.
5+
3. Explain the bug in as much detail as you can in the body of the issue.
6+
4. Include Compiler/IDE (Visual Studio, XCode...), Build and Deployment System, Language (C++, Objective-C++), and any special defines you have set.
7+
8+
If you want to request a feature:
9+
10+
1. Produce any relevant imaginary code that illustrates what you would like or desired behavior.
11+
2. Include a description and title of what you would like.
12+
3. Annotate and describe the behavior through comments, asserts or just a small write up.
13+
14+
Thanks for helping sol grow!

0 commit comments

Comments
 (0)