Skip to content

Commit

Permalink
Integers to expansion JSON output were cast wrongly (#3857)
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Kreiser <kevinkreiser@gmail.com>
  • Loading branch information
nilsnolde and kevinkreiser committed Dec 6, 2022
1 parent 987c412 commit 591f3e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
* FIXED: Newer clang warns on `sprintf` which becomes a compilation error (due to `Werror`) so we use `snprintf` instead [#3846](https://github.com/valhalla/valhalla/issues/3846)
* FIXED: Build all of Mjolnir with -Werror [#3845](https://github.com/valhalla/valhalla/pull/3845)
* FIXED: Only set most destination information once for all origins in timedistancematrix [#3830](https://github.com/valhalla/valhalla/pull/3830)
* FIXED: Integers to expansion JSON output were cast wrongly [#3857](https://github.com/valhalla/valhalla/pull/3857)
* **Enhancement**
* ADDED: Added has_toll, has_higway, has_ferry tags to summary field of a leg and route and a highway tag to a maneuver if it includes a highway. [#3815](https://github.com/valhalla/valhalla/issues/3815)
* ADDED: Add time info to sources_to_targets [#3795](https://github.com/valhalla/valhalla/pull/3795)
Expand Down
8 changes: 4 additions & 4 deletions src/thor/expansion_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ std::string thor_worker_t::expansion(Api& request) {
Pointer(kPropPaths[Options_ExpansionProperties_durations])
.Get(dom)
->GetArray()
.PushBack(Value{}.SetInt(static_cast<uint64_t>(duration)), a);
.PushBack(Value{}.SetUint(static_cast<uint32_t>(duration)), a);
}
if (exp_props.count(Options_ExpansionProperties_distances)) {
Pointer(kPropPaths[Options_ExpansionProperties_distances])
.Get(dom)
->GetArray()
.PushBack(Value{}.SetInt(distance), a);
.PushBack(Value{}.SetUint(distance), a);
}
if (exp_props.count(Options_ExpansionProperties_costs)) {
Pointer(kPropPaths[Options_ExpansionProperties_costs])
.Get(dom)
->GetArray()
.PushBack(Value{}.SetInt(static_cast<uint64_t>(cost)), a);
.PushBack(Value{}.SetUint(static_cast<uint32_t>(cost)), a);
}
if (exp_props.count(Options_ExpansionProperties_statuses))
Pointer(kPropPaths[Options_ExpansionProperties_statuses])
Expand All @@ -126,7 +126,7 @@ std::string thor_worker_t::expansion(Api& request) {
Pointer(kPropPaths[Options_ExpansionProperties_edge_ids])
.Get(dom)
->GetArray()
.PushBack(Value{}.SetInt(static_cast<uint64_t>(edgeid)), a);
.PushBack(Value{}.SetUint64(static_cast<uint64_t>(edgeid)), a);
};

// tell all the algorithms how to track expansion
Expand Down

0 comments on commit 591f3e6

Please sign in to comment.