Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Firestore build warnings #12536

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Firestore/core/src/local/index_backfiller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// limitations under the License.

#include <algorithm>
#include <string>
#include <unordered_set>
#include <utility>

Expand Down Expand Up @@ -44,7 +45,7 @@ IndexBackfiller::IndexBackfiller() {
max_documents_to_process_ = kMaxDocumentsToProcess;
}

int IndexBackfiller::WriteIndexEntries(const LocalStore* local_store) {
size_t IndexBackfiller::WriteIndexEntries(const LocalStore* local_store) {
IndexManager* index_manager = local_store->index_manager();
std::unordered_set<std::string> processed_collection_groups;
size_t documents_remaining = max_documents_to_process_;
Expand All @@ -64,10 +65,10 @@ int IndexBackfiller::WriteIndexEntries(const LocalStore* local_store) {
return max_documents_to_process_ - documents_remaining;
}

int IndexBackfiller::WriteEntriesForCollectionGroup(
size_t IndexBackfiller::WriteEntriesForCollectionGroup(
const LocalStore* local_store,
const std::string& collection_group,
int documents_remaining_under_cap) const {
size_t documents_remaining_under_cap) const {
IndexManager* index_manager = local_store->index_manager();
const auto* const local_documents_view = local_store->local_documents();

Expand Down
10 changes: 6 additions & 4 deletions Firestore/core/src/local/index_backfiller.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#ifndef FIRESTORE_CORE_SRC_LOCAL_INDEX_BACKFILLER_H_
#define FIRESTORE_CORE_SRC_LOCAL_INDEX_BACKFILLER_H_

#include <cstddef>
#include <string>

namespace firebase {
Expand Down Expand Up @@ -43,7 +44,7 @@ class IndexBackfiller {
* Writes index entries until the cap is reached. Returns the number of
* documents processed.
*/
int WriteIndexEntries(const LocalStore* local_store);
size_t WriteIndexEntries(const LocalStore* local_store);

private:
friend class IndexBackfillerTest;
Expand All @@ -53,9 +54,10 @@ class IndexBackfiller {
* Writes entries for the provided collection group. Returns the number of
* documents processed.
*/
int WriteEntriesForCollectionGroup(const LocalStore* local_store,
const std::string& collection_group,
int documents_remaining_under_cap) const;
size_t WriteEntriesForCollectionGroup(
const LocalStore* local_store,
const std::string& collection_group,
size_t documents_remaining_under_cap) const;

/** Returns the next offset based on the provided documents. */
model::IndexOffset GetNewOffset(const model::IndexOffset& existing_offset,
Expand Down
2 changes: 1 addition & 1 deletion Firestore/core/src/local/local_documents_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ model::DocumentMap LocalDocumentsView::GetDocumentsMatchingCollectionGroupQuery(
LocalWriteResult LocalDocumentsView::GetNextDocuments(
const std::string& collection_group,
const IndexOffset& offset,
int count) const {
size_t count) const {
auto docs = remote_document_cache_->GetAll(collection_group, offset, count);
auto overlays = count - docs.size() > 0
? document_overlay_cache_->GetOverlays(
Expand Down
3 changes: 2 additions & 1 deletion Firestore/core/src/local/local_documents_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef FIRESTORE_CORE_SRC_LOCAL_LOCAL_DOCUMENTS_VIEW_H_
#define FIRESTORE_CORE_SRC_LOCAL_LOCAL_DOCUMENTS_VIEW_H_

#include <cstddef>
#include <string>
#include <unordered_map>
#include <vector>
Expand Down Expand Up @@ -98,7 +99,7 @@ class LocalDocumentsView {
*/
local::LocalWriteResult GetNextDocuments(const std::string& collection_group,
const model::IndexOffset& offset,
int count) const;
size_t count) const;

/**
* Similar to `GetDocuments`, but creates the local view from the given
Expand Down
2 changes: 1 addition & 1 deletion Firestore/core/src/remote/bloom_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ int32_t BloomFilter::GetBitIndex(const Hash& hash, int32_t hash_index) const {
uint64_t bit_index = combined_hash % bit_count_uint64;

HARD_ASSERT(bit_index <= INT32_MAX);
return bit_index;
return static_cast<int32_t>(bit_index);
}

bool BloomFilter::IsBitSet(int32_t index) const {
Expand Down
Loading