SwadicalRag / wasm2lua

wasm2lua: converting WASM into Lua
MIT License
190 stars 10 forks source link

Implement passing output buffers to c++ via webidl #22

Closed SwadicalRag closed 5 years ago

SwadicalRag commented 5 years ago
namespace global {
    BrotliDecoderResult BrotliDecoderDecompress ([StringLength="encBuf",Unsigned] any encoded_size, [String="encBuf"] any encoded_buffer, [OutputBufferLengthRef="decBuf"] any decoded_size, [OutputBuffer="decBuf",Unsigned] any decoded_buffer);
};

decoded_size becomes size_t * and can be overwritten by the called code, decoded_buffer becomes unsigned char * because [Unsigned] is also present.

OutputBufferLength converts to size_t (read only).

decoded_size becomes a maxlen internally, and encoded_buffer should be a OutputBuffer (created by vm.NewOutputBuffer(maxlen).

SwadicalRag commented 5 years ago

Obsolete due to #14