| 827 | // >>>>>>>> WasmEdge bytes functions >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> |
| 828 | |
| 829 | WASMEDGE_CAPI_EXPORT WasmEdge_Bytes |
| 830 | WasmEdge_BytesCreate(const uint8_t *Buf, const uint32_t Len) noexcept { |
| 831 | try { |
| 832 | if (Buf && Len) { |
| 833 | uint8_t *Str = new uint8_t[Len]; |
| 834 | std::copy_n(Buf, Len, Str); |
| 835 | return WasmEdge_Bytes{/* Length */ Len, /* Buf */ Str}; |
| 836 | } |
| 837 | } catch (...) { |
| 838 | handleCAPIError(); |
| 839 | } |
| 840 | return WasmEdge_Bytes{/* Length */ 0, /* Buf */ nullptr}; |
| 841 | } |
| 842 | |
| 843 | WASMEDGE_CAPI_EXPORT WasmEdge_Bytes |
| 844 | WasmEdge_BytesWrap(const uint8_t *Buf, const uint32_t Len) noexcept { |
nothing calls this directly
no test coverage detected