mirror of https://github.com/ARMmbed/mbed-os.git
CRC: Removed assertion on NULL buffer
When length is zero, the buffer is not accessed. The CRC functions are used inside several other layers where a 0-length buffer may have meanings in different contexts and being able to pass 0-length NULL buffers to CRC as a noop simplifies the code.pull/7824/head
parent
683034db8a
commit
43651dfcdf
|
@ -415,7 +415,6 @@ private:
|
||||||
int32_t bitwise_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
|
int32_t bitwise_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
|
||||||
{
|
{
|
||||||
MBED_ASSERT(crc != NULL);
|
MBED_ASSERT(crc != NULL);
|
||||||
MBED_ASSERT(buffer != NULL);
|
|
||||||
|
|
||||||
const uint8_t *data = static_cast<const uint8_t *>(buffer);
|
const uint8_t *data = static_cast<const uint8_t *>(buffer);
|
||||||
uint32_t p_crc = *crc;
|
uint32_t p_crc = *crc;
|
||||||
|
@ -460,7 +459,6 @@ private:
|
||||||
int32_t table_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
|
int32_t table_compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc) const
|
||||||
{
|
{
|
||||||
MBED_ASSERT(crc != NULL);
|
MBED_ASSERT(crc != NULL);
|
||||||
MBED_ASSERT(buffer != NULL);
|
|
||||||
|
|
||||||
const uint8_t *data = static_cast<const uint8_t *>(buffer);
|
const uint8_t *data = static_cast<const uint8_t *>(buffer);
|
||||||
uint32_t p_crc = *crc;
|
uint32_t p_crc = *crc;
|
||||||
|
|
Loading…
Reference in New Issue