Address PR comments

This commit is contained in:
Patrick Niklaus 2017-02-07 14:34:15 +00:00
parent bf690df97a
commit 0c04c6cafb
3 changed files with 10 additions and 15 deletions

View File

@ -859,18 +859,15 @@ class ContiguousInternalMemoryDataFacade : public BaseDataFacade
const unsigned end = m_geometry_indices.at(id + 1);
std::vector<DatasourceID> result_datasources;
result_datasources.resize(end - begin);
// If there was no datasource info, return an array of 0's.
if (m_datasource_list.empty())
{
for (unsigned i = 0; i < end - begin; ++i)
{
result_datasources.push_back(0);
}
result_datasources.resize(end - begin, 0);
}
else
{
result_datasources.resize(end - begin);
std::copy(m_datasource_list.begin() + begin,
m_datasource_list.begin() + end,
result_datasources.begin());
@ -902,13 +899,11 @@ class ContiguousInternalMemoryDataFacade : public BaseDataFacade
// If there was no datasource info, return an array of 0's.
if (m_datasource_list.empty())
{
for (unsigned i = 0; i < end - begin; ++i)
{
result_datasources.push_back(0);
}
result_datasources.resize(end - begin, 0);
}
else
{
result_datasources.resize(end - begin);
std::copy(m_datasource_list.rbegin() + (m_datasource_list.size() - end),
m_datasource_list.rbegin() + (m_datasource_list.size() - begin),
result_datasources.begin());

View File

@ -91,7 +91,7 @@ class FileReader
const auto &result = input_stream.read(reinterpret_cast<char *>(dest), count * sizeof(T));
const std::size_t bytes_read = input_stream.gcount();
if (bytes_read != count && !result)
if (bytes_read != count * sizeof(T) && !result)
{
if (result.eof())
{