Skip to content

Commit

Permalink
fix(Windows): Fix cast and control paths errors on windows (facebook#…
Browse files Browse the repository at this point in the history
…46899)

Summary:
Windows has a stricter set of rules for C++ files where we treat warning as error, the following files have fixes to correctly cast numbers and fix control path errors.

Control Path Error on React-Native-Windows repo:
```
1>react-native-windows\node_modules\react-native\ReactCommon\react\performance\timeline\PerformanceEntryReporter.h(138,1): warning C4715: 'facebook::react::PerformanceEntryReporter::getBufferRef': not all control paths return a value
1>react-native-windows\node_modules\react-native\ReactCommon\react\performance\timeline\PerformanceEntryReporter.h(154,1): warning C4715: 'facebook::react::PerformanceEntryReporter::getBuffer': not all control paths return a value
```

Apply these fixes will allow us to unfork these files in our repo :)

## Changelog:

[GENERAL] [FIXED] - Fix cast and control paths errors on windows

Pull Request resolved: facebook#46899

Test Plan: Tested on the RNW repo, these files are already forked with the respective fix

Reviewed By: cipolleschi

Differential Revision: D64086963

Pulled By: arushikesarwani94

fbshipit-source-id: fdad72dafa1a01c426536fc1b007dd4a83588d93
  • Loading branch information
TatianaKapos authored and facebook-github-bot committed Oct 9, 2024
1 parent 7fb3d83 commit 0794fa9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ uint32_t PerformanceEntryReporter::getDroppedEntriesCount(
PerformanceEntryType entryType) const noexcept {
std::shared_lock lock(buffersMutex_);

return getBuffer(entryType).droppedEntriesCount;
return (uint32_t)getBuffer(entryType).droppedEntriesCount;
}

std::vector<PerformanceEntry> PerformanceEntryReporter::getEntries() const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class PerformanceEntryReporter {
case PerformanceEntryType::_NEXT:
throw std::logic_error("Cannot get buffer for _NEXT entry type");
}
throw std::logic_error("Unhandled PerformanceEntryType");
}

inline PerformanceEntryBuffer& getBufferRef(PerformanceEntryType entryType) {
Expand All @@ -140,6 +141,7 @@ class PerformanceEntryReporter {
case PerformanceEntryType::_NEXT:
throw std::logic_error("Cannot get buffer for _NEXT entry type");
}
throw std::logic_error("Unhandled PerformanceEntryType");
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ ScrollViewProps::ScrollViewProps(
rawProps,
"endDraggingSensitivityMultiplier",
sourceProps.endDraggingSensitivityMultiplier,
1)),
(Float)1)),
enableSyncOnScroll(
CoreFeatures::enablePropIteratorSetter
? sourceProps.enableSyncOnScroll
Expand Down

0 comments on commit 0794fa9

Please sign in to comment.