diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-08 17:43:07 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2016-12-08 17:43:07 +0100 |
commit | 9c8e4612403fc2accc26ac2b49670394972f1293 (patch) | |
tree | a0f09d24cb1c9cec3e9778a06deb0da154f02078 /common/domain | |
parent | 5255876dde678aa7d5af8020d5836b1fc6c58fc7 (diff) | |
download | sink-9c8e4612403fc2accc26ac2b49670394972f1293.tar.gz sink-9c8e4612403fc2accc26ac2b49670394972f1293.zip |
One copy algorithm is enough.
Diffstat (limited to 'common/domain')
-rw-r--r-- | common/domain/applicationdomaintype.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/common/domain/applicationdomaintype.h b/common/domain/applicationdomaintype.h index be14513..7c3800d 100644 --- a/common/domain/applicationdomaintype.h +++ b/common/domain/applicationdomaintype.h | |||
@@ -122,7 +122,7 @@ struct Reference { | |||
122 | QByteArray value; | 122 | QByteArray value; |
123 | }; | 123 | }; |
124 | 124 | ||
125 | void copyBuffer(Sink::ApplicationDomain::BufferAdaptor &buffer, Sink::ApplicationDomain::BufferAdaptor &memoryAdaptor, const QList<QByteArray> &properties, bool copyBlobs, bool pruneReferences); | 125 | void copyBuffer(Sink::ApplicationDomain::BufferAdaptor &buffer, Sink::ApplicationDomain::BufferAdaptor &memoryAdaptor, const QList<QByteArray> &properties = QList<QByteArray>(), bool copyBlobs = false, bool pruneReferences = false); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * The domain type interface has two purposes: | 128 | * The domain type interface has two purposes: |
@@ -155,7 +155,8 @@ public: | |||
155 | template <typename DomainType> | 155 | template <typename DomainType> |
156 | static typename DomainType::Ptr getInMemoryRepresentation(const ApplicationDomainType &domainType, const QList<QByteArray> properties = QList<QByteArray>()) | 156 | static typename DomainType::Ptr getInMemoryRepresentation(const ApplicationDomainType &domainType, const QList<QByteArray> properties = QList<QByteArray>()) |
157 | { | 157 | { |
158 | auto memoryAdaptor = QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create(*(domainType.mAdaptor), properties); | 158 | auto memoryAdaptor = QSharedPointer<Sink::ApplicationDomain::MemoryBufferAdaptor>::create(); |
159 | copyBuffer(*(domainType.mAdaptor), *memoryAdaptor, properties, false, false); | ||
159 | //mIdentifier internally still refers to the memory-mapped memory, we need to copy the memory or it will become invalid | 160 | //mIdentifier internally still refers to the memory-mapped memory, we need to copy the memory or it will become invalid |
160 | return QSharedPointer<DomainType>::create(domainType.mResourceInstanceIdentifier, QByteArray(domainType.mIdentifier.constData(), domainType.mIdentifier.size()), domainType.mRevision, memoryAdaptor); | 161 | return QSharedPointer<DomainType>::create(domainType.mResourceInstanceIdentifier, QByteArray(domainType.mIdentifier.constData(), domainType.mIdentifier.size()), domainType.mRevision, memoryAdaptor); |
161 | } | 162 | } |