• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ GetBufferSize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetBufferSize函数的典型用法代码示例。如果您正苦于以下问题:C++ GetBufferSize函数的具体用法?C++ GetBufferSize怎么用?C++ GetBufferSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetBufferSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:tonymailxx,项目名称:rcsgrep,代码行数:33,代码来源:AxString.cpp


示例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();
}
开发者ID:dirkschulze,项目名称:gecko-dev,代码行数:26,代码来源:TextureHost.cpp


示例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;
	}
}
开发者ID:EomJaeWoong,项目名称:TCPFighter,代码行数:18,代码来源:StreamQueue.cpp


示例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;
    }
}
开发者ID:ssone95,项目名称:AMXModX-Dark-Edition,代码行数:50,代码来源:amxxfile.cpp


示例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();
    }
  }
}
开发者ID:dirkschulze,项目名称:gecko-dev,代码行数:15,代码来源:TextureHost.cpp


示例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);
	}
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:26,代码来源:SlateRHIRenderingPolicy.cpp


示例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);

}
开发者ID:mayhem,项目名称:freeamp,代码行数:34,代码来源:eventbuffer.cpp


示例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);
}
开发者ID:davidxue1989,项目名称:FrequencyAnalyzer,代码行数:20,代码来源:circ_buff.c


示例9: ClearBuffer

/////////////////////////////////////////////////////////////////////////
// 버퍼의 모든 데이타 삭제.
//
// Parameters: 없음.
// Return: 없음.
/////////////////////////////////////////////////////////////////////////
void CAyaStreamSQ::ClearBuffer(void)
{
	for (int iCnt = 0; iCnt < GetBufferSize(); iCnt++)
	{
		m_chpBuffer[iCnt] = 0;
	}
}
开发者ID:EomJaeWoong,项目名称:TCPFighter,代码行数:13,代码来源:StreamQueue.cpp


示例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_();
   }
开发者ID:AimaTeam-hehai,项目名称:hmailserver,代码行数:32,代码来源:SMTPClientConnection.cpp


示例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;
}
开发者ID:John-He-928,项目名称:krkrz,代码行数:13,代码来源:BufferRenderer.cpp


示例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;
}
开发者ID:henrryhe,项目名称:beijing-7101,代码行数:34,代码来源:thread.c


示例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;
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:31,代码来源:CoreAudioDevice.cpp


示例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();
   }
开发者ID:jrallo,项目名称:hMailServer,代码行数:28,代码来源:SMTPClientConnection.cpp


示例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;
    }
开发者ID:Archer-sys,项目名称:Windows-Driver-Frameworks,代码行数:25,代码来源:ifxmemory.hpp


示例16: GetBufferSize

void PacketBuffer::ReArrange()
{
    const uint16 bufferSize = GetBufferSize();
    MoveMemory(buffer.data(), GetBuffer(), bufferSize);
    readPos = 0;
    writePos = bufferSize;
}
开发者ID:Hmelong,项目名称:ServerStudy,代码行数:7,代码来源:PacketBuffer.cpp


示例17: UDPOpen

/***	void UdpServer::resumeListening(void)
**
**	Synopsis:   
**      Resumes listening on a UdpServer that did a StopListening
**
**	Parameters:
**      None
**
**	Return Values:
**      None
**
**	Errors:
**      None
**
**  Notes:
**
**      If StartListening was never called, this does nothing
**      If it is already listening, it does nothing
*/
void UdpServer::resumeListening(void)
{
    if(!_fStarted)
    {
        return;
    }

    // say we want to listen, may fail, but we will pick it up when we can.
    _fListening = true;

    // make sure we have room to to put our handle in
    if(_cPending >= _cPendingMax)
    {
        return;
    }

    // if we need to start listening on a socket
    if(_rghUDP[_cPending] >= INVALID_UDP_SOCKET)
    {
        // do not need to check to see if Ethernet is initialized because I can assign sockets before then
        _rghUDP[_cPending] = UDPOpen(_localPort, NULL, 0); 
    
        if(_rghUDP[_cPending] < INVALID_UDP_SOCKET)
        {
            // As for the iBuff, when we get data on the socket, the last entry 
            // will be where we put pending Client so just use this iBuff as the cache buffer
            ExchangeCacheBuffer(_rghUDP[_cPending], GetBufferLocation(_cPending), GetBufferSize());
        }
    }
}
开发者ID:alaneve,项目名称:SeniorDesign,代码行数:49,代码来源:UdpServer.cpp


示例18: sizeof

bool CCoreAudioDevice::SetBufferSize(UInt32 size)
{
  if (!m_DeviceId)
    return false;

  AudioObjectPropertyAddress  propertyAddress;
  propertyAddress.mScope    = kAudioDevicePropertyScopeOutput;
  propertyAddress.mElement  = 0;
  propertyAddress.mSelector = kAudioDevicePropertyBufferFrameSize;

  UInt32 propertySize = sizeof(size);
  OSStatus ret = AudioObjectSetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, propertySize, &size);
  if (ret != noErr)
  {
    CLog::Log(LOGERROR, "CCoreAudioDevice::SetBufferSize: "
      "Unable to set buffer size. Error = %s", GetError(ret).c_str());
  }

  if (GetBufferSize() != size)
    CLog::Log(LOGERROR, "CCoreAudioDevice::SetBufferSize: Buffer size change not applied.");
  else
    CLog::Log(LOGDEBUG, "CCoreAudioDevice::SetBufferSize: Set buffer size to %d", (int)size);

  return (ret == noErr);
}
开发者ID:manio,项目名称:xbmc,代码行数:25,代码来源:CoreAudioDevice.cpp


示例19: GetBufferSize

bool CCoreAudioDevice::Open(AudioDeviceID deviceId)
{
  m_DeviceId = deviceId;
  m_BufferSizeRestore = GetBufferSize();
  CLog::Log(LOGDEBUG, "CCoreAudioDevice::Open: Opened device 0x%04x", (uint)m_DeviceId);
  return true;
}
开发者ID:manio,项目名称:xbmc,代码行数:7,代码来源:CoreAudioDevice.cpp


示例20: WriteSound

/**
 * Send a sound clip to the audio subsystem.
 */
void WriteSound(int32 *buf, int Count) 
{
    //extern int EmulationPaused;

    SDL_LockAudio();

    /*if (EmulationPaused == 0)*/ { // for some reason EmulationPaused is always 1, ignore it
        while(Count) {
            if(s_BufferIn == s_BufferSize) goto _exit;

            s_Buffer[s_BufferWrite] = *buf;
            Count--;
            s_BufferWrite = (s_BufferWrite + 1) % s_BufferSize;
            
            s_BufferIn++;
            
            buf++;
        }
    }
_exit:
    SDL_UnlockAudio();

    // If we have too much audio, wait a bit before accepting more.
    // This keeps the lag in check.
    while (GetBufferedSound() > 3 * GetBufferSize())
        usleep(1000);
}
开发者ID:Nebuleon,项目名称:fceu320-rzx50,代码行数:30,代码来源:dingoo-sound.cpp



注:本文中的GetBufferSize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetBytes函数代码示例发布时间:2022-05-30
下一篇:
C++ GetBuffer函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap