Azure IoT common library
Dependents: STM32F746_iothub_client_sample_mqtt f767zi_mqtt iothub_client_sample_amqp iothub_client_sample_http ... more
Diff: buffer.c
- Revision:
- 30:ce3813c5a692
- Parent:
- 27:8656a313842b
- Child:
- 48:81866008bba4
diff -r e3ed192c35fb -r ce3813c5a692 buffer.c --- a/buffer.c Fri Jun 30 10:42:00 2017 -0700 +++ b/buffer.c Fri Jul 14 16:38:40 2017 -0700 @@ -541,6 +541,29 @@ return result; } +int BUFFER_fill(BUFFER_HANDLE handle, unsigned char fill_char) +{ + int result; + if (handle == NULL) + { + /* Codes_SRS_BUFFER_07_002: [ If handle is NULL BUFFER_fill shall return a non-zero value. ] */ + LogError("Invalid parameter specified, handle == NULL."); + result = __FAILURE__; + } + else + { + size_t index; + /* Codes_SRS_BUFFER_07_001: [ BUFFER_fill shall fill the supplied BUFFER_HANDLE with the supplied fill character. ] */ + BUFFER* buffer_data = (BUFFER*)handle; + for (index = 0; index < buffer_data->size; index++) + { + buffer_data->buffer[index] = fill_char; + } + result = 0; + } + return result; +} + /* Codes_SRS_BUFFER_07_025: [BUFFER_u_char shall return a pointer to the underlying unsigned char*.] */ unsigned char* BUFFER_u_char(BUFFER_HANDLE handle)