summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-08 09:35:37 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-08 09:35:37 +0200
commit82d5893b117d4f930a1ccfba40a8811a56abbe09 (patch)
treee88098f5af7cd96ca6136421d5f2f84f78c8b9bd
parent9c7fcfacbba250d8776e520c92b2c33e43bc87ef (diff)
downloadsink-82d5893b117d4f930a1ccfba40a8811a56abbe09.tar.gz
sink-82d5893b117d4f930a1ccfba40a8811a56abbe09.zip
Some more CreateVector => appendAsVector transformations.
-rw-r--r--dummyresource/facade.cpp2
-rw-r--r--dummyresource/resourcefactory.cpp11
2 files changed, 5 insertions, 8 deletions
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<void> DummyResourceFacade::create(const Akonadi2::Domain::Event &doma
56 flatbuffers::FlatBufferBuilder fbb; 56 flatbuffers::FlatBufferBuilder fbb;
57 //This is the resource buffer type and not the domain type 57 //This is the resource buffer type and not the domain type
58 auto type = fbb.CreateString("event"); 58 auto type = fbb.CreateString("event");
59 auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); 59 auto delta = Akonadi2::EntityBuffer::appendAsVector(fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize());
60 auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta); 60 auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta);
61 Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); 61 Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location);
62 mResourceAccess->open(); 62 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<Akonadi2::Storage> storage, const QString &ri
324void DummyResource::enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data) 324void DummyResource::enqueueCommand(MessageQueue &mq, int commandId, const QByteArray &data)
325{ 325{
326 m_fbb.Clear(); 326 m_fbb.Clear();
327 auto commandData = m_fbb.CreateVector(reinterpret_cast<uint8_t const *>(data.data()), data.size()); 327 auto commandData = Akonadi2::EntityBuffer::appendAsVector(m_fbb, data.constData(), data.size());
328 auto builder = Akonadi2::QueuedCommandBuilder(m_fbb); 328 auto buffer = Akonadi2::CreateQueuedCommand(m_fbb, commandId, commandData);
329 builder.add_commandId(commandId);
330 builder.add_command(commandData);
331 auto buffer = builder.Finish();
332 Akonadi2::FinishQueuedCommandBuffer(m_fbb, buffer); 329 Akonadi2::FinishQueuedCommandBuffer(m_fbb, buffer);
333 mq.enqueue(m_fbb.GetBufferPointer(), m_fbb.GetSize()); 330 mq.enqueue(m_fbb.GetBufferPointer(), m_fbb.GetSize());
334} 331}
@@ -356,7 +353,7 @@ Async::Job<void> DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeli
356 auto rid = m_fbb.CreateString(it.key().toStdString().c_str()); 353 auto rid = m_fbb.CreateString(it.key().toStdString().c_str());
357 auto description = m_fbb.CreateString(it.key().toStdString().c_str()); 354 auto description = m_fbb.CreateString(it.key().toStdString().c_str());
358 static uint8_t rawData[100]; 355 static uint8_t rawData[100];
359 auto attachment = m_fbb.CreateVector(rawData, 100); 356 auto attachment = Akonadi2::EntityBuffer::appendAsVector(m_fbb, rawData, 100);
360 357
361 auto builder = DummyCalendar::DummyEventBuilder(m_fbb); 358 auto builder = DummyCalendar::DummyEventBuilder(m_fbb);
362 builder.add_summary(summary); 359 builder.add_summary(summary);
@@ -371,7 +368,7 @@ Async::Job<void> DummyResource::synchronizeWithSource(Akonadi2::Pipeline *pipeli
371 flatbuffers::FlatBufferBuilder fbb; 368 flatbuffers::FlatBufferBuilder fbb;
372 //This is the resource type and not the domain type 369 //This is the resource type and not the domain type
373 auto type = fbb.CreateString("event"); 370 auto type = fbb.CreateString("event");
374 auto delta = fbb.CreateVector<uint8_t>(entityFbb.GetBufferPointer(), entityFbb.GetSize()); 371 auto delta = Akonadi2::EntityBuffer::appendAsVector(m_fbb, entityFbb.GetBufferPointer(), entityFbb.GetSize());
375 auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta); 372 auto location = Akonadi2::Commands::CreateCreateEntity(fbb, type, delta);
376 Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location); 373 Akonadi2::Commands::FinishCreateEntityBuffer(fbb, location);
377 374