本文整理汇总了C++中GetBufferSize函数的典型用法代码示例。如果您正苦于以下问题:C++ GetBufferSize函数的具体用法?C++ GetBufferSize怎么用?C++ GetBufferSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetBufferSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: strlen
void AxString::Replace(const char *pTarget, const char *pSubs, bool bAll, int iOffset)
{
if (AX_ISZERO(pTarget))
return ;
unsigned int iTargetLen = strlen(pTarget);
unsigned int iSubsLen = AX_ISZERO(pSubs) ? 0 : strlen(pSubs);
if (GetSize() < iTargetLen)
return;
do {
int pos = Find(pTarget, iOffset);
if (AxString::npos == pos)
return ;
// splice
unsigned int iNewLen = GetSize() - iTargetLen + iSubsLen;
if (GetBufferSize() <= iNewLen) {
Resize( GetBufferSize() * 2 );
}
if ((pos+iTargetLen) < GetSize()) {
memmove((void*)(c_str()+pos+iSubsLen), (void*)(c_str()+pos+iTargetLen), GetSize()-pos-iTargetLen+1);
}
memcpy(m_pByteArray+pos, pSubs, iSubsLen);
m_pByteArray[iNewLen] = '\0';
m_iDataLength = iNewLen;
iOffset = pos + iSubsLen;
} while (bAll);
}
示例2: NS_WARNING
TemporaryRef<gfx::DataSourceSurface>
BufferTextureHost::GetAsSurface()
{
RefPtr<gfx::DataSourceSurface> result;
if (mFormat == gfx::SurfaceFormat::UNKNOWN) {
NS_WARNING("BufferTextureHost: unsupported format!");
return nullptr;
} else if (mFormat == gfx::SurfaceFormat::YUV) {
YCbCrImageDataDeserializer yuvDeserializer(GetBuffer(), GetBufferSize());
if (!yuvDeserializer.IsValid()) {
return nullptr;
}
result = yuvDeserializer.ToDataSourceSurface();
if (NS_WARN_IF(!result)) {
return nullptr;
}
} else {
ImageDataDeserializer deserializer(GetBuffer(), GetBufferSize());
if (!deserializer.IsValid()) {
NS_ERROR("Failed to deserialize image!");
return nullptr;
}
result = deserializer.GetAsSurface();
}
return result.forget();
}
示例3: GetBufferSize
/////////////////////////////////////////////////////////////////////////
// 원하는 길이만큼 읽기위치 에서 삭제.
//
// Parameters: 없음.
// Return: 없음.
/////////////////////////////////////////////////////////////////////////
void CAyaStreamSQ::RemoveData(int iSize)
{
if (GetUseSize() < iSize)
return;
else
{
if (m_iReadPos + iSize >= GetBufferSize())
m_iReadPos = (m_iReadPos + iSize) % GetBufferSize();
else
m_iReadPos += iSize;
}
}
示例4: fseek
CAmxxReader::Error CAmxxReader::GetSection(void *buffer)
{
if (!m_pFile)
return m_Status;
if (m_AmxxFile)
{
PluginEntry *pe = &(m_Bh.plugins[m_Entry]);
char *tempBuffer = new char[m_SectionLength + 1];
fseek(m_pFile, pe->offs, SEEK_SET);
DATAREAD((void *)tempBuffer, 1, m_SectionLength);
uLongf destLen = GetBufferSize();
int result = uncompress((Bytef *)buffer, &destLen, (Bytef *)tempBuffer, m_SectionLength);
delete [] tempBuffer;
if (result != Z_OK)
{
AMXXLOG_Log("[AMXX] Zlib error encountered: %d(%d)", result, m_SectionLength);
m_Status = Err_Decompress;
return Err_Decompress;
}
return Err_None;
} else {
// new file type: go to the section table entry
fseek(m_pFile, m_SectionHdrOffset, SEEK_SET);
// go to the offset
TableEntry entry;
DATAREAD(&entry, sizeof(entry), 1);
fseek(m_pFile, entry.offset, SEEK_SET);
uLongf destLen = GetBufferSize();
// read the data to a temporary buffer
char *tempBuffer = new char[m_SectionLength + 1];
//fread(tempBuffer, sizeof(char), m_SectionLength, m_pFile);
DATAREAD((void*)tempBuffer, 1, m_SectionLength);
// decompress
int result = uncompress((Bytef *)buffer, &destLen, (Bytef *)tempBuffer, m_SectionLength);
delete [] tempBuffer;
if (result != Z_OK)
{
AMXXLOG_Log("[AMXX] Zlib error encountered: %d(%d)", result, m_SectionLength);
m_Status = Err_Decompress;
return Err_Decompress;
}
return Err_None;
}
}
示例5: yuvDeserializer
void
BufferTextureHost::InitSize()
{
if (mFormat == gfx::SurfaceFormat::YUV) {
YCbCrImageDataDeserializer yuvDeserializer(GetBuffer(), GetBufferSize());
if (yuvDeserializer.IsValid()) {
mSize = yuvDeserializer.GetYSize();
}
} else if (mFormat != gfx::SurfaceFormat::UNKNOWN) {
ImageDataDeserializer deserializer(GetBuffer(), GetBufferSize());
if (deserializer.IsValid()) {
mSize = deserializer.GetSize();
}
}
}
示例6: check
void FSlateElementIndexBuffer::FillBuffer( const TArray<SlateIndex>& InIndices, bool bShrinkToFit )
{
check( IsInRenderingThread() );
if( InIndices.Num() )
{
uint32 NumIndices = InIndices.Num();
uint32 RequiredBufferSize = NumIndices*sizeof(SlateIndex);
// resize if needed
if( RequiredBufferSize > GetBufferSize() || bShrinkToFit )
{
// Use array resize techniques for the vertex buffer
ResizeBuffer( InIndices.GetAllocatedSize() );
}
BufferUsageSize += RequiredBufferSize;
void* IndicesPtr = RHILockIndexBuffer( IndexBufferRHI, 0, RequiredBufferSize, RLM_WriteOnly );
FMemory::Memcpy( IndicesPtr, InIndices.GetData(), RequiredBufferSize );
RHIUnlockIndexBuffer(IndexBufferRHI);
}
}
示例7: GetReadIndex
Error EventBuffer::BeginRead(void *&pBuffer, size_t iBytesWanted)
{
BufferEvent *pEvent;
int iReadIndex;
size_t iMaxBytes;
pEvent = m_pQueue->Peek();
iReadIndex = GetReadIndex();
if (pEvent && pEvent->iIndex == iReadIndex)
{
return kError_EventPending;
}
if (!pEvent)
{
return PullBuffer::BeginRead(pBuffer, iBytesWanted);
}
if (pEvent->iIndex > iReadIndex)
{
iMaxBytes = pEvent->iIndex - iReadIndex;
}
else
{
iMaxBytes = (GetBufferSize() - iReadIndex) + pEvent->iIndex;
}
if (iBytesWanted >= iMaxBytes)
return kError_EventPending;
else
return PullBuffer::BeginRead(pBuffer, iBytesWanted);
}
示例8: GetBufferEmptySize
//****************************************************************************
//
//! checks how much buffer is Empty.
//!
//! \param pCircularBuffer is a pointer to the control structure for Circular.
//! Buffer.
//!
//! This function
//! 1. Retreives the amount of Buffer Empty.
//!
//! \return the amount of buffer Empty.
//
//****************************************************************************
unsigned int
GetBufferEmptySize(tCircularBuffer *pCircularBuffer)
{
unsigned int uiBufferFilled;
uiBufferFilled = GetBufferSize(pCircularBuffer);
return (pCircularBuffer->ulBufferSize - uiBufferFilled);
}
示例9: ClearBuffer
/////////////////////////////////////////////////////////////////////////
// 버퍼의 모든 데이타 삭제.
//
// Parameters: 없음.
// Return: 없음.
/////////////////////////////////////////////////////////////////////////
void CAyaStreamSQ::ClearBuffer(void)
{
for (int iCnt = 0; iCnt < GetBufferSize(); iCnt++)
{
m_chpBuffer[iCnt] = 0;
}
}
示例10: catch
void
SMTPClientConnection::StartSendFile_(const String &sFilename)
{
try
{
current_file_.Open(sFilename, File::OTReadOnly);
}
catch (...)
{
String sErrorMsg;
sErrorMsg.Format(_T("Could not send file %s via socket since it does not exist."), sFilename.c_str());
ErrorManager::Instance()->ReportError(ErrorManager::High, 5019, "SMTPClientConnection::_SendFileContents", sErrorMsg);
return;
}
transmission_buffer_.Initialize(shared_from_this());
std::shared_ptr<ByteBuffer> pBuf = current_file_.ReadChunk(GetBufferSize());
if (pBuf->GetSize() == 0)
return;
BYTE *pSendBuffer = (BYTE*) pBuf->GetBuffer();
size_t iSendBufferSize = pBuf->GetSize();
// Append the transmission buffer
transmission_buffer_.Append(pSendBuffer, iSendBufferSize);
ReadAndSend_();
}
示例11: cAutoLock
//----------------------------------------------------------------------------
//! @brief バックバッファへのポインタを取得します。
//! @param buff : バックバッファへのポインタを返すためのバッファへのポインタ
//! @param size : バッファのサイズを返す変数へのポインタ
//! @return エラーコード
//----------------------------------------------------------------------------
HRESULT TBufferRenderer::GetBackBuffer( BYTE **buff, long *size )
{
CAutoLock cAutoLock(&m_BufferLock); // クリティカルセクション
*buff = GetBackBuffer();
*size = GetBufferSize();
return S_OK;
}
示例12: sendMessage
static int sendMessage(EMBX_VOID *message)
{
int *typedMessage = (int *) message;
EMBX_UINT size;
int stop;
int portIndex;
EMBX_ERROR err;
/* get the size of the current message */
EMBX(GetBufferSize(message, &size));
/* get the number of the current stop */
stop = typedMessage[0];
assert(stop <= NUM_STOPS);
if (stop == NUM_STOPS) {
return 0;
}
/* determine the port that this message is next due
* to stop at
*/
portIndex = typedMessage[stop + 1];
/* update the current stop index */
typedMessage[0] = stop + 1;
VERBOSE(printf("Sending message to portIndex %d\n", portIndex));
/* finally send the message to the next stop */
err = EMBX_I(SendMessage(outPort[portIndex], message, size));
assert(EMBX_SUCCESS == err || EMBX_INVALID_PORT == err);
return 1;
}
示例13: Stop
void CCoreAudioDevice::Close()
{
if (!m_DeviceId)
return;
// Stop the device if it was started
Stop();
// Unregister the IOProc if we have one
RemoveIOProc();
SetHogStatus(false);
CCoreAudioHardware::SetAutoHogMode(false);
if (m_MixerRestore > -1) // We changed the mixer status
SetMixingSupport((m_MixerRestore ? true : false));
m_MixerRestore = -1;
if (m_SampleRateRestore != 0.0f)
SetNominalSampleRate(m_SampleRateRestore);
if (m_BufferSizeRestore && m_BufferSizeRestore != GetBufferSize())
{
SetBufferSize(m_BufferSizeRestore);
m_BufferSizeRestore = 0;
}
m_IoProc = NULL;
m_DeviceId = 0;
m_ObjectListenerProc = NULL;
}
示例14:
void
SMTPClientConnection::_StartSendFile(const String &sFilename)
{
if (!_currentFile.Open(sFilename, File::OTReadOnly))
{
String sErrorMsg;
sErrorMsg.Format(_T("Could not send file %s via socket since it does not exist."), sFilename);
ErrorManager::Instance()->ReportError(ErrorManager::High, 5019, "SMTPClientConnection::_SendFileContents", sErrorMsg);
return;
}
_transmissionBuffer.Initialize(this);
shared_ptr<ByteBuffer> pBuf = _currentFile.ReadChunk(GetBufferSize());
if (!pBuf)
return;
BYTE *pSendBuffer = (BYTE*) pBuf->GetBuffer();
int iSendBufferSize = pBuf->GetSize();
// Append the transmission buffer
_transmissionBuffer.Append(pSendBuffer, iSendBufferSize);
_ReadAndSend();
}
示例15: ValidateMemoryOffsets
_Must_inspect_result_
NTSTATUS
ValidateMemoryOffsets(
__in_opt PWDFMEMORY_OFFSET Offsets
)
{
NTSTATUS status;
size_t total;
if (Offsets == NULL) {
return STATUS_SUCCESS;
}
status = RtlSizeTAdd(Offsets->BufferLength, Offsets->BufferOffset, &total);
if (!NT_SUCCESS(status)) {
return status;
}
if (total > GetBufferSize()) {
return STATUS_INTEGER_OVERFLOW;
}
return STATUS_SUCCESS;
}