MCPcopy Create free account
hub / github.com/SmingHub/Sming / decode

Method decode

Sming/Libraries/nanopb/src/Stream.cpp:17–34  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15namespace Protobuf
16{
17bool InputStream::decode(const pb_msgdesc_t* fields, void* dest_struct)
18{
19 int avail = stream.available();
20 if(avail <= 0) {
21 return false;
22 }
23 pb_istream_t is{};
24 is.callback = [](pb_istream_t* stream, pb_byte_t* buf, size_t count) -> bool {
25 auto self = static_cast<InputStream*>(stream->state);
26 assert(self != nullptr);
27 self->stream.readBytes(reinterpret_cast<char*>(buf), count);
28 return true;
29 };
30 is.state = this;
31 is.bytes_left = size_t(avail);
32 is.errmsg = nullptr;
33 return pb_decode(&is, fields, dest_struct);
34}
35
36size_t OutputStream::encode(const pb_msgdesc_t* fields, const void* src_struct)
37{

Callers 12

receiveIRFunction · 0.45
mainFunction · 0.45
gitcmdFunction · 0.45
scan_fileFunction · 0.45
_as_strFunction · 0.45
parse_lineMethod · 0.45
memanalyzer.pyFile · 0.45
memanalyzer.pyFile · 0.45
get_drivesFunction · 0.45
memanalyzer.pyFile · 0.45
load_keysFunction · 0.45
upload_http_postFunction · 0.45

Calls 2

availableMethod · 0.45
readBytesMethod · 0.45

Tested by 1

mainFunction · 0.36