Skip to content

Commit 4eef991

Browse files
authored
Fix some compiler warnings (#7531)
1 parent 33bce0e commit 4eef991

File tree

6 files changed

+13
-12
lines changed

6 files changed

+13
-12
lines changed

src/realm/collection_parent.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ CollectionParent::~CollectionParent() {}
7575

7676
void CollectionParent::check_level() const
7777
{
78-
if (m_level + 1 > s_max_level) {
78+
if (size_t(m_level) + 1 > s_max_level) {
7979
throw LogicError(ErrorCodes::LimitExceeded, "Max nesting level reached");
8080
}
8181
}
8282

8383
template <typename Base, template <typename> typename Collection, typename LinkCol>
84-
std::unique_ptr<Base> create_collection(ColKey col_key, size_t level)
84+
std::unique_ptr<Base> create_collection(ColKey col_key, uint8_t level)
8585
{
8686
bool nullable = col_key.get_attrs().test(col_attr_Nullable);
8787
switch (col_key.get_type()) {
@@ -128,19 +128,19 @@ std::unique_ptr<Base> create_collection(ColKey col_key, size_t level)
128128
}
129129
}
130130

131-
LstBasePtr CollectionParent::get_listbase_ptr(ColKey col_key, size_t level)
131+
LstBasePtr CollectionParent::get_listbase_ptr(ColKey col_key, uint8_t level)
132132
{
133133
REALM_ASSERT(col_key.get_attrs().test(col_attr_List) || col_key.get_type() == col_type_Mixed);
134134
return create_collection<LstBase, Lst, LnkLst>(col_key, level);
135135
}
136136

137-
SetBasePtr CollectionParent::get_setbase_ptr(ColKey col_key, size_t level)
137+
SetBasePtr CollectionParent::get_setbase_ptr(ColKey col_key, uint8_t level)
138138
{
139139
REALM_ASSERT(col_key.get_attrs().test(col_attr_Set));
140140
return create_collection<SetBase, Set, LnkSet>(col_key, level);
141141
}
142142

143-
CollectionBasePtr CollectionParent::get_collection_ptr(ColKey col_key, size_t level)
143+
CollectionBasePtr CollectionParent::get_collection_ptr(ColKey col_key, uint8_t level)
144144
{
145145
if (col_key.is_list()) {
146146
return get_listbase_ptr(col_key, level);

src/realm/collection_parent.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ class CollectionParent : public std::enable_shared_from_this<CollectionParent> {
9999
// a write to mark the already up-to-date parent as still being up-to-date.
100100
virtual void update_content_version() const noexcept = 0;
101101

102-
static LstBasePtr get_listbase_ptr(ColKey col_key, size_t level);
103-
static SetBasePtr get_setbase_ptr(ColKey col_key, size_t level);
104-
static CollectionBasePtr get_collection_ptr(ColKey col_key, size_t level);
102+
static LstBasePtr get_listbase_ptr(ColKey col_key, uint8_t level);
103+
static SetBasePtr get_setbase_ptr(ColKey col_key, uint8_t level);
104+
static CollectionBasePtr get_collection_ptr(ColKey col_key, uint8_t level);
105105

106106
static int64_t generate_key(size_t sz);
107107
static void set_key(BPlusTreeMixed& tree, size_t index);

src/realm/dictionary.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void validate_key_value(const Mixed& key)
4848

4949
/******************************** Dictionary *********************************/
5050

51-
Dictionary::Dictionary(ColKey col_key, size_t level)
51+
Dictionary::Dictionary(ColKey col_key, uint8_t level)
5252
: Base(col_key)
5353
, CollectionParent(level)
5454
{

src/realm/dictionary.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Dictionary final : public CollectionBaseImpl<DictionaryBase>, public Colle
5151
: Base(parent, index)
5252
{
5353
}
54-
Dictionary(ColKey col_key, size_t level = 1);
54+
Dictionary(ColKey col_key, uint8_t level = 1);
5555
Dictionary(const Dictionary& other)
5656
: Base(static_cast<const Base&>(other))
5757
, CollectionParent(other.get_level())

src/realm/list.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ class Lst<Mixed> final : public CollectionBaseImpl<LstBase>, public CollectionPa
291291
{
292292
this->set_owner(owner, col_key);
293293
}
294-
Lst(ColKey col_key, size_t level = 1)
294+
Lst(ColKey col_key, uint8_t level = 1)
295295
: Base(col_key)
296296
, CollectionParent(level)
297297
{

src/realm/sync/client.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,8 @@ void SessionWrapper::report_progress(bool is_download, bool only_if_new_uploadab
19371937
p.downloadable = p.downloaded;
19381938
if (0.01 <= download_estimate && download_estimate <= 0.99)
19391939
if (p.downloaded > p.final_downloaded)
1940-
p.downloadable = p.final_downloaded + (p.downloaded - p.final_downloaded) / download_estimate;
1940+
p.downloadable =
1941+
p.final_downloaded + uint64_t((p.downloaded - p.final_downloaded) / download_estimate);
19411942
}
19421943
else {
19431944
if (!is_completed || !is_download)

0 commit comments

Comments
 (0)