diff --git a/extractor/extraction_containers.cpp b/extractor/extraction_containers.cpp index 5be2c003e..48a626b1c 100644 --- a/extractor/extraction_containers.cpp +++ b/extractor/extraction_containers.cpp @@ -57,8 +57,8 @@ ExtractionContainers::ExtractionContainers() { // Check if stxxl can be instantiated stxxl::vector dummy_vector; - name_char_data.push_back('\0'); - name_offsets.push_back(1); + // Insert the empty string, it has no data and is zero length + name_lengths.push_back(0); } ExtractionContainers::~ExtractionContainers() @@ -68,7 +68,7 @@ ExtractionContainers::~ExtractionContainers() all_nodes_list.clear(); all_edges_list.clear(); name_char_data.clear(); - name_offsets.clear(); + name_lengths.clear(); restrictions_list.clear(); way_start_end_id_list.clear(); } @@ -121,13 +121,13 @@ void ExtractionContainers::WriteNames(const std::string& names_file_name) const unsigned total_length = 0; - for (const unsigned &name_offset : name_offsets) + for (const unsigned &name_length : name_lengths) { - total_length += name_offset; + total_length += name_length; } // builds and writes the index - RangeTable<> name_index_range(name_offsets); + RangeTable<> name_index_range(name_lengths); name_file_stream << name_index_range; name_file_stream.write((char *)&total_length, sizeof(unsigned)); diff --git a/extractor/extraction_containers.hpp b/extractor/extraction_containers.hpp index 4c64c88bd..9c0a7d103 100644 --- a/extractor/extraction_containers.hpp +++ b/extractor/extraction_containers.hpp @@ -71,7 +71,7 @@ class ExtractionContainers STXXLNodeVector all_nodes_list; STXXLEdgeVector all_edges_list; stxxl::vector name_char_data; - std::vector name_offsets; + std::vector name_lengths; STXXLRestrictionsVector restrictions_list; STXXLWayIDStartEndVector way_start_end_id_list; std::unordered_map external_to_internal_node_id_map; diff --git a/extractor/extractor_callbacks.cpp b/extractor/extractor_callbacks.cpp index da1efc5a9..719fb5e57 100644 --- a/extractor/extractor_callbacks.cpp +++ b/extractor/extractor_callbacks.cpp @@ -153,7 +153,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti // Get the unique identifier for the street name const auto &string_map_iterator = string_map.find(parsed_way.name); - unsigned name_id = external_memory.name_offsets.size(); + unsigned name_id = external_memory.name_lengths.size(); if (string_map.end() == string_map_iterator) { unsigned name_length = 0; @@ -167,7 +167,7 @@ void ExtractorCallbacks::ProcessWay(const osmium::Way &input_way, const Extracti external_memory.name_char_data.push_back(c); name_length++; } - external_memory.name_offsets.push_back(name_length); + external_memory.name_lengths.push_back(name_length); string_map.insert(std::make_pair(parsed_way.name, name_id)); } else