diff --git a/include/nigiri/location.h b/include/nigiri/location.h index ca7f78d2c..8e51ebec3 100644 --- a/include/nigiri/location.h +++ b/include/nigiri/location.h @@ -28,7 +28,7 @@ struct location { it_range::const_iterator> equivalences); location_idx_t l_{location_idx_t::invalid()}; std::string_view id_; - std::string_view name_; + cista::raw::string name_; geo::latlng pos_; source_idx_t src_; location_type type_; @@ -41,4 +41,4 @@ struct location { } // namespace nigiri template <> -struct fmt::formatter : ostream_formatter {}; \ No newline at end of file +struct fmt::formatter : ostream_formatter {}; diff --git a/src/abi.cc b/src/abi.cc index ce25e823a..f9867b2b5 100644 --- a/src/abi.cc +++ b/src/abi.cc @@ -177,7 +177,7 @@ nigiri_location_t* nigiri_get_location(const nigiri_timetable_t* t, auto location = new nigiri_location_t; auto l = t->tt->locations_.get(lidx); location->name = l.name_.data(); - location->name_len = static_cast(l.name_.length()); + location->name_len = static_cast(l.name_.size()); location->id = l.id_.data(); location->id_len = static_cast(l.id_.length()); location->lat = l.pos_.lat_; @@ -237,4 +237,4 @@ void nigiri_update_with_rt(const nigiri_timetable_t* t, void* context) { auto const file = cista::mmap{gtfsrt_pb_path, cista::mmap::protection::READ}; return nigiri_update_with_rt_from_buf(t, file.view(), callback, context); -} \ No newline at end of file +} diff --git a/src/loader/gtfs/stop.cc b/src/loader/gtfs/stop.cc index afff2dd1c..4340bcf82 100644 --- a/src/loader/gtfs/stop.cc +++ b/src/loader/gtfs/stop.cc @@ -247,7 +247,11 @@ locations_map read_stops(source_idx_t const src, locations.emplace( std::string{id}, s->location_ = tt.locations_.register_location(location{ - id, is_track ? s->platform_code_ : s->name_.view(), s->coord_, src, + id, + is_track ? cista::raw::string(s->platform_code_, + cista::raw::string::non_owning) + : s->name_, + s->coord_, src, is_track ? location_type::kTrack : location_type::kStation, location_idx_t::invalid(), s->timezone_.empty() ? timezone_idx_t::invalid()