本文整理汇总了C++中DataBuffer::SkipToExactSize方法的典型用法代码示例。如果您正苦于以下问题:C++ DataBuffer::SkipToExactSize方法的具体用法?C++ DataBuffer::SkipToExactSize怎么用?C++ DataBuffer::SkipToExactSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBuffer
的用法示例。
在下文中一共展示了DataBuffer::SkipToExactSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IfFailGo
// --------------------------------------------------------------------------------------
//
// Gets next hot heap (*pHotHeap, of index *pHotHeapIndex) from the heaps directory.
// Returns S_OK and fills *pHotHeap and *pHotHeapIndex with the next code:HotHeap information.
// Returns S_FALSE, if the last hot heap was already returned. Clears *pHotHeap and *pHotHeapIndex in this
// case.
// Returns error code if the format is invalid. Clears *pHotHeap and *pHotHeapIndex in this case.
//
__checkReturn
HRESULT
HotHeapsDirectoryIterator::GetNext(
HotHeap *pHotHeap,
HeapIndex *pHotHeapIndex)
{
HRESULT hr;
DataBuffer hotHeapHeaderData;
DataBuffer hotHeapData;
struct HotHeapsDirectoryEntry *pEntry;
if (!m_RemainingHeapsDirectoryData.GetData<struct HotHeapsDirectoryEntry>(
&pEntry))
{
hr = S_FALSE;
goto ErrExit;
}
if (!HeapIndex::IsValid(pEntry->m_nHeapIndex))
{
Debug_ReportError("Invalid hot heaps directory format - invalid heap index.");
IfFailGo(METADATA_E_INVALID_FORMAT);
}
pHotHeapIndex->Set(pEntry->m_nHeapIndex);
hotHeapHeaderData = m_HotHeapsData;
if (!hotHeapHeaderData.SkipToExactSize(pEntry->m_nHeapHeaderStart_NegativeOffset))
{
Debug_ReportError("Invalid hot heaps directory format - heap header offset reaches in front of of hot heaps data.");
IfFailGo(METADATA_E_INVALID_FORMAT);
}
struct HotHeapHeader *pHeader;
if (!hotHeapHeaderData.PeekData<struct HotHeapHeader>(&pHeader))
{
Debug_ReportError("Invalid hot heaps directory format - heap header reaches behind hot heaps data.");
IfFailGo(METADATA_E_INVALID_FORMAT);
}
hotHeapData = m_HotHeapsData;
if (!hotHeapData.TruncateBySize(pEntry->m_nHeapHeaderStart_NegativeOffset))
{
Debug_ReportInternalError("There's a bug because previous call to SkipToExactSize succeeded.");
IfFailGo(METADATA_E_INVALID_FORMAT);
}
IfFailGo(pHotHeap->Initialize(pHeader, hotHeapData));
_ASSERTE(hr == S_OK);
return hr;
ErrExit:
pHotHeap->Clear();
pHotHeapIndex->SetInvalid();
return hr;
} // HotHeapsDirectoryIterator::GetNext