Repository: firebase/firebase-ios-sdk (language: cpp)

Issue:
Firestore 8.13.0 - Warnings in Firestore/core/src/local/local_serializer.cc
<!-- DO NOT DELETE
validate_template=true
template_path=.github/ISSUE_TEMPLATE/bug_report.md
-->

### [REQUIRED] Step 1: Describe your environment

  * Xcode version: 13.2.1
  * Firebase SDK version: 8.13.0
  * Installation method: `CocoaPods` (select one)
  * Firebase Component: `Firestore`
  * Target platform(s): `iOS`

### [REQUIRED] Step 2: Describe the problem

After updating pods to new version (8.13.0) in my iOS Project, i have received following warnings as seen in attached screenshot of following file.
File path: Firestore/core/src/local/local_serializer.cc

<img width="1375" alt="Firestore:core:src:local:local_serializer" src="https://user-images.githubusercontent.com/26038249/157325927-1ec2fc62-a781-4dee-a2e7-d0e5b444ae10.png">




Discussion / hints:
I found a few problems with this issue:
  * I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  * This issue does not seem to follow the issue template. Make sure you provide all the required information.
Looks like we are implicitly converting from `size_t` to `uint32_t`, which can be a lossy conversion. I'll fix this.

Fix patch:
diff --git a/Firestore/CHANGELOG.md b/Firestore/CHANGELOG.md
index 28cb3023771..a39d58a6d98 100644
--- a/Firestore/CHANGELOG.md
+++ b/Firestore/CHANGELOG.md
@@ -1,3 +1,7 @@
+# Unreleased
+- [fixed] Fixed compiler warnings in `local_serializer.cc` about "implicit
+  conversion loses integer precision" that were introduced in 8.13.0 (#9430).
+
 # v8.12.1
 - [changed] Add more details to the assertion failure in OrderBy::Compare() to
   help with future debugging (#9258).
diff --git a/Firestore/core/src/local/local_serializer.cc b/Firestore/core/src/local/local_serializer.cc
index 10b3fa72069..92d82380513 100644
--- a/Firestore/core/src/local/local_serializer.cc
+++ b/Firestore/core/src/local/local_serializer.cc
@@ -499,9 +499,12 @@ LocalSerializer::EncodeFieldIndexSegments(
   result->query_scope =
       google_firestore_admin_v1_Index_QueryScope_COLLECTION_GROUP;
 
-  result->fields_count = segments.size();
+  // Explicitly cast the result of segments.size() to suppress compiler warnings
+  // about implicit conversion resulting in potential loss of precision.
+  const auto segments_size = static_cast<pb_size_t>(segments.size());
+  result->fields_count = segments_size;
   result->fields =
-      MakeArray<google_firestore_admin_v1_Index_IndexField>(segments.size());
+      MakeArray<google_firestore_admin_v1_Index_IndexField>(segments_size);
   int i = 0;
   for (const auto& segment : segments) {
     google_firestore_admin_v1_Index_IndexField field;


Test patch: