summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2020-02-05 22:13:09 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2020-02-05 22:13:09 +0100
commit69e4c826a34eb84c36bb07338a9a292a520f5970 (patch)
tree99d00a446b36fcdaf27dc9f1ddb5fc7e9edf5e3c
parent495d2cb6b47b309070b31e0ef83fa5731a150a6d (diff)
Fix compilation with clang
-rw-r--r--include/erebos/identity.h6
-rw-r--r--include/erebos/storage.h8
-rw-r--r--src/identity.cpp5
-rw-r--r--src/identity.h6
-rw-r--r--src/network.cpp2
-rw-r--r--src/pubkey.cpp5
-rw-r--r--src/pubkey.h5
-rw-r--r--src/storage.cpp8
-rw-r--r--src/storage.h4
9 files changed, 23 insertions, 26 deletions
diff --git a/include/erebos/identity.h b/include/erebos/identity.h
index 4fdddab..9ed170a 100644
--- a/include/erebos/identity.h
+++ b/include/erebos/identity.h
@@ -29,7 +29,7 @@ public:
friend class Identity;
struct Priv;
const std::shared_ptr<Priv> p;
- Builder(Priv * p): p(p) {}
+ Builder(Priv * p);
};
static Builder create(const Storage &);
@@ -38,8 +38,8 @@ public:
private:
struct Priv;
const std::shared_ptr<const Priv> p;
- Identity(const Priv * p): p(p) {}
- Identity(std::shared_ptr<const Priv> && p): p(std::move(p)) {}
+ Identity(const Priv * p);
+ Identity(std::shared_ptr<const Priv> && p);
};
}
diff --git a/include/erebos/storage.h b/include/erebos/storage.h
index d23022f..5812783 100644
--- a/include/erebos/storage.h
+++ b/include/erebos/storage.h
@@ -33,7 +33,7 @@ public:
typedef erebos::PartialRef Ref;
PartialStorage(const PartialStorage &) = default;
- PartialStorage & operator=(const PartialStorage &) = default;
+ PartialStorage & operator=(const PartialStorage &) = delete;
virtual ~PartialStorage() = default;
bool operator==(const PartialStorage &) const;
@@ -62,7 +62,7 @@ public:
Storage(const std::filesystem::path &);
Storage(const Storage &) = default;
- Storage & operator=(const Storage &) = default;
+ Storage & operator=(const Storage &) = delete;
Storage deriveEphemeralStorage() const;
PartialStorage derivePartialStorage() const;
@@ -117,7 +117,7 @@ class PartialRef
{
public:
PartialRef(const PartialRef &) = default;
- PartialRef & operator=(const PartialRef &) = default;
+ PartialRef & operator=(const PartialRef &) = delete;
static PartialRef create(PartialStorage, const Digest &);
@@ -140,7 +140,7 @@ class Ref : public PartialRef
{
public:
Ref(const Ref &) = default;
- Ref & operator=(const Ref &) = default;
+ Ref & operator=(const Ref &) = delete;
static std::optional<Ref> create(Storage, const Digest &);
diff --git a/src/identity.cpp b/src/identity.cpp
index 57f25cc..00abf0b 100644
--- a/src/identity.cpp
+++ b/src/identity.cpp
@@ -11,6 +11,9 @@ using std::nullopt;
using std::runtime_error;
using std::set;
+Identity::Identity(const Priv * p): p(p) {}
+Identity::Identity(shared_ptr<const Priv> && p): p(std::move(p)) {}
+
optional<Identity> Identity::load(const Ref & ref)
{
return Identity::load(vector { ref });
@@ -75,6 +78,8 @@ Identity::Builder Identity::modify() const
}
+Identity::Builder::Builder(Priv * p): p(p) {}
+
Identity Identity::Builder::commit() const
{
auto idata = p->storage.store(IdentityData {
diff --git a/src/identity.h b/src/identity.h
index 79b335e..92ac34f 100644
--- a/src/identity.h
+++ b/src/identity.h
@@ -23,9 +23,8 @@ public:
const optional<Stored<PublicKey>> keyMessage;
};
-class Identity::Priv
+struct Identity::Priv
{
-public:
vector<Stored<Signed<IdentityData>>> data;
shared_future<optional<string>> name;
optional<Identity> owner;
@@ -38,9 +37,8 @@ public:
function<bool(const IdentityData &)> sel);
};
-class Identity::Builder::Priv
+struct Identity::Builder::Priv
{
-public:
Storage storage;
vector<Stored<Signed<IdentityData>>> prev = {};
optional<string> name = nullopt;
diff --git a/src/network.cpp b/src/network.cpp
index e9aeb3f..f778bf9 100644
--- a/src/network.cpp
+++ b/src/network.cpp
@@ -458,7 +458,7 @@ optional<TransportHeader> TransportHeader::load(const PartialObject & obj)
}
}
- return TransportHeader { .items = items };
+ return TransportHeader(items);
}
PartialObject TransportHeader::toObject() const
diff --git a/src/pubkey.cpp b/src/pubkey.cpp
index 3a08c70..6f6c1e7 100644
--- a/src/pubkey.cpp
+++ b/src/pubkey.cpp
@@ -122,10 +122,7 @@ optional<Signature> Signature::load(const Ref & ref)
if (!key || !sig)
return nullopt;
- return Signature {
- .key = key.value(),
- .sig = sig.value(),
- };
+ return Signature(*key, *sig);
}
Ref Signature::store(const Storage & st) const
diff --git a/src/pubkey.h b/src/pubkey.h
index b14743d..607352d 100644
--- a/src/pubkey.h
+++ b/src/pubkey.h
@@ -106,10 +106,7 @@ optional<Signed<T>> Signed<T>::load(const Ref & ref)
if (sig.value()->verify(data.value().ref))
sigs.push_back(sig.value());
- return Signed {
- .data = data.value(),
- .sigs = sigs,
- };
+ return Signed(*data, sigs);
}
template<typename T>
diff --git a/src/storage.cpp b/src/storage.cpp
index db9f629..07fef51 100644
--- a/src/storage.cpp
+++ b/src/storage.cpp
@@ -720,8 +720,8 @@ vector<uint8_t> RecordT<S>::encodeInner() const
return res;
}
-template class RecordT<Storage>;
-template class RecordT<PartialStorage>;
+template class erebos::RecordT<Storage>;
+template class erebos::RecordT<PartialStorage>;
Blob::Blob(const vector<uint8_t> & vec):
@@ -852,8 +852,8 @@ optional<Blob> ObjectT<S>::asBlob() const
return nullopt;
}
-template class ObjectT<Storage>;
-template class ObjectT<PartialStorage>;
+template class erebos::ObjectT<Storage>;
+template class erebos::ObjectT<PartialStorage>;
vector<Stored<Object>> erebos::collectStoredObjects(const Stored<Object> & from)
{
diff --git a/src/storage.h b/src/storage.h
index 86dc48f..c67be22 100644
--- a/src/storage.h
+++ b/src/storage.h
@@ -98,7 +98,7 @@ private:
unique_ptr<ChainStorage> parent;
};
-struct Storage::Priv
+struct PartialStorage::Priv
{
shared_ptr<StorageBackend> backend;
@@ -111,7 +111,7 @@ struct Storage::Priv
optional<Digest> copy(const ObjectT<S> &, vector<Digest> *) const;
};
-struct Ref::Priv
+struct PartialRef::Priv
{
const unique_ptr<PartialStorage> storage;
const Digest digest;