Skip to content

Commit

Permalink
Add explicit type casts to fix compilation errors on Windows. (#31363)
Browse files Browse the repository at this point in the history
Summary:
Recent changes to `MapBuffer` have broken the compilation on Windows.
This fix is similar to this recently-merged change: #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

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Fix compilation errors on Windows.

Pull Request resolved: #31363

Test Plan: RN now builds in Visual Studio on Windows.

Reviewed By: mdvacca

Differential Revision: D28028342

Pulled By: rozele

fbshipit-source-id: 77d8d4870c59b77acfc0ab2f4c3b7df40b59851d
  • Loading branch information
Igor Klemenski authored and facebook-github-bot committed May 3, 2021
1 parent 7bf78ea commit 6d04a46
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ReactCommon/react/renderer/mapbuffer/MapBufferBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int32_t>(value.length());
const char *cstring = getCstring(&value);

// format [lenght of string (int)] + [Array of Characters in the string]
Expand Down

0 comments on commit 6d04a46

Please sign in to comment.