MCPcopy Create free account
hub / github.com/apache/brpc / Load

Method Load

src/brpc/policy/rtmp_protocol.cpp:336–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336void KeyBlock::Load(const void* buf) {
337 // Layout of key (764 bytes)
338 // random-data: `offset' bytes
339 // key-data: 128 bytes
340 // random-data: 764 - `offset' - 128 - 4 bytes
341 // offset: 4 bytes
342 _offset_data = ReadBigEndian4Bytes((const char*)buf + SIZE - 4);
343 const uint8_t* p = (const uint8_t*)&_offset_data;
344 _offset = ((uint32_t)p[0] + p[1] + p[2] + p[3]) % (SIZE - KEY_SIZE - 4);
345 memcpy(_buf, buf, SIZE - 4);
346}
347
348void KeyBlock::Save(void* buf) const {
349 memcpy(buf, _buf, SIZE - 4);

Callers 2

WaitForS0S1Method · 0.45

Calls 2

ReadBigEndian4BytesFunction · 0.85
digestMethod · 0.80

Tested by

no test coverage detected