MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / WasmEdge_Bytes WasmEdge_BytesCreate

Function WasmEdge_Bytes WasmEdge_BytesCreate

lib/api/wasmedge.cpp:829–841  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827// >>>>>>>> WasmEdge bytes functions >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
828
829WASMEDGE_CAPI_EXPORT WasmEdge_Bytes
830WasmEdge_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
843WASMEDGE_CAPI_EXPORT WasmEdge_Bytes
844WasmEdge_BytesWrap(const uint8_t *Buf, const uint32_t Len) noexcept {

Callers

nothing calls this directly

Calls 1

handleCAPIErrorFunction · 0.85

Tested by

no test coverage detected