| 9 | }; |
| 10 | |
| 11 | struct CustomBuffer : winrt::implements<CustomBuffer, winrt::Windows::Storage::Streams::IBuffer, IBufferByteAccess> |
| 12 | { |
| 13 | uint8_t* m_buffer; |
| 14 | uint32_t m_length{}; |
| 15 | |
| 16 | CustomBuffer(uint8_t *buffer, uint32_t size) : |
| 17 | m_buffer(buffer), m_length(size) |
| 18 | { |
| 19 | } |
| 20 | |
| 21 | uint32_t Capacity() const |
| 22 | { |
| 23 | return m_length; |
| 24 | } |
| 25 | |
| 26 | uint32_t Length() const |
| 27 | { |
| 28 | return m_length; |
| 29 | } |
| 30 | |
| 31 | void Length(uint32_t value) |
| 32 | { |
| 33 | if (value > m_length) |
| 34 | { |
| 35 | throw winrt::hresult_invalid_argument(); |
| 36 | } |
| 37 | |
| 38 | m_length = value; |
| 39 | } |
| 40 | |
| 41 | HRESULT __stdcall Buffer(uint8_t** value) final |
| 42 | { |
| 43 | *value = m_buffer; |
| 44 | return S_OK; |
| 45 | } |
| 46 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected