From 712c2ed5d2f0e2988c3cff276b05c50b7f408ce2 Mon Sep 17 00:00:00 2001 From: Valentin Shergin Date: Fri, 29 Jun 2018 12:09:57 -0700 Subject: [PATCH] Fabric: Getting rid of `std::to_string()` Summary: @public Suddenly, it is not supported on Android. Luckelly `folly:to()` is as good as `std::to_string()`. Reviewed By: mdvacca Differential Revision: D8655538 fbshipit-source-id: 2b3b970f6a261253aaa6b22dba8338dc66b7195d --- ReactCommon/fabric/attributedstring/conversions.h | 2 +- ReactCommon/fabric/core/shadownode/ShadowNode.cpp | 4 ++-- ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ReactCommon/fabric/attributedstring/conversions.h b/ReactCommon/fabric/attributedstring/conversions.h index 478d423517f..7e63dc1a431 100644 --- a/ReactCommon/fabric/attributedstring/conversions.h +++ b/ReactCommon/fabric/attributedstring/conversions.h @@ -50,7 +50,7 @@ inline void fromDynamic(const folly::dynamic &value, FontWeight &result) { } inline std::string toString(const FontWeight &fontWeight) { - return std::to_string((int)fontWeight); + return folly::to((int)fontWeight); } inline void fromDynamic(const folly::dynamic &value, FontStyle &result) { diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp index 54e1465eb19..ccb7fc1cdd0 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp @@ -162,7 +162,7 @@ std::string ShadowNode::getDebugName() const { } std::string ShadowNode::getDebugValue() const { - return "r" + std::to_string(revision_) + (getSealed() ? "/sealed" : ""); + return "r" + folly::to(revision_) + (getSealed() ? "/sealed" : ""); } SharedDebugStringConvertibleList ShadowNode::getDebugChildren() const { @@ -181,7 +181,7 @@ SharedDebugStringConvertibleList ShadowNode::getDebugChildren() const { SharedDebugStringConvertibleList ShadowNode::getDebugProps() const { SharedDebugStringConvertibleList list = {}; - list.push_back(std::make_shared("tag", std::to_string(tag_))); + list.push_back(std::make_shared("tag", folly::to(tag_))); SharedShadowNode sourceNode = getSourceNode(); if (sourceNode) { diff --git a/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp b/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp index fd728dd7a41..c5f07453749 100644 --- a/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp +++ b/ReactCommon/fabric/uimanager/TreeMutationInstruction.cpp @@ -166,20 +166,20 @@ SharedDebugStringConvertibleList TreeMutationInstruction::getDebugProps() const return SharedDebugStringConvertibleList { std::make_shared("parentNode", parentNode_->getDebugDescription(options)), std::make_shared("childNode", newChildNode_->getDebugDescription(options)), - std::make_shared("index", std::to_string(index_)) + std::make_shared("index", folly::to(index_)) }; case Removal: return SharedDebugStringConvertibleList { std::make_shared("parentNode", parentNode_->getDebugDescription(options)), std::make_shared("childNode", oldChildNode_->getDebugDescription(options)), - std::make_shared("index", std::to_string(index_)) + std::make_shared("index", folly::to(index_)) }; case Replacement: return SharedDebugStringConvertibleList { std::make_shared("parentNode", parentNode_->getDebugDescription(options)), std::make_shared("oldChildNode", oldChildNode_->getDebugDescription(options)), std::make_shared("newChildNode", newChildNode_->getDebugDescription(options)), - std::make_shared("index", std::to_string(index_)) + std::make_shared("index", folly::to(index_)) }; } }