Merge pull request #10699 from gpsimenos/iotcore556-fix_buffer_param_type

MbedCRC: make buffers const void *
pull/10776/head
Martin Kojtal 2019-06-09 18:07:51 +01:00 committed by GitHub
commit a1fab9d654
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -146,7 +146,7 @@ public:
* @param crc CRC is the output value * @param crc CRC is the output value
* @return 0 on success, negative error code on failure * @return 0 on success, negative error code on failure
*/ */
int32_t compute(void *buffer, crc_data_size_t size, uint32_t *crc) int32_t compute(const void *buffer, crc_data_size_t size, uint32_t *crc)
{ {
MBED_ASSERT(crc != NULL); MBED_ASSERT(crc != NULL);
int32_t status = 0; int32_t status = 0;
@ -193,14 +193,14 @@ public:
* @note: CRC as output in compute_partial is not final CRC value, call `compute_partial_stop` * @note: CRC as output in compute_partial is not final CRC value, call `compute_partial_stop`
* to get final correct CRC value. * to get final correct CRC value.
*/ */
int32_t compute_partial(void *buffer, crc_data_size_t size, uint32_t *crc) int32_t compute_partial(const void *buffer, crc_data_size_t size, uint32_t *crc)
{ {
int32_t status = 0; int32_t status = 0;
switch (_mode) { switch (_mode) {
#if DEVICE_CRC #if DEVICE_CRC
case HARDWARE: case HARDWARE:
hal_crc_compute_partial((uint8_t *)buffer, size); hal_crc_compute_partial(static_cast<const uint8_t *>(buffer), size);
*crc = 0; *crc = 0;
break; break;
#endif #endif