dded etl::byte_stream_overflow assert to byte_stream_reader 'skip'.

This commit is contained in:
John Wellbelove 2022-06-23 19:49:20 +01:00
parent aedb151b89
commit 3c26ffea4e
9 changed files with 14 additions and 12 deletions

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library - Arduino",
"version": "20.29.0",
"version": "20.29.1",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library - Arduino
version=20.29.0
version=20.29.1
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -749,16 +749,14 @@ namespace etl
template <typename T>
bool skip(size_t n)
{
size_t maximum = available<T>();
if (n < maximum)
if (n < available<T>())
{
pcurrent += (n * sizeof(T));
return true;
}
else
{
pcurrent += (maximum * sizeof(T));
ETL_ASSERT_FAIL(ETL_ERROR(etl::byte_stream_overflow));
return false;
}
}

View File

@ -40,7 +40,7 @@ SOFTWARE.
#define ETL_VERSION_MAJOR 20
#define ETL_VERSION_MINOR 29
#define ETL_VERSION_PATCH 0
#define ETL_VERSION_PATCH 1
#define ETL_VERSION ETL_STRING(ETL_VERSION_MAJOR) "." ETL_STRING(ETL_VERSION_MINOR) "." ETL_STRING(ETL_VERSION_PATCH)
#define ETL_VERSION_W ETL_WIDE_STRING(ETL_VERSION_MAJOR) L"." ETL_WIDE_STRING(ETL_VERSION_MINOR) L"." ETL_WIDE_STRING(ETL_VERSION_PATCH)

View File

@ -1,6 +1,6 @@
{
"name": "Embedded Template Library",
"version": "20.29.0",
"version": "20.29.1",
"authors": {
"name": "John Wellbelove",
"email": "john.wellbelove@etlcpp.com"

View File

@ -1,5 +1,5 @@
name=Embedded Template Library
version=20.29.0
version=20.29.1
author= John Wellbelove <john.wellbelove@etlcpp.com>
maintainer=John Wellbelove <john.wellbelove@etlcpp.com>
license=MIT

View File

@ -1,3 +1,7 @@
===============================================================================
20.29.1
Added etl::byte_stream_overflow assert to byte_stream_reader 'skip'.
===============================================================================
20.29.0
Added etl::bit_stream_writer

View File

@ -437,7 +437,7 @@ namespace
CHECK(result[0] = byte_stream.read<int32_t>());
CHECK(byte_stream.skip<int32_t>(2));
CHECK(result[3] = byte_stream.read<int32_t>());
CHECK(!byte_stream.skip<int32_t>(2));
CHECK_THROW(byte_stream.skip<int32_t>(2), etl::byte_stream_overflow);
for (size_t i = 0U; i < result.size(); ++i)
{
@ -1242,7 +1242,7 @@ namespace
reader.restart();
// Skip five int16_t (too many)
CHECK(!reader.skip<int16_t>(5U));
CHECK_THROW(reader.skip<int16_t>(5U), etl::byte_stream_overflow);
}
//*************************************************************************

View File

@ -1 +1 @@
20.29.0
20.29.1