Skip to content

Commit f52e23c

Browse files
committed
Attempt to silence warnings on Windows
1 parent 06b581f commit f52e23c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/realm/string_compressor.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ void StringCompressor::add_expansion(SymbolDef def)
8080
auto& chunk = m_expansion_storage.back();
8181
auto start_index = (uint32_t)chunk.size();
8282
if (def.expansion_a < 256)
83-
chunk.push_back(def.expansion_a);
83+
chunk.push_back((char)def.expansion_a);
8484
else
8585
chunk.append(m_symbols[def.expansion_a - 256].expansion);
8686
if (def.expansion_b < 256)
87-
chunk.push_back(def.expansion_b);
87+
chunk.push_back((char)def.expansion_b);
8888
else
8989
chunk.append(m_symbols[def.expansion_b - 256].expansion);
9090
std::string_view expansion(chunk.data() + start_index, exp_size);
@@ -115,7 +115,7 @@ void StringCompressor::rebuild_internal()
115115
for (size_t i = m_symbols.size(); i < num_symbols; ++i) {
116116
auto pair = m_data->get(i);
117117
SymbolDef def;
118-
def.id = i + 256;
118+
def.id = (CompressionSymbol)(i + 256);
119119
def.expansion_a = 0xFFFF & (pair >> 16);
120120
def.expansion_b = 0xFFFF & pair;
121121
auto hash = symbol_pair_hash(def.expansion_a, def.expansion_b);
@@ -167,7 +167,7 @@ CompressedString StringCompressor::compress(StringData sd, bool learn)
167167
REALM_ASSERT_DEBUG(m_compression_map[hash].id == 0);
168168
REALM_ASSERT_DEBUG(m_symbols.size() == m_data->size());
169169
REALM_ASSERT_DEBUG(m_data->is_attached());
170-
CompressionSymbol id = 256 + m_symbols.size();
170+
CompressionSymbol id = (CompressionSymbol)(256 + m_symbols.size());
171171
SymbolDef def{id, from[0], from[1]};
172172
m_compression_map[hash] = def;
173173
add_expansion(def);
@@ -215,7 +215,7 @@ std::string StringCompressor::decompress(CompressedStringView& c_str)
215215
ptr = c_str.data;
216216
while (ptr < limit) {
217217
if (*ptr < 256)
218-
result2.push_back(*ptr);
218+
result2.push_back((char)*ptr);
219219
else
220220
result2.append(m_symbols[*ptr - 256].expansion);
221221
ptr++;
@@ -225,7 +225,7 @@ std::string StringCompressor::decompress(CompressedStringView& c_str)
225225
{
226226
auto decompress = [&](CompressionSymbol symbol, auto& decompress) -> void {
227227
if (symbol < 256) {
228-
result.push_back(symbol);
228+
result.push_back((char)symbol);
229229
}
230230
else {
231231
auto& s = m_symbols[symbol - 256];

src/realm/string_interner.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ struct HashMapIter {
8282
}
8383
inline void set_index(size_t i, size_t search_limit = linear_search_limit)
8484
{
85-
index = i;
86-
left_to_search = std::min(m_array.size(), (size_t)search_limit);
85+
index = (uint16_t)i;
86+
left_to_search = (uint16_t)std::min(m_array.size(), (size_t)search_limit);
8787
}
8888
void operator++()
8989
{

0 commit comments

Comments
 (0)