From c207708c4be24e99a10583f53e2f3772dfc265cb Mon Sep 17 00:00:00 2001 From: John Mavrantonakis Date: Mon, 27 May 2024 12:14:03 -0700 Subject: [PATCH] Fix for Clang tidy, needed for fbcode include (#44655) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44655 Required to compile with clang This is because previously it was comparing size_t with int which is not allowed under compilation with clang Changelog: [Internal] [Fixed] - Replaced old style for loop with new style to avoid clang errors with size_t to int comparisons Differential Revision: D57721635 fbshipit-source-id: 2738f7b415d668c37536f7f93b2e0985fa2cc5e6 --- .../ReactCommon/react/renderer/core/propsConversions.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h b/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h index 31cad74f10c..7657945dc8d 100644 --- a/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h +++ b/packages/react-native/ReactCommon/react/renderer/core/propsConversions.h @@ -63,9 +63,9 @@ void fromRawValue( auto length = items.size(); result.clear(); result.reserve(length); - for (size_t i = 0; i < length; i++) { + for (auto& item : items) { T itemResult; - fromRawValue(context, items.at(i), itemResult); + fromRawValue(context, item, itemResult); result.push_back(itemResult); } return; @@ -89,9 +89,9 @@ void fromRawValue( auto length = items.size(); result.clear(); result.reserve(length); - for (int i = 0; i < length; i++) { + for (auto& item : items) { T itemResult; - fromRawValue(context, items.at(i), itemResult); + fromRawValue(context, item, itemResult); result.push_back(itemResult); } return;