From 9b744da32e64d8a6cd342faba8fc3232884d60f2 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Sat, 24 Jan 2015 23:38:12 +0100 Subject: Uid index + query using that index. ...and a couple of other fixes. --- common/CMakeLists.txt | 1 + common/clientapi.h | 2 +- common/commands/modifyentity.fbs | 4 ++-- common/entitybuffer.cpp | 1 - common/resourceaccess.cpp | 2 ++ common/storage_lmdb.cpp | 5 +++++ 6 files changed, 11 insertions(+), 4 deletions(-) (limited to 'common') diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 6f8fee3..3d3a2b7 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -32,6 +32,7 @@ set(command_SRCS storage_common.cpp threadboundary.cpp messagequeue.cpp + index.cpp ${storage_SRCS}) add_library(${PROJECT_NAME} SHARED ${command_SRCS}) diff --git a/common/clientapi.h b/common/clientapi.h index 546f210..659ae91 100644 --- a/common/clientapi.h +++ b/common/clientapi.h @@ -228,7 +228,7 @@ public: } virtual QVariant getProperty(const QString &key) const { return mAdaptor->getProperty(key); } - virtual void setProperty(const QString &key, const QVariant &value){ mChangeSet.insert(key, value); } + virtual void setProperty(const QString &key, const QVariant &value){ mChangeSet.insert(key, value); mAdaptor->setProperty(key, value); } private: QSharedPointer mAdaptor; diff --git a/common/commands/modifyentity.fbs b/common/commands/modifyentity.fbs index b4edb12..d26051e 100644 --- a/common/commands/modifyentity.fbs +++ b/common/commands/modifyentity.fbs @@ -3,9 +3,9 @@ namespace Akonadi2; table ModifyEntity { revision: ulong; entityId: string; - deletions: [string]; + deletions: [string]; //A list of deleted properties domainType: string; - delta: [ubyte]; + delta: [ubyte]; //Contains an entity buffer with all changed properties set } root_type ModifyEntity; diff --git a/common/entitybuffer.cpp b/common/entitybuffer.cpp index 4af84ef..5ba4afe 100644 --- a/common/entitybuffer.cpp +++ b/common/entitybuffer.cpp @@ -58,7 +58,6 @@ void EntityBuffer::extractResourceBuffer(void *dataValue, int dataSize, const st void EntityBuffer::assembleEntityBuffer(flatbuffers::FlatBufferBuilder &fbb, void const *metadataData, size_t metadataSize, void const *resourceData, size_t resourceSize, void const *localData, size_t localSize) { - qDebug() << "res size: " << resourceSize; auto metadata = fbb.CreateVector(static_cast(metadataData), metadataSize); auto resource = fbb.CreateVector(static_cast(resourceData), resourceSize); auto local = fbb.CreateVector(static_cast(localData), localSize); diff --git a/common/resourceaccess.cpp b/common/resourceaccess.cpp index 5f04db8..73a01ca 100644 --- a/common/resourceaccess.cpp +++ b/common/resourceaccess.cpp @@ -298,6 +298,7 @@ bool ResourceAccess::processMessageBuffer() { static const int headerSize = Commands::headerSize(); if (d->partialMessageBuffer.size() < headerSize) { + qWarning() << "command too small"; return false; } @@ -306,6 +307,7 @@ bool ResourceAccess::processMessageBuffer() const uint size = *(int*)(d->partialMessageBuffer.constData() + sizeof(int) + sizeof(uint)); if (size > (uint)(d->partialMessageBuffer.size() - headerSize)) { + qWarning() << "command too small"; return false; } diff --git a/common/storage_lmdb.cpp b/common/storage_lmdb.cpp index bede6aa..b7fbfed 100644 --- a/common/storage_lmdb.cpp +++ b/common/storage_lmdb.cpp @@ -218,6 +218,11 @@ bool Storage::write(void const *keyPtr, size_t keySize, void const *valuePtr, si return false; } + if (!keyPtr || keySize == 0) { + std::cerr << "tried to write empty key." << std::endl; + return false; + } + const bool implicitTransaction = !d->transaction || d->readTransaction; if (implicitTransaction) { if (!startTransaction()) { -- cgit v1.2.3