本文整理汇总了C++中iDynamicBuffer类的典型用法代码示例。如果您正苦于以下问题:C++ iDynamicBuffer类的具体用法?C++ iDynamicBuffer怎么用?C++ iDynamicBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iDynamicBuffer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: Serialize
void iMystPoundCtlCnst::Serialize(iDynamicBuffer& buff)
{
iCtlCnst::Serialize(buff);
// Last week production
buff.Write((sint8)m_mt);
buff.Write((sint8)m_cnt);
}
开发者ID:iamale,项目名称:palm-heroes,代码行数:7,代码来源:CastleCnsts.cpp
示例2: Decompress
uint32 Decompress(const unsigned char* lzoBuff, uint32 lzoBuffLen, iDynamicBuffer& rawBuff)
{
uint16 hdr;
memcpy(&hdr, lzoBuff, sizeof(uint16));
lzoBuffLen -= sizeof(uint16);
lzoBuff += sizeof(uint16);
if (hdr != LZO_BLOCK_HDR) {
check(0);
return 0;
}
unsigned long raw_buf_len;
memcpy(&raw_buf_len, lzoBuff, sizeof(unsigned long));
lzoBuffLen -= sizeof(uint32);
lzoBuff += sizeof(uint32);
if (raw_buf_len <= 0 || raw_buf_len > LZO_MAX_BUF_LEN) {
check(0);
return 0;
}
rawBuff.ReInit(raw_buf_len);
rawBuff.IncSize( raw_buf_len );
int res = lzo1x_decompress(lzoBuff,lzoBuffLen,(unsigned char*)rawBuff.GetData(),&raw_buf_len,NULL);
if (res != LZO_E_OK) {
check(0);
return 0;
}
return raw_buf_len;
}
开发者ID:iamale,项目名称:palm-heroes,代码行数:29,代码来源:lzo.cpp
示例3: Unserialize
void iPermFSKModCtlCnst::Unserialize(iDynamicBuffer& buff)
{
iCtlCnst::Unserialize(buff);
// Visitors
uint16 viscnt; buff.Read(viscnt);
visitors.RemoveAll();
while (viscnt--) { uint16 visitor; buff.Read(visitor); visitors.Add(visitor); }
}
开发者ID:iamale,项目名称:palm-heroes,代码行数:8,代码来源:CastleCnsts.cpp
示例4: Compress
uint32 Compress(const unsigned char* rawBuff, uint32 rawBuffLen, iDynamicBuffer& lzoBuff)
{
check(rawBuffLen > 0 && rawBuffLen <= LZO_MAX_BUF_LEN);
unsigned long out_len = (rawBuffLen + rawBuffLen / 16 + 64 + 3);
unsigned char* buff = new unsigned char[out_len];
// compress from `in' to `out' with LZO1X-1
int res = lzo1x_1_compress(rawBuff,rawBuffLen,buff,&out_len,wrkmem);
if (res != LZO_E_OK) {
// this should NEVER happen
delete[] buff;
check(0);
return 0;
}
lzoBuff.Write(LZO_BLOCK_HDR);
lzoBuff.Write(rawBuffLen);
lzoBuff.Write(buff, out_len);
delete[] buff;
return lzoBuff.GetSize();
}
开发者ID:iamale,项目名称:palm-heroes,代码行数:21,代码来源:lzo.cpp
示例5:
bool iMemoryDib::Byte2Bit(const iDynamicBuffer& in_buff, iDynamicBuffer& out_buff)
{
check(in_buff.GetSize());
uint32 nsiz = in_buff.GetSize()/8 + ((in_buff.GetSize()%8==0)?0:1);
out_buff.ReInit(nsiz);
for (uint32 xx=0; xx<nsiz; ++xx){
uint32 cnt=0;
uint8 data=0;
uint8 odata=0;
while (cnt<8 && in_buff.Read(data)) {
odata |= (data?1<<cnt:0);
cnt++;
}
out_buff.Write(odata);
}
out_buff.Seek(0);
return true;
}
开发者ID:Reynmar,项目名称:pocketheroes,代码行数:18,代码来源:xe.dib.mem.cpp
注:本文中的iDynamicBuffer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论