Przeglądaj źródła

Safe cast for number of aggregations to fix compilation warning. (#11342)

* Safe cast for number of aggregations to fix compilation warning.

Fixes #11332.

* Add changelog entry.
Ehsan 2 lat temu
rodzic
commit
2937104f9b

+ 3 - 0
Firestore/CHANGELOG.md

@@ -1,3 +1,6 @@
+# Unreleased
+- [fixed] Fixed a compilation warning related to integer casting. (#11332)
+
 # 10.9.0
 - [feature] Add new cache config API to customize SDK cache settings.
 - [feature] Add LRU garbage collector as an option to memory cache.

+ 2 - 2
Firestore/core/src/remote/remote_objc_bridge.cc

@@ -298,8 +298,8 @@ DatastoreSerializer::EncodeAggregateQueryRequest(
     uniqueAggregates.insert(std::move(pair));
   }
 
-  auto count = uniqueAggregates.size();
-  size_t aggregationNum = 0;
+  pb_size_t count = static_cast<pb_size_t>(uniqueAggregates.size());
+  pb_size_t aggregationNum = 0;
   result->query_type.structured_aggregation_query.aggregations_count = count;
   result->query_type.structured_aggregation_query.aggregations =
       MakeArray<_google_firestore_v1_StructuredAggregationQuery_Aggregation>(