read properties stream to size of properties object, not 1

This commit is contained in:
karenzshea 2016-10-21 13:52:27 -07:00 committed by Huyen Chau Nguyen
parent 51ebadfc45
commit c4f010e363
3 changed files with 6 additions and 6 deletions

View File

@ -124,7 +124,7 @@ class InternalDataFacade final : public BaseDataFacade
throw util::exception("Could not open " + properties_path.string() + " for reading."); throw util::exception("Could not open " + properties_path.string() + " for reading.");
} }
auto PropertiesSize = storage::io::readPropertiesSize(); auto PropertiesSize = storage::io::readPropertiesSize();
storage::io::readProperties(in_stream, reinterpret_cast<char *>(&m_profile_properties), PropertiesSize); storage::io::readProperties(in_stream, &m_profile_properties, PropertiesSize);
} }
void LoadLaneTupleIdPairs(const boost::filesystem::path &lane_data_path) void LoadLaneTupleIdPairs(const boost::filesystem::path &lane_data_path)

View File

@ -19,10 +19,10 @@ inline std::size_t readPropertiesSize() { return 1; }
template <typename PropertiesT> template <typename PropertiesT>
inline void readProperties(boost::filesystem::ifstream &properties_stream, inline void readProperties(boost::filesystem::ifstream &properties_stream,
PropertiesT properties[], PropertiesT *properties,
std::size_t PropertiesSize) std::size_t properties_size)
{ {
properties_stream.read(properties, PropertiesSize); properties_stream.read(reinterpret_cast<char *>(properties), properties_size);
} }
#pragma pack(push, 1) #pragma pack(push, 1)

View File

@ -771,8 +771,8 @@ Storage::ReturnCode Storage::Run(int max_wait)
util::exception("Could not open " + config.properties_path.string() + " for reading!"); util::exception("Could not open " + config.properties_path.string() + " for reading!");
} }
io::readProperties(profile_properties_stream, io::readProperties(profile_properties_stream,
reinterpret_cast<char *>(profile_properties_ptr), profile_properties_ptr,
PropertiesSize); sizeof(extractor::ProfileProperties));
// load intersection classes // load intersection classes
if (!bearing_class_id_table.empty()) if (!bearing_class_id_table.empty())