From 950ea915bee6b3b30107c04bd34990fb390c7268 Mon Sep 17 00:00:00 2001 From: TatianaKapos Date: Fri, 21 Oct 2022 17:48:28 -0700 Subject: [PATCH] Fix windows warning/error over unsigned int (#34947) Summary: react-native-windows treats compiler c++ warning as errors, this is one of them. It fixes it by assigning i to unsigned instead of auto. ## Changelog [Internal] [Changed] - Fix react-native-windows compiler warning in AttributedString Pull Request resolved: https://github.com/facebook/react-native/pull/34947 Test Plan: [code](https://github.com/microsoft/react-native-windows/pull/10479/files#diff-c14f3a9383607a661977aa577c75bbc547827502950e0244721ef021f549fbe2) is already merged into react-native-windows and passing all tests. The for loop changed is also used directly above in AttributedString::compareTextAttributesWithoutFrame Reviewed By: shwanton Differential Revision: D40459186 Pulled By: NickGerleman fbshipit-source-id: 848375f75f3df0cd086d758a239e86f39b43aa3f --- .../react/renderer/attributedstring/AttributedString.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ReactCommon/react/renderer/attributedstring/AttributedString.cpp b/ReactCommon/react/renderer/attributedstring/AttributedString.cpp index f4d4c4af987..b244d11b096 100644 --- a/ReactCommon/react/renderer/attributedstring/AttributedString.cpp +++ b/ReactCommon/react/renderer/attributedstring/AttributedString.cpp @@ -112,7 +112,7 @@ bool AttributedString::compareTextAttributesWithoutFrame( return false; } - for (unsigned i = 0; i < fragments_.size(); i++) { + for (size_t i = 0; i < fragments_.size(); i++) { if (fragments_[i].textAttributes != rhs.fragments_[i].textAttributes || fragments_[i].string != rhs.fragments_[i].string) { return false; @@ -135,7 +135,7 @@ bool AttributedString::isContentEqual(const AttributedString &rhs) const { return false; } - for (auto i = 0; i < fragments_.size(); i++) { + for (size_t i = 0; i < fragments_.size(); i++) { if (!fragments_[i].isContentEqual(rhs.fragments_[i])) { return false; }