MCPcopy Create free account
hub / github.com/PurpleI2P/i2pd / ToBuffer

Method ToBuffer

libi2pd/Identity.cpp:310–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308 }
309
310 size_t IdentityEx::ToBuffer (uint8_t * buf, size_t len) const
311 {
312 const size_t fullLen = GetFullLen();
313 if (fullLen > len) return 0; // buffer is too small and may overflow somewhere else
314 memcpy (buf, &m_StandardIdentity, DEFAULT_IDENTITY_SIZE);
315 if (m_ExtendedLen > 0)
316 {
317 if (m_ExtendedLen > MAX_EXTENDED_BUFFER_SIZE)
318 memcpy (buf + DEFAULT_IDENTITY_SIZE, m_ExtendedBufferPtr, m_ExtendedLen);
319 else
320 memcpy (buf + DEFAULT_IDENTITY_SIZE, m_ExtendedBuffer, m_ExtendedLen);
321 }
322 return fullLen;
323 }
324
325 size_t IdentityEx::FromBase64(std::string_view s)
326 {

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected