Skip to content

Commit 455e7d5

Browse files
authored
Fix Firestore build warnings (#12536)
1 parent c8acb76 commit 455e7d5

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

Firestore/core/src/local/index_backfiller.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// limitations under the License.
1414

1515
#include <algorithm>
16+
#include <string>
1617
#include <unordered_set>
1718
#include <utility>
1819

@@ -44,7 +45,7 @@ IndexBackfiller::IndexBackfiller() {
4445
max_documents_to_process_ = kMaxDocumentsToProcess;
4546
}
4647

47-
int IndexBackfiller::WriteIndexEntries(const LocalStore* local_store) {
48+
size_t IndexBackfiller::WriteIndexEntries(const LocalStore* local_store) {
4849
IndexManager* index_manager = local_store->index_manager();
4950
std::unordered_set<std::string> processed_collection_groups;
5051
size_t documents_remaining = max_documents_to_process_;
@@ -64,10 +65,10 @@ int IndexBackfiller::WriteIndexEntries(const LocalStore* local_store) {
6465
return max_documents_to_process_ - documents_remaining;
6566
}
6667

67-
int IndexBackfiller::WriteEntriesForCollectionGroup(
68+
size_t IndexBackfiller::WriteEntriesForCollectionGroup(
6869
const LocalStore* local_store,
6970
const std::string& collection_group,
70-
int documents_remaining_under_cap) const {
71+
size_t documents_remaining_under_cap) const {
7172
IndexManager* index_manager = local_store->index_manager();
7273
const auto* const local_documents_view = local_store->local_documents();
7374

Firestore/core/src/local/index_backfiller.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#ifndef FIRESTORE_CORE_SRC_LOCAL_INDEX_BACKFILLER_H_
1616
#define FIRESTORE_CORE_SRC_LOCAL_INDEX_BACKFILLER_H_
1717

18+
#include <cstddef>
1819
#include <string>
1920

2021
namespace firebase {
@@ -43,7 +44,7 @@ class IndexBackfiller {
4344
* Writes index entries until the cap is reached. Returns the number of
4445
* documents processed.
4546
*/
46-
int WriteIndexEntries(const LocalStore* local_store);
47+
size_t WriteIndexEntries(const LocalStore* local_store);
4748

4849
private:
4950
friend class IndexBackfillerTest;
@@ -53,9 +54,10 @@ class IndexBackfiller {
5354
* Writes entries for the provided collection group. Returns the number of
5455
* documents processed.
5556
*/
56-
int WriteEntriesForCollectionGroup(const LocalStore* local_store,
57-
const std::string& collection_group,
58-
int documents_remaining_under_cap) const;
57+
size_t WriteEntriesForCollectionGroup(
58+
const LocalStore* local_store,
59+
const std::string& collection_group,
60+
size_t documents_remaining_under_cap) const;
5961

6062
/** Returns the next offset based on the provided documents. */
6163
model::IndexOffset GetNewOffset(const model::IndexOffset& existing_offset,

Firestore/core/src/local/local_documents_view.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ model::DocumentMap LocalDocumentsView::GetDocumentsMatchingCollectionGroupQuery(
134134
LocalWriteResult LocalDocumentsView::GetNextDocuments(
135135
const std::string& collection_group,
136136
const IndexOffset& offset,
137-
int count) const {
137+
size_t count) const {
138138
auto docs = remote_document_cache_->GetAll(collection_group, offset, count);
139139
auto overlays = count - docs.size() > 0
140140
? document_overlay_cache_->GetOverlays(

Firestore/core/src/local/local_documents_view.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef FIRESTORE_CORE_SRC_LOCAL_LOCAL_DOCUMENTS_VIEW_H_
1818
#define FIRESTORE_CORE_SRC_LOCAL_LOCAL_DOCUMENTS_VIEW_H_
1919

20+
#include <cstddef>
2021
#include <string>
2122
#include <unordered_map>
2223
#include <vector>
@@ -98,7 +99,7 @@ class LocalDocumentsView {
9899
*/
99100
local::LocalWriteResult GetNextDocuments(const std::string& collection_group,
100101
const model::IndexOffset& offset,
101-
int count) const;
102+
size_t count) const;
102103

103104
/**
104105
* Similar to `GetDocuments`, but creates the local view from the given

Firestore/core/src/remote/bloom_filter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ int32_t BloomFilter::GetBitIndex(const Hash& hash, int32_t hash_index) const {
7878
uint64_t bit_index = combined_hash % bit_count_uint64;
7979

8080
HARD_ASSERT(bit_index <= INT32_MAX);
81-
return bit_index;
81+
return static_cast<int32_t>(bit_index);
8282
}
8383

8484
bool BloomFilter::IsBitSet(int32_t index) const {

0 commit comments

Comments
 (0)