本文整理汇总了C++中MemoryBuffer::bufferBase方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBuffer::bufferBase方法的具体用法?C++ MemoryBuffer::bufferBase怎么用?C++ MemoryBuffer::bufferBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBuffer
的用法示例。
在下文中一共展示了MemoryBuffer::bufferBase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unpack
void CJHTreeNode::unpack(const void *node, bool needCopy)
{
memcpy(&hdr, node, sizeof(hdr));
SwapBigEndian(hdr);
__int64 maxsib = keyHdr->getHdrStruct()->phyrec;
if (!hdr.isValid(keyHdr->getNodeSize()))
{
PROGLOG("hdr.leafFlag=%d",(int)hdr.leafFlag);
PROGLOG("hdr.rightSib=%" I64F "d",hdr.rightSib);
PROGLOG("hdr.leftSib=%" I64F "d",hdr.leftSib);
PROGLOG("maxsib=%" I64F "d",maxsib);
PROGLOG("nodeSize=%d", keyHdr->getNodeSize());
PROGLOG("keyBytes=%d",(int)hdr.keyBytes);
PrintStackReport();
throw MakeStringException(0, "Htree: Corrupt key node detected");
}
if (!hdr.leafFlag)
keyLen = keyHdr->getNodeKeyLength();
keyRecLen = keyLen + sizeof(offset_t);
char *keys = ((char *) node) + sizeof(hdr);
if (hdr.crc32)
{
unsigned crc = crc32(keys, hdr.keyBytes, 0);
if (hdr.crc32 != crc)
throw MakeStringException(0, "CRC error on key node");
}
if (hdr.leafFlag==1)
{
firstSequence = *(unsigned __int64 *) keys;
keys += sizeof(unsigned __int64);
_WINREV(firstSequence);
}
if(isMetadata())
{
unsigned short len = *reinterpret_cast<unsigned short *>(keys);
_WINREV(len);
expandedSize = len;
keyBuf = (char *) allocMem(len);
memcpy(keyBuf, keys+sizeof(unsigned short), len);
}
else if (isLeaf() && (keyType & HTREE_COMPRESSED_KEY))
{
{
MTIME_SECTION(queryActiveTimer(), "Compressed node expand");
expandedSize = keyHdr->getNodeSize();
bool quick = (keyType&HTREE_QUICK_COMPRESSED_KEY)==HTREE_QUICK_COMPRESSED_KEY;
#ifndef _OLD_VERSION
keyBuf = NULL;
if (quick)
rowexp.setown(expandQuickKeys(keys, needCopy));
if (!quick||!rowexp.get())
#endif
{
keyBuf = expandKeys(keys,keyLen,expandedSize,quick);
}
}
assertex(keyBuf||rowexp.get());
}
else
{
int i;
if (keyType & COL_PREFIX)
{
MTIME_SECTION(queryActiveTimer(), "COL_PREFIX expand");
if (hdr.numKeys) {
bool handleVariable = isVariable && isLeaf();
KEYRECSIZE_T workRecLen;
MemoryBuffer keyBufMb;
const char *source = keys;
char *target;
// do first row
if (handleVariable) {
memcpy(&workRecLen, source, sizeof(workRecLen));
_WINREV(workRecLen);
size32_t tmpSz = sizeof(workRecLen) + sizeof(offset_t);
target = (char *)keyBufMb.reserve(tmpSz+workRecLen);
memcpy(target, source, tmpSz);
source += tmpSz;
target += tmpSz;
}
else {
target = (char *)keyBufMb.reserveTruncate(hdr.numKeys * keyRecLen);
workRecLen = keyRecLen - sizeof(offset_t);
memcpy(target, source, sizeof(offset_t));
source += sizeof(offset_t);
target += sizeof(offset_t);
}
// this is where next row gets data from
const char *prev, *next = NULL;
unsigned prevOffset = 0;
if (handleVariable)
prevOffset = target-((char *)keyBufMb.bufferBase());
else
next = target;
unsigned char pack1 = *source++;
#ifdef _DEBUG
assertex(0==pack1); // 1st time will be always be 0
//.........这里部分代码省略.........