diff --git a/src/js_realm.hpp b/src/js_realm.hpp index 9f8b2a64..b6d6bab5 100644 --- a/src/js_realm.hpp +++ b/src/js_realm.hpp @@ -248,7 +248,7 @@ inline typename T::Function RealmClass::create_constructor(ContextType ctx) { } static inline void convert_outdated_datetime_columns(const SharedRealm &realm) { - int old_file_format_version = realm->file_format_upgraded_from_version(); + realm::util::Optional old_file_format_version = realm->file_format_upgraded_from_version(); if (old_file_format_version && old_file_format_version < 5) { // any versions earlier than file format 5 are stored as milliseconds and need to be converted to the new format for (auto& object_schema : *realm->config().schema) { diff --git a/src/object-store/src/impl/realm_coordinator.cpp b/src/object-store/src/impl/realm_coordinator.cpp index 931416b8..42f8aba9 100644 --- a/src/object-store/src/impl/realm_coordinator.cpp +++ b/src/object-store/src/impl/realm_coordinator.cpp @@ -102,7 +102,7 @@ std::shared_ptr RealmCoordinator::get_realm(Realm::Config config) } } } - + auto realm = std::make_shared(std::move(config)); realm->init(shared_from_this()); diff --git a/src/object-store/src/object_store.hpp b/src/object-store/src/object_store.hpp index 0b9f05f8..670cbf53 100644 --- a/src/object-store/src/object_store.hpp +++ b/src/object-store/src/object_store.hpp @@ -157,7 +157,7 @@ namespace realm { private: std::vector m_validation_errors; }; - + class SchemaMismatchException : public ObjectStoreException { public: SchemaMismatchException(std::vector const& errors); diff --git a/src/object-store/src/shared_realm.cpp b/src/object-store/src/shared_realm.cpp index c5d50b8e..056bc9e7 100644 --- a/src/object-store/src/shared_realm.cpp +++ b/src/object-store/src/shared_realm.cpp @@ -463,10 +463,10 @@ void Realm::close() m_coordinator = nullptr; } -int Realm::file_format_upgraded_from_version() const +util::Optional Realm::file_format_upgraded_from_version() const { if (upgrade_initial_version != upgrade_final_version) { return upgrade_initial_version; } - return 0; + return util::Optional(); } diff --git a/src/object-store/src/shared_realm.hpp b/src/object-store/src/shared_realm.hpp index d01bfdb1..1536fa76 100644 --- a/src/object-store/src/shared_realm.hpp +++ b/src/object-store/src/shared_realm.hpp @@ -133,7 +133,7 @@ namespace realm { void close(); // returns the file format version upgraded from, or 0 if not upgraded - int file_format_upgraded_from_version() const; + util::Optional file_format_upgraded_from_version() const; ~Realm();