This is all the code for the backing store for BMessage (BMessageBody &

BMessageField) for the "template madness" version.  Also included is
BDataBuffer which is a little reference counting raw data container.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2955 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
ejakowatz
2003-03-19 07:58:17 +00:00
parent 8eb9c15d4f
commit b1055b4c2d
10 changed files with 1725 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
//------------------------------------------------------------------------------
// MessageUtils.cpp
//
//------------------------------------------------------------------------------
// Standard Includes -----------------------------------------------------------
// System Includes -------------------------------------------------------------
// Project Includes ------------------------------------------------------------
#include <MessageUtils.h>
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
// Globals ---------------------------------------------------------------------
//------------------------------------------------------------------------------
uint32 _checksum_(const uchar* buf, int32 size)
{
uint32 sum = 0;
uint32 temp = 0;
while (size > 3) {
#if defined(__INTEL__)
sum += B_SWAP_INT32(*(int*)buf);
#else
sum += *(int*)buf;
#endif
buf += 4;
size -= 4;
}
while (size > 0) {
temp = (temp << 8) + *buf++;
size -= 1;
sum += temp;
}
return sum;
}
//------------------------------------------------------------------------------
int32 TChecksumHelper::CheckSum()
{
return _checksum_(fBuffer, fBufPtr - fBuffer);
}
//------------------------------------------------------------------------------
/*
* $Log $
*
* $Id $
*
*/