Esempio n. 1
0
Record::Record(XnUInt8* pData, XnUInt32 nMaxSize) : 
	m_pData(pData),
	m_nMaxSize(nMaxSize),
	m_nReadOffset(0)
{
	XN_ASSERT(m_pData != NULL);
	XN_ASSERT(m_nMaxSize >= HEADER_SIZE);
	SetNodeID(INVALID_NODE_ID);
	SetPayloadSize(0);
	SetUndoRecordPos(0);
}
Esempio n. 2
0
bool OTPayload::SetMessage(const OTMessage & theMessage)
{
	uint32_t lSize = theMessage.m_strRawFile.GetLength()+1; //+1 for the null terminater
	
	if (theMessage.m_strRawFile.GetLength())
	{
		SetPayloadSize(lSize + 1); // +1 for the checksum byte.
		memcpy((void *)GetPointer(), theMessage.m_strRawFile.Get(), lSize);
		
		// Add the checksum
		AppendChecksum( (OT_BYTE*)GetPointer(), lSize );
		return true;
	}
	return false;
}
Esempio n. 3
0
// Envelope copied into payload to prepare for sending.
bool OTPayload::SetEnvelope(const OTEnvelope & theEnvelope)
{
	OTASCIIArmor theArmor;
	
	if (theEnvelope.GetAsciiArmoredData(theArmor))
	{
		uint32_t lSize = theArmor.GetLength()+1; //+1 for the null terminater
		
		if (theArmor.GetLength())
		{
			SetPayloadSize(lSize + 1); // +1 for the checksum byte.
			
			// Copy it in.
			memcpy((void *)GetPointer(), theArmor.Get(), lSize);
			
			// Add the checksum, success.
			AppendChecksum( (OT_BYTE*)GetPointer(), lSize );
			return true;
		}
	}
	return false;
}