From 6d04a46f7427b9e107608f8f620fe2a1a84ff42d Mon Sep 17 00:00:00 2001 From: Igor Klemenski Date: Mon, 3 May 2021 09:32:49 -0700 Subject: [PATCH] Add explicit type casts to fix compilation errors on Windows. (#31363) Summary: Recent changes to `MapBuffer` have broken the compilation on Windows. This fix is similar to this recently-merged change: https://github.com/facebook/react-native/pull/31106 Side note - this PR only addresses a build break, but doesn't address the unsafe casting semantics in `MapBuffer`, which can still cause overflows. ## Changelog [General] [Fixed] - Fix compilation errors on Windows. Pull Request resolved: https://github.com/facebook/react-native/pull/31363 Test Plan: RN now builds in Visual Studio on Windows. Reviewed By: mdvacca Differential Revision: D28028342 Pulled By: rozele fbshipit-source-id: 77d8d4870c59b77acfc0ab2f4c3b7df40b59851d --- ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp b/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp index 54a7fa03bf8f3b..4ff2f7b5c58807 100644 --- a/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp +++ b/ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp @@ -127,7 +127,7 @@ void MapBufferBuilder::ensureDynamicDataSpace(int32_t size) { } void MapBufferBuilder::putString(Key key, std::string value) { - int32_t strLength = value.length(); + int32_t strLength = static_cast(value.length()); const char *cstring = getCstring(&value); // format [lenght of string (int)] + [Array of Characters in the string]