Fixed incorrect returned span length for byte stream read

This commit is contained in:
John Wellbelove 2022-05-15 18:01:44 +01:00
parent 2d743082ec
commit 7b3bb5fa6d
2 changed files with 3 additions and 1 deletions

View File

@ -559,7 +559,7 @@ namespace etl
{
T* destination = start;
while (length-- != 0U)
for (size_t i = 0; i < length; ++i)
{
*destination++ = from_bytes<T>();
}

View File

@ -920,6 +920,7 @@ namespace
etl::optional<etl::span<const int32_t> > result = reader.read<int32_t>(output);
CHECK(result.has_value());
CHECK_EQUAL(sizeof(const int32_t), result.value().size());
CHECK_EQUAL(put_data[0], get_data[0]);
CHECK_EQUAL(put_data[1], get_data[1]);
CHECK_EQUAL(put_data[2], get_data[2]);
@ -944,6 +945,7 @@ namespace
etl::optional<etl::span<const int32_t> > result = reader.read<int32_t>(get_data.data(), get_data.size());
CHECK(result.has_value());
CHECK_EQUAL(sizeof(const int32_t), result.value().size());
CHECK_EQUAL(put_data[0], get_data[0]);
CHECK_EQUAL(put_data[1], get_data[1]);
CHECK_EQUAL(put_data[2], get_data[2]);