Пример #1
0
 void assign(const void* ptr, size_t size) {
   if (buf_.unique()) {
     const char* const first = static_cast<const char*>(ptr);
     buf_->assign(first, first + size);
   } else {
     byte_buffer(ptr, size).swap(*this);
   }
 }
Пример #2
0
CVertexBufferObject::CVertexBufferObject(bool isStatic, int numVertices, const std::vector<CVertexAttribute>& attributes) :
	m_bufferHandle(0),
	m_tmpHandle(0),
	m_isDirect(true),
	m_usage(0),
	m_isDirty(false),
	m_attributes(attributes),
	m_isBound(false),
	m_isStatic(isStatic)
{
	m_byteBuffer = byte_buffer(m_attributes.vertexSize * numVertices);
    m_buffer = m_byteBuffer.convert<float>();
    m_byteBuffer.flip();
    m_buffer.flip();
    m_bufferHandle = CreateBufferObject();
    m_usage = isStatic ? GL_STATIC_DRAW : GL_DYNAMIC_DRAW;
}
Пример #3
0
bool P2PProxySession::ParseCommand(const char *data, uint16 len,
                                           uint32 *p2p_system_command_type,
                                           uint32 *server_socket,
                                           uint32 *client_socket,
                                           uint32 *client_connection_ip,
                                           uint16 *client_connection_port)
{
  if(len != P2PRTSPCOMMAND_LENGTH){
    LOG(LS_ERROR) << "\t The length of data is not expected length";
    return false;
  }
  talk_base::ByteBuffer byte_buffer(data,len);

  uint32 p2p_system_command_ide;
  uint16 padding_byte;
  //
  byte_buffer.ReadUInt32(&p2p_system_command_ide);
  if(p2p_system_command_ide != P2P_SYSTEM_COMMAND_IDE){
      LOG(LS_ERROR) << "\t The P2P P2P_SYSTEM_COMMAND_IDE error " 
        << p2p_system_command_ide;
      return false;
  }

  byte_buffer.ReadUInt32(p2p_system_command_type);
  byte_buffer.ReadUInt32(server_socket);
  byte_buffer.ReadUInt32(client_socket);
  byte_buffer.ReadUInt32(client_connection_ip);
  byte_buffer.ReadUInt16(client_connection_port);
  byte_buffer.ReadUInt16(&padding_byte);
  if(padding_byte != P2P_SYSTEM_COMMAND_PADDING_BYTE)
  {
    LOG(LS_ERROR) << "the padding_byte is error";
    return false;
  }
  return true;
}
 byte_buffer get_model() {
   return byte_buffer();
 }
Пример #5
0
 pair<uint64_t, byte_buffer> get_model() {
   return make_pair(1, byte_buffer());
 }