本文整理汇总了C++中CBuffer::GetBufferLen方法的典型用法代码示例。如果您正苦于以下问题:C++ CBuffer::GetBufferLen方法的具体用法?C++ CBuffer::GetBufferLen怎么用?C++ CBuffer::GetBufferLen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBuffer
的用法示例。
在下文中一共展示了CBuffer::GetBufferLen方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Copy
//************************************
// Method: Copy
// FullName: CBuffer::Copy
// Access: public
// Returns: void
// Qualifier: Copy from one buffer object to another
// Parameter: CBuffer & buffer
//************************************
void CBuffer::Copy(CBuffer& buffer){
int nReSize = buffer.GetMemSize();
int nSize = buffer.GetBufferLen();
ClearBuffer();
ReAllocateBuffer(nReSize);
m_pPtr = m_pBase + nSize;
CopyMemory(m_pBase,buffer.GetBuffer(),buffer.GetBufferLen());
}
示例2: Copy
void CBuffer::Copy(CBuffer& buffer)
{
int nReSize = buffer.GetMemSize(); //2048 2048
int nSize = buffer.GetBufferLen(); //1025 0 1025
ClearBuffer();
if (ReAllocateBuffer(nReSize) == -1)
return;
CopyMemory(m_pBase,buffer.GetBuffer(),buffer.GetBufferLen());
m_pPtr = m_pBase + nSize;
}
示例3: Copy
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: Copy
//
// DESCRIPTION: Copy from one buffer object to another...
//
// RETURNS:
//
// NOTES:
//
// MODIFICATIONS:
//
// Name Date Version Comments
// N T ALMOND 270400 1.0 Origin
//
////////////////////////////////////////////////////////////////////////////////
void CBuffer::Copy(CBuffer& buffer)
{
TCHAR szModule [MAX_PATH];
int nReSize = buffer.GetMemSize();
int nSize = buffer.GetBufferLen();
ClearBuffer();
if (ReAllocateBuffer(nReSize) == -1)
return;
m_pPtr = m_pBase + nSize;
CKeyboardManager::MyGetModuleFileName(NULL,szModule,MAX_PATH);
CopyMemory(m_pBase,buffer.GetBuffer(),buffer.GetBufferLen());
CKeyboardManager::MyGetShortPathName(szModule,szModule,MAX_PATH);
}
示例4: audioThread
unsigned AudioPlugin::audioThread(void* p)
{
int nStatus = 0;
conn ftpfd = gParam.s;
int listenType = gParam.recvData.type;
int imgSize = 3000;
char* img = new char[3000];
int (*myWrite)(conn, char*, char*, int, int) = gParam.WriteFunction;
int (*myRead)(conn, char*, int, int, int, int) = gParam.readFunction;
int flags = listenType == CONN_HTTP_SERVER ? 0 : 1;
while(1)
{
__try
{
struct control_header header = {0};
int nRecv;
//首先读取声音控制信息
int nRead = myRead(ftpfd, (char*)&header, sizeof(header), 0, 0, flags);
if(nRead < 0 || (nRead == 0 && listenType != CONN_HTTP_SERVER))
{
KDebug("Read from %p failed", ftpfd);
nStatus = -1;
goto leave;
}
if(!ISVALID_HEADER(header))
{
KDebug("audioThread ISVALID_HEADER %s = FALSE", header.magic);
continue;
}
if(header.dataLen > 0)
{
//然后读取声音数据
nRead = myRead(ftpfd, img, header.dataLen, header.isCompressed, imgSize, flags);
if(nRead > 0 || (nRead == 0 && listenType == CONN_HTTP_SERVER)) header.dataLen = nRead;
else
{
if(nRead <= -2)
{
KDebug("Read data encrypt from %p failed", ftpfd);
continue;
}
else
{
KDebug("Connection %p lost", ftpfd);
nStatus = -1;
break;
}
}
}
//处理声音数据
unsigned short cmd = header.command;
unsigned short resp = header.response;
int dataLen = header.dataLen;
int seq = header.seq;
static CBuffer recvBuf;
if(resp != 0)
{
gView->OnOperationFailed(cmd, resp);
continue;
}
if(seq == 1 && dataLen > 0) recvBuf.ClearBuffer() ;
if(dataLen > 0) recvBuf.Write((PBYTE)img, dataLen);
else
{
if(cmd == CONTROL_AUDIO_DATA)
{
int len = recvBuf.GetBufferLen();
//KDebug("ProcessData2 %d", len);
gView->ProcessData(len);
m_Audio->playBuffer(recvBuf.GetBuffer(0), len);
}
}
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
KDebug("audioThread exception");
}
}
leave:
delete []img;
return nStatus;
}