本文整理汇总了C++中DataBuffer::GetData方法的典型用法代码示例。如果您正苦于以下问题:C++ DataBuffer::GetData方法的具体用法?C++ DataBuffer::GetData怎么用?C++ DataBuffer::GetData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBuffer
的用法示例。
在下文中一共展示了DataBuffer::GetData方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UnescapeString
string BinaryNinja::UnescapeString(const string& s)
{
DataBuffer buffer = DataBuffer::FromEscapedString(s);
return string((const char*)buffer.GetData(), buffer.GetLength());
}
示例2: ReadString
string BinaryReader::ReadString(size_t len)
{
DataBuffer result = Read(len);
return string((const char*)result.GetData(), len);
}
示例3: DisassemblePack
int DidUncompress::DisassemblePack(DC_HEAD* pPack,DataBuffer& buf)
{
if(!pPack)return -1;
DC_HEAD* pHead = (DC_HEAD*)pPack;
DataBuffer t;
if (pPack->m_cTag == DC_TAG && (pPack->m_wAttrib & DC_CPS_MASK) == DC_ZLIB_CPS)
{
ZLIB_HEAD* pZlibHead = (ZLIB_HEAD*)(pPack+1);
if(t.Allocate(pZlibHead->m_dwSourceLen + sizeof(DC_HEAD) == -1))
return -1;
memcpy(t.GetData(),pPack,sizeof(DC_HEAD));
int iDestLen = pZlibHead->m_dwSourceLen;
char* pSrcData = (char*)(pZlibHead+1);
uncompress( (Bytef*)(t.GetData() + sizeof(DC_HEAD)),
(uLongf*)&iDestLen,
(Bytef*)pSrcData,
pPack->m_nLen-sizeof(ZLIB_HEAD));
if(iDestLen != pZlibHead->m_dwSourceLen)
return -1;
pHead = (DC_HEAD*)t.GetData();
pHead->m_nLen = pZlibHead->m_dwSourceLen;
}
if(pPack->m_cType == DCT_DID)
{
DC_DIDHead* pDidHead = (DC_DIDHead*)(pHead+1);
int iDidHeadLen = pDidHead->GetLen();
int len = 0;
if (pPack->m_cTag == DC_TAG && (pPack->m_wAttrib & DC_CPS_MASK) == DC_NOCOMPRESS)
{
len = pHead->m_nLen - iDidHeadLen;
if(buf.Allocate(len)!= -1)
{
memcpy(buf.GetData(),(char*)pDidHead + iDidHeadLen,len);
return 1;
}
else
return -1;
}
if(pPack->m_cTag == DC_TAG && (pPack->m_wAttrib & DC_CPS_MASK) == DC_XMLCID_CPS)
{
int did = pDidHead->GetDid();
//LOG4CXX_INFO(logger_, "did:" << did);
int num = pDidHead->GetRecNum();
//LOG4CXX_INFO(logger_, "did num:" << num);
//pDidHead->
DC_DIDCompress* pDidCompress = (DC_DIDCompress*)((char*)pDidHead + iDidHeadLen);
len = pDidCompress->GetUnComLen();
//LOG4CXX_INFO(logger_, "len:" << len);
int iCompressHeadLen = pDidCompress->GetLen();
int iCompressLen = pHead->m_nLen - iDidHeadLen - iCompressHeadLen;
//LOG4CXX_INFO(logger_, "did icompresslen:" << iCompressLen);
char* pData = (char*)pDidCompress+iCompressHeadLen;
if(!m_mapDidFile.count(did))
return -1;
map<int, TDidInfo>::iterator it = m_mapDidFile.find(did);
if(!it->second.bInitialized)
return -1;
if(pDidHead->m_bFullRec == 1 && !it->second.bFull)
{
CDsCompressApi* puc = CDsCompressApi::CreateCompressObj();
if(!puc) return -1;
if(!puc->Initialize( it->second.pDidStruct,
did,
pDidCompress->m_bCid,
staticDay
)
)
{
CDsCompressApi::DestroyCompressObj(puc);
return -1;
}
if(buf.Allocate(len)!= -1)
{
puc->SetUnCompressOutputBuffer(buf.GetData(),len);
if(puc->UnCompressData(pData,iCompressLen,num) == -1)
return -1;
if(puc->FinishUnCompressedData() != len)
return -1;
TStructForGetBmData* pObj = &m_mapStructForBmData[did];
if(!pObj->pStkIDMapHash->empty())pObj->pStkIDMapHash->clear();
memset(pObj->pFullData,0,pObj->iBufferSize);
pObj->iTotalStk = 0;
int iRecSize = it->second.pDidStruct->mDidInfo.m_dwRRecSize;
char* record = buf.GetData();
for(int i = 0;i < num;i++)
{
unsigned int stk_id = *((unsigned int*)record);
if(!pObj->pStkIDMapHash->count(stk_id))
{
if (pObj->iTotalStk >= pObj->iBufferSize/iRecSize)
//.........这里部分代码省略.........
示例4: TryRead
bool BinaryReader::TryRead(DataBuffer& dest, size_t len)
{
dest.SetSize(len);
return TryRead(dest.GetData(), len);
}