Skip to content

Commit 2ca88a0

Browse files
anupriya13facebook-github-bot
authored andcommitted
'return': conversion from 'int' to 'uint8_t', possible loss of data in CSSHexColor (#52496)
Summary: Resolves microsoft/react-native-windows#14666 We faced this issue while integrating [0.79.0-nightly-20250220-41b597c73](https://github.com/microsoft/react-native-windows/pull/14662/files#top) This warning is treated as error and should be fixed here as well. ## Changelog: <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [GENERAL] [FIXED] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: #52496 Test Plan: Fixed error: ##[error]node_modules\react-native\ReactCommon\react\renderer\css\CSSHexColor.h(39,12): Error C4244: 'return': conversion from 'int' to 'uint8_t', possible loss of data 2>D:\a_work\1\s\node_modules\react-native\ReactCommon\react\renderer\css\CSSHexColor.h(39,12): error C4244: 'return': conversion from 'int' to 'uint8_t', possible loss of data [D:\a_work\1\s\vnext\Microsoft.ReactNative\Microsoft.ReactNative.vcxproj] (compiling source file '../../node_modules/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp') Tested E2E in RNW Reviewed By: javache Differential Revision: D78000818 Pulled By: rshest fbshipit-source-id: 5caafc5e92540f722b009480f030276e526355af
1 parent 47957f9 commit 2ca88a0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • packages/react-native/ReactCommon/react/renderer/css

packages/react-native/ReactCommon/react/renderer/css/CSSHexColor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ constexpr uint8_t hexToNumeric(std::string_view hex, HexColorType hexType) {
3434
}
3535

3636
if (hexType == HexColorType::Short) {
37-
return result * 16 + result;
37+
return static_cast<uint8_t>(result * 16 + result);
3838
} else {
39-
return result;
39+
return static_cast<uint8_t>(result);
4040
}
4141
}
4242

0 commit comments

Comments
 (0)