From 82d5893b117d4f930a1ccfba40a8811a56abbe09 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 8 Apr 2015 09:35:37 +0200 Subject: Some more CreateVector => appendAsVector transformations. --- dummyresource/facade.cpp | 2 +- dummyresource/resourcefactory.cpp | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) (limited to 'dummyresource') diff --git a/dummyresource/facade.cpp b/dummyresource/facade.cpp index 949b4c4..4b7cd53 100644 --- a/dummyresource/facade.cpp +++ b/dummyresource/facade.cpp @@ -56,7 +56,7 @@ Async::Job DummyResourceFacade::create(const Akonadi2::Domain::Event &doma flatbuffers::FlatBufferBuilder fbb; //This is the resource buffer type and not the domain type auto type = fbb.CreateString("event"); - auto delta = fbb.CreateVector(entityFbb.GetBufferPointer(), entityFbb.GetSize()); + auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta); Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); mResourceAccess->open(); diff --git a/dummyresource/resourcefactory.cpp b/dummyresource/resourcefactory.cpp index 6e06250..4ecebc0 100644 --- a/dummyresource/resourcefactory.cpp +++ b/dummyresource/resourcefactory.cpp @@ -324,11 +324,8 @@ void findByRemoteId(QSharedPointer storage, const QString &ri void DummyResource::enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data) { m_fbb.Clear(); - auto commandData = m_fbb.CreateVector(reinterpret_cast(data.data()), data.size()); - auto builder = Akonadi2::QueuedCommandBuilder(m_fbb); - builder.add_commandId(commandId); - builder.add_command(commandData); - auto buffer = builder.Finish(); + auto commandData = Akonadi2::EntityBuffer::appendAsVector(m_fbb, data.constData(), data.size()); + auto buffer = Akonadi2::CreateQueuedCommand(m_fbb, commandId, commandData); Akonadi2::FinishQueuedCommandBuffer(m_fbb, buffer); mq.enqueue(m_fbb.GetBufferPointer(), m_fbb.GetSize()); } @@ -356,7 +353,7 @@ Async::Job DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeli auto rid = m_fbb.CreateString(it.key().toStdString().c_str()); auto description = m_fbb.CreateString(it.key().toStdString().c_str()); static uint8_t rawData[100]; - auto attachment = m_fbb.CreateVector(rawData, 100); + auto attachment = Akonadi2::EntityBuffer::appendAsVector(m_fbb, rawData, 100); auto builder = DummyCalendar::DummyEventBuilder(m_fbb); builder.add_summary(summary); @@ -371,7 +368,7 @@ Async::Job DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeli flatbuffers::FlatBufferBuilder fbb; //This is the resource type and not the domain type auto type = fbb.CreateString("event"); - auto delta = fbb.CreateVector(entityFbb.GetBufferPointer(), entityFbb.GetSize()); + auto delta = Akonadi2::EntityBuffer::appendAsVector(m_fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize()); auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta); Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); -- cgit v1.2.3