diff --git a/ReactCommon/fabric/attributedstring/AttributedString.cpp b/ReactCommon/fabric/attributedstring/AttributedString.cpp index 094b28ed074fe4..cda286acf5d2b9 100644 --- a/ReactCommon/fabric/attributedstring/AttributedString.cpp +++ b/ReactCommon/fabric/attributedstring/AttributedString.cpp @@ -40,7 +40,7 @@ const std::vector &AttributedString::getFragments() const { } std::string AttributedString::getString() const { - std::string string; + auto string = std::string {}; for (const auto &fragment : fragments_) { string += fragment.string; } @@ -50,7 +50,7 @@ std::string AttributedString::getString() const { #pragma mark - DebugStringConvertible SharedDebugStringConvertibleList AttributedString::getDebugChildren() const { - SharedDebugStringConvertibleList list = {}; + auto list = SharedDebugStringConvertibleList {}; for (auto &&fragment : fragments_) { auto propsList = fragment.textAttributes.DebugStringConvertible::getDebugProps(); diff --git a/ReactCommon/fabric/attributedstring/conversions.h b/ReactCommon/fabric/attributedstring/conversions.h index 7e63dc1a431c0f..94af3cc846727e 100644 --- a/ReactCommon/fabric/attributedstring/conversions.h +++ b/ReactCommon/fabric/attributedstring/conversions.h @@ -83,8 +83,8 @@ inline void fromDynamic(const folly::dynamic &value, FontVariant &result) { } inline std::string toString(const FontVariant &fontVariant) { - std::string result; - std::string separator = ", "; + auto result = std::string {}; + auto separator = std::string {", "}; if ((int)fontVariant & (int)FontVariant::SmallCaps) { result += "small-caps" + separator; } if ((int)fontVariant & (int)FontVariant::OldstyleNums) { result += "oldstyle-nums" + separator; } if ((int)fontVariant & (int)FontVariant::LiningNums) { result += "lining-nums" + separator; } diff --git a/ReactCommon/fabric/components/image/ImageShadowNode.cpp b/ReactCommon/fabric/components/image/ImageShadowNode.cpp index 37353b47488631..c5f09a997e8f8d 100644 --- a/ReactCommon/fabric/components/image/ImageShadowNode.cpp +++ b/ReactCommon/fabric/components/image/ImageShadowNode.cpp @@ -59,7 +59,7 @@ ImageSource ImageShadowNode::getImageSource() const { auto targetImageArea = size.width * size.height * scale * scale; auto bestFit = kFloatMax; - ImageSource bestSource; + auto bestSource = ImageSource {}; for (const auto &source : sources) { auto sourceSize = source.size; diff --git a/ReactCommon/fabric/components/root/RootProps.cpp b/ReactCommon/fabric/components/root/RootProps.cpp index f3c65e38db8cc5..2b289f6dc036c8 100644 --- a/ReactCommon/fabric/components/root/RootProps.cpp +++ b/ReactCommon/fabric/components/root/RootProps.cpp @@ -14,7 +14,7 @@ namespace facebook { namespace react { static YGStyle yogaStyleFromLayoutConstraints(const LayoutConstraints &layoutConstraints) { - YGStyle yogaStyle; + auto yogaStyle = YGStyle {}; yogaStyle.minDimensions[YGDimensionWidth] = yogaStyleValueFromFloat(layoutConstraints.minimumSize.width); yogaStyle.minDimensions[YGDimensionHeight] = diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp b/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp index cdee74966e67bc..5c10c4fa219352 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp +++ b/ReactCommon/fabric/components/scrollview/ScrollViewProps.cpp @@ -47,7 +47,7 @@ ScrollViewProps::ScrollViewProps(const ScrollViewProps &sourceProps, const RawPr #pragma mark - DebugStringConvertible SharedDebugStringConvertibleList ScrollViewProps::getDebugProps() const { - ScrollViewProps defaultScrollViewProps; + auto defaultScrollViewProps = ScrollViewProps {}; return ViewProps::getDebugProps() + diff --git a/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp b/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp index 70296a183d9306..682b5fec0534d6 100644 --- a/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp +++ b/ReactCommon/fabric/components/scrollview/ScrollViewShadowNode.cpp @@ -19,7 +19,7 @@ const char ScrollViewComponentName[] = "ScrollView"; void ScrollViewShadowNode::updateLocalData() { ensureUnsealed(); - Rect contentBoundingRect; + auto contentBoundingRect = Rect {}; for (const auto &childNode : getLayoutableChildNodes()) { contentBoundingRect.unionInPlace(childNode->getLayoutMetrics().frame); } diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp b/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp index 2b3a1e9c79b182..b66cd3d5b8e681 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp +++ b/ReactCommon/fabric/components/text/basetext/BaseTextProps.cpp @@ -16,7 +16,7 @@ namespace facebook { namespace react { static TextAttributes convertRawProp(const RawProps &rawProps, const TextAttributes defaultTextAttributes) { - TextAttributes textAttributes; + auto textAttributes = TextAttributes {}; // Color textAttributes.foregroundColor = convertRawProp(rawProps, "color", defaultTextAttributes.foregroundColor); diff --git a/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp b/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp index f6832a3d81e129..992f83fd1422d5 100644 --- a/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp +++ b/ReactCommon/fabric/components/text/basetext/BaseTextShadowNode.cpp @@ -20,13 +20,13 @@ AttributedString BaseTextShadowNode::getAttributedString( const TextAttributes &textAttributes, const SharedShadowNode &parentNode ) const { - AttributedString attributedString; + auto attributedString = AttributedString {}; for (const auto &childNode : parentNode->getChildren()) { // RawShadowNode auto rawTextShadowNode = std::dynamic_pointer_cast(childNode); if (rawTextShadowNode) { - AttributedString::Fragment fragment; + auto fragment = AttributedString::Fragment {}; fragment.string = rawTextShadowNode->getProps()->text; fragment.textAttributes = textAttributes; fragment.parentShadowNode = parentNode; @@ -37,14 +37,14 @@ AttributedString BaseTextShadowNode::getAttributedString( // TextShadowNode auto textShadowNode = std::dynamic_pointer_cast(childNode); if (textShadowNode) { - TextAttributes localTextAttributes = textAttributes; + auto localTextAttributes = textAttributes; localTextAttributes.apply(textShadowNode->getProps()->textAttributes); attributedString.appendAttributedString(textShadowNode->getAttributedString(localTextAttributes, textShadowNode)); continue; } // Any other kind of ShadowNode - AttributedString::Fragment fragment; + auto fragment = AttributedString::Fragment {}; fragment.shadowNode = childNode; fragment.textAttributes = textAttributes; attributedString.appendFragment(fragment); diff --git a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp b/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp index ca4ff847c05ea3..7996cc3838b070 100644 --- a/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp +++ b/ReactCommon/fabric/components/text/paragraph/ParagraphProps.cpp @@ -15,7 +15,7 @@ namespace facebook { namespace react { static ParagraphAttributes convertRawProp(const RawProps &rawProps, const ParagraphAttributes &defaultParagraphAttributes) { - ParagraphAttributes paragraphAttributes; + auto paragraphAttributes = ParagraphAttributes {}; paragraphAttributes.maximumNumberOfLines = convertRawProp(rawProps, "numberOfLines", defaultParagraphAttributes.maximumNumberOfLines); paragraphAttributes.ellipsizeMode = convertRawProp(rawProps, "ellipsizeMode", defaultParagraphAttributes.ellipsizeMode); diff --git a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h b/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h index ad908f54541de1..ddd419c7396128 100644 --- a/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h +++ b/ReactCommon/fabric/components/view/ConcreteViewShadowNode.h @@ -116,7 +116,7 @@ class ConcreteViewShadowNode: #pragma mark - DebugStringConvertible SharedDebugStringConvertibleList getDebugProps() const override { - SharedDebugStringConvertibleList list = {}; + auto list = SharedDebugStringConvertibleList {}; auto basePropsList = ShadowNode::getDebugProps(); std::move(basePropsList.begin(), basePropsList.end(), std::back_inserter(list)); diff --git a/ReactCommon/fabric/components/view/conversions.h b/ReactCommon/fabric/components/view/conversions.h index 1625e03f406e64..22f15a8b340ec7 100644 --- a/ReactCommon/fabric/components/view/conversions.h +++ b/ReactCommon/fabric/components/view/conversions.h @@ -72,9 +72,8 @@ inline folly::Optional optionalFloatFromYogaValue(const YGValue &value, f } inline LayoutMetrics layoutMetricsFromYogaNode(YGNode &yogaNode) { - LayoutMetrics layoutMetrics; - - YGLayout layout = yogaNode.getLayout(); + auto layoutMetrics = LayoutMetrics {}; + auto layout = yogaNode.getLayout(); layoutMetrics.frame = Rect { Point { @@ -227,7 +226,7 @@ inline void fromDynamic(const folly::dynamic &value, YGFloatOptional &result) { inline void fromDynamic(const folly::dynamic &value, Transform &result) { assert(value.isArray()); - Transform transformMatrix; + auto transformMatrix = Transform {}; for (const auto &tranformConfiguration : value) { assert(tranformConfiguration.isObject()); auto pair = *tranformConfiguration.items().begin(); @@ -237,7 +236,7 @@ inline void fromDynamic(const folly::dynamic &value, Transform &result) { if (operation == "matrix") { assert(parameters.isArray()); assert(parameters.size() == transformMatrix.matrix.size()); - int i = 0; + auto i = 0; for (auto item : parameters) { transformMatrix.matrix[i++] = (Float)item.asDouble(); } @@ -407,10 +406,10 @@ inline std::string toString(const std::array &value) { {"left", "top", "right", "bottom", "start", "end", "horizontal", "vertical", "all"} }; - std::string result; - std::string separator = ", "; + auto result = std::string {}; + auto separator = std::string {", "}; - for (int i = 0; i < YGEdgeCount; i++) { + for (auto i = 0; i < YGEdgeCount; i++) { if (value[i].unit == YGUnitUndefined) { continue; } diff --git a/ReactCommon/fabric/components/view/primitives.h b/ReactCommon/fabric/components/view/primitives.h index 0a540d766b6e8f..a20e52b0b887f8 100644 --- a/ReactCommon/fabric/components/view/primitives.h +++ b/ReactCommon/fabric/components/view/primitives.h @@ -24,18 +24,17 @@ struct Transform { }}; static Transform Identity() { - Transform transform; - return transform; + return {}; } static Transform Perspective(const Float &perspective) { - Transform transform; + auto transform = Transform {}; transform.matrix[11] = -1.0 / perspective; return transform; } static Transform Scale(const Float &factorX, const Float &factorY, const Float &factorZ) { - Transform transform; + auto transform = Transform {}; transform.matrix[0] = factorX; transform.matrix[5] = factorY; transform.matrix[10] = factorZ; @@ -43,7 +42,7 @@ struct Transform { } static Transform Translate(const Float &x, const Float &y, const Float &z) { - Transform transform; + auto transform = Transform {}; transform.matrix[12] = x; transform.matrix[13] = y; transform.matrix[14] = z; @@ -51,14 +50,14 @@ struct Transform { } static Transform Skew(const Float &x, const Float &y) { - Transform transform; + auto transform = Transform {}; transform.matrix[4] = std::tan(x); transform.matrix[1] = std::tan(y); return transform; } static Transform RotateX(const Float &radians) { - Transform transform; + auto transform = Transform {}; transform.matrix[5] = std::cos(radians); transform.matrix[6] = std::sin(radians); transform.matrix[9] = -std::sin(radians); @@ -67,7 +66,7 @@ struct Transform { } static Transform RotateY(const Float &radians) { - Transform transform; + auto transform = Transform {}; transform.matrix[0] = std::cos(radians); transform.matrix[2] = -std::sin(radians); transform.matrix[8] = std::sin(radians); @@ -76,7 +75,7 @@ struct Transform { } static Transform RotateZ(const Float &radians) { - Transform transform; + auto transform = Transform {}; transform.matrix[0] = std::cos(radians); transform.matrix[1] = std::sin(radians); transform.matrix[4] = -std::sin(radians); @@ -85,7 +84,7 @@ struct Transform { } static Transform Rotate(const Float &x, const Float &y, const Float &z) { - Transform transform; + auto transform = Transform {}; if (x != 0) { transform = transform * Transform::RotateX(x); } if (y != 0) { transform = transform * Transform::RotateY(y); } if (z != 0) { transform = transform * Transform::RotateZ(z); } @@ -93,7 +92,7 @@ struct Transform { } bool operator ==(const Transform& rhs) const { - for (int i = 0; i < 16; i++) { + for (auto i = 0; i < 16; i++) { if (matrix[i] != rhs.matrix[i]) { return false; } @@ -110,15 +109,15 @@ struct Transform { return rhs; } - const Transform &lhs = *this; - Transform result; + const auto &lhs = *this; + auto result = Transform {}; - Float lhs00 = lhs.matrix[0], lhs01 = lhs.matrix[1], lhs02 = lhs.matrix[2], lhs03 = lhs.matrix[3], + auto lhs00 = lhs.matrix[0], lhs01 = lhs.matrix[1], lhs02 = lhs.matrix[2], lhs03 = lhs.matrix[3], lhs10 = lhs.matrix[4], lhs11 = lhs.matrix[5], lhs12 = lhs.matrix[6], lhs13 = lhs.matrix[7], lhs20 = lhs.matrix[8], lhs21 = lhs.matrix[9], lhs22 = lhs.matrix[10], lhs23 = lhs.matrix[11], lhs30 = lhs.matrix[12], lhs31 = lhs.matrix[13], lhs32 = lhs.matrix[14], lhs33 = lhs.matrix[15]; - Float rhs0 = rhs.matrix[0], rhs1 = rhs.matrix[1], rhs2 = rhs.matrix[2], rhs3 = rhs.matrix[3]; + auto rhs0 = rhs.matrix[0], rhs1 = rhs.matrix[1], rhs2 = rhs.matrix[2], rhs3 = rhs.matrix[3]; result.matrix[0] = rhs0 * lhs00 + rhs1 * lhs10 + rhs2 * lhs20 + rhs3 * lhs30; result.matrix[1] = rhs0 * lhs01 + rhs1 * lhs11 + rhs2 * lhs21 + rhs3 * lhs31; result.matrix[2] = rhs0 * lhs02 + rhs1 * lhs12 + rhs2 * lhs22 + rhs3 * lhs32; diff --git a/ReactCommon/fabric/components/view/propsConversions.h b/ReactCommon/fabric/components/view/propsConversions.h index da1b7e1fd2d543..d75c9474c02110 100644 --- a/ReactCommon/fabric/components/view/propsConversions.h +++ b/ReactCommon/fabric/components/view/propsConversions.h @@ -20,7 +20,7 @@ static inline std::array convertRawProp( const std::array &sourceValue, const std::array &defaultValue ) { - std::array dimentions = defaultValue; + auto dimentions = defaultValue; dimentions[YGDimensionWidth] = convertRawProp(rawProps, widthName, sourceValue[YGDimensionWidth], defaultValue[YGDimensionWidth]); dimentions[YGDimensionHeight] = convertRawProp(rawProps, heightName, sourceValue[YGDimensionHeight], defaultValue[YGDimensionWidth]); return dimentions; @@ -33,7 +33,7 @@ static inline std::array convertRawProp( const std::array &sourceValue, const std::array &defaultValue ) { - std::array result = defaultValue; + auto result = defaultValue; result[YGEdgeLeft] = convertRawProp(rawProps, prefix + "Left" + suffix, sourceValue[YGEdgeLeft], defaultValue[YGEdgeLeft]); result[YGEdgeTop] = convertRawProp(rawProps, prefix + "Top" + suffix, sourceValue[YGEdgeTop], defaultValue[YGEdgeTop]); result[YGEdgeRight] = convertRawProp(rawProps, prefix + "Right" + suffix, sourceValue[YGEdgeRight], defaultValue[YGEdgeRight]); @@ -51,7 +51,7 @@ static inline std::array convertRawProp( const std::array &sourceValue, const std::array &defaultValue ) { - std::array result = defaultValue; + auto result = defaultValue; result[YGEdgeLeft] = convertRawProp(rawProps, "left", sourceValue[YGEdgeLeft], defaultValue[YGEdgeLeft]); result[YGEdgeTop] = convertRawProp(rawProps, "top", sourceValue[YGEdgeTop], defaultValue[YGEdgeTop]); result[YGEdgeRight] = convertRawProp(rawProps, "right", sourceValue[YGEdgeRight], defaultValue[YGEdgeRight]); @@ -62,7 +62,7 @@ static inline std::array convertRawProp( } static inline YGStyle convertRawProp(const RawProps &rawProps, const YGStyle &sourceValue) { - YGStyle yogaStyle; + auto yogaStyle = YGStyle {}; yogaStyle.direction = convertRawProp(rawProps, "direction", sourceValue.direction, yogaStyle.direction); yogaStyle.flexDirection = convertRawProp(rawProps, "flexDirection", sourceValue.flexDirection, yogaStyle.flexDirection); yogaStyle.justifyContent = convertRawProp(rawProps, "justifyContent", sourceValue.justifyContent, yogaStyle.justifyContent); diff --git a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp b/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp index 165c7195cbe0cb..0c633d13f35830 100644 --- a/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp +++ b/ReactCommon/fabric/components/view/yoga/YogaStylableProps.cpp @@ -28,7 +28,7 @@ YogaStylableProps::YogaStylableProps(const YogaStylableProps &sourceProps, const #pragma mark - DebugStringConvertible SharedDebugStringConvertibleList YogaStylableProps::getDebugProps() const { - YGStyle defaultYogaStyle; + auto defaultYogaStyle = YGStyle {}; return { debugStringConvertibleItem("direction", yogaStyle.direction, defaultYogaStyle.direction), debugStringConvertibleItem("flexDirection", yogaStyle.flexDirection, defaultYogaStyle.flexDirection), diff --git a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp index 786cd410816111..269d18ebca04e1 100644 --- a/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp +++ b/ReactCommon/fabric/core/layout/LayoutableShadowNode.cpp @@ -78,12 +78,12 @@ void LayoutableShadowNode::layout(LayoutContext layoutContext) { child->ensureUnsealed(); child->setHasNewLayout(false); - const LayoutMetrics childLayoutMetrics = child->getLayoutMetrics(); + const auto childLayoutMetrics = child->getLayoutMetrics(); if (childLayoutMetrics.displayType == DisplayType::None) { continue; } - LayoutContext childLayoutContext = LayoutContext(layoutContext); + auto childLayoutContext = LayoutContext(layoutContext); childLayoutContext.absolutePosition += childLayoutMetrics.frame.origin; child->layout(layoutContext); @@ -95,7 +95,7 @@ void LayoutableShadowNode::layoutChildren(LayoutContext layoutContext) { } SharedDebugStringConvertibleList LayoutableShadowNode::getDebugProps() const { - SharedDebugStringConvertibleList list = {}; + auto list = SharedDebugStringConvertibleList {}; if (getHasNewLayout()) { list.push_back(std::make_shared("hasNewLayout")); @@ -105,8 +105,8 @@ SharedDebugStringConvertibleList LayoutableShadowNode::getDebugProps() const { list.push_back(std::make_shared("dirty")); } - LayoutMetrics layoutMetrics = getLayoutMetrics(); - LayoutMetrics defaultLayoutMetrics = LayoutMetrics(); + auto layoutMetrics = getLayoutMetrics(); + auto defaultLayoutMetrics = LayoutMetrics(); list.push_back(std::make_shared("frame", toString(layoutMetrics.frame))); diff --git a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp index bed59f615bb45a..fbcea68149edf1 100644 --- a/ReactCommon/fabric/core/shadownode/ShadowNode.cpp +++ b/ReactCommon/fabric/core/shadownode/ShadowNode.cpp @@ -154,7 +154,7 @@ std::string ShadowNode::getDebugValue() const { } SharedDebugStringConvertibleList ShadowNode::getDebugChildren() const { - SharedDebugStringConvertibleList debugChildren = {}; + auto debugChildren = SharedDebugStringConvertibleList {}; for (auto child : *children_) { auto debugChild = std::dynamic_pointer_cast(child); diff --git a/ReactCommon/fabric/debug/DebugStringConvertible.cpp b/ReactCommon/fabric/debug/DebugStringConvertible.cpp index 08d885d9674687..9651406baa2089 100644 --- a/ReactCommon/fabric/debug/DebugStringConvertible.cpp +++ b/ReactCommon/fabric/debug/DebugStringConvertible.cpp @@ -56,13 +56,13 @@ std::string DebugStringConvertible::getDebugPropsDescription(DebugStringConverti } std::string DebugStringConvertible::getDebugDescription(DebugStringConvertibleOptions options, int depth) const { - std::string nameString = getDebugName(); - std::string valueString = getDebugValue(); - std::string childrenString = getDebugChildrenDescription(options, depth); - std::string propsString = getDebugPropsDescription(options, depth); + auto nameString = getDebugName(); + auto valueString = getDebugValue(); + auto childrenString = getDebugChildrenDescription(options, depth); + auto propsString = getDebugPropsDescription(options, depth); - std::string leading = options.format ? std::string(depth * 2, ' ') : ""; - std::string trailing = options.format ? "\n" : ""; + auto leading = options.format ? std::string(depth * 2, ' ') : std::string {""}; + auto trailing = options.format ? std::string {"\n"} : std::string {""}; return leading + "<" + nameString + (valueString.empty() ? "" : "=" + valueString) + diff --git a/ReactCommon/fabric/debug/debugStringConvertibleUtils.h b/ReactCommon/fabric/debug/debugStringConvertibleUtils.h index f0a26d0590ce16..25cc1b42cdda92 100644 --- a/ReactCommon/fabric/debug/debugStringConvertibleUtils.h +++ b/ReactCommon/fabric/debug/debugStringConvertibleUtils.h @@ -45,7 +45,7 @@ inline SharedDebugStringConvertible debugStringConvertibleItem(std::string name, } inline SharedDebugStringConvertibleList operator+(const SharedDebugStringConvertibleList &lhs, const SharedDebugStringConvertibleList &rhs) { - SharedDebugStringConvertibleList result = {}; + auto result = SharedDebugStringConvertibleList {}; std::move(lhs.begin(), lhs.end(), std::back_inserter(result)); std::move(rhs.begin(), rhs.end(), std::back_inserter(result)); return result; diff --git a/ReactCommon/fabric/events/EventEmitter.cpp b/ReactCommon/fabric/events/EventEmitter.cpp index 46d6cb064ecc4b..f3110f81a82a66 100644 --- a/ReactCommon/fabric/events/EventEmitter.cpp +++ b/ReactCommon/fabric/events/EventEmitter.cpp @@ -20,7 +20,7 @@ namespace react { * (e.g. "layout" becames "topLayout"). */ static std::string normalizeEventType(const std::string &type) { - std::string prefixedType = type; + auto prefixedType = type; prefixedType[0] = toupper(prefixedType[0]); prefixedType.insert(0, "top"); return prefixedType; @@ -51,7 +51,7 @@ void EventEmitter::dispatchEvent( folly::dynamic extendedPayload = folly::dynamic::object("target", tag_); extendedPayload.merge_patch(payload); - std::weak_ptr weakEventEmitter = shared_from_this(); + auto weakEventEmitter = std::weak_ptr {shared_from_this()}; eventDispatcher->dispatchEvent( RawEvent( diff --git a/ReactCommon/fabric/graphics/Geometry.h b/ReactCommon/fabric/graphics/Geometry.h index 6349938d5eac3b..7ab3edbd23528a 100644 --- a/ReactCommon/fabric/graphics/Geometry.h +++ b/ReactCommon/fabric/graphics/Geometry.h @@ -100,10 +100,10 @@ struct Rect { Float getMinY() const { return size.height >= 0 ? origin.y : origin.y + size.height; } void unionInPlace(const Rect &rect) { - Float x1 = std::min(getMinX(), rect.getMinX()); - Float y1 = std::min(getMinY(), rect.getMinY()); - Float x2 = std::max(getMaxX(), rect.getMaxX()); - Float y2 = std::max(getMaxY(), rect.getMaxY()); + auto x1 = std::min(getMinX(), rect.getMinX()); + auto y1 = std::min(getMinY(), rect.getMinY()); + auto x2 = std::max(getMaxX(), rect.getMaxX()); + auto y2 = std::max(getMaxY(), rect.getMaxY()); origin = {x1, y1}; size = {x2 - x1, y2 - y1}; } diff --git a/ReactCommon/fabric/graphics/conversions.h b/ReactCommon/fabric/graphics/conversions.h index 3d5cc42752890c..dbb3bb67b8b01a 100644 --- a/ReactCommon/fabric/graphics/conversions.h +++ b/ReactCommon/fabric/graphics/conversions.h @@ -24,7 +24,7 @@ inline void fromDynamic(const folly::dynamic &value, SharedColor &result) { if (value.isNumber()) { auto argb = value.asInt(); - float ratio = 256; + auto ratio = 256.f; alpha = ((argb >> 24) & 0xFF) / ratio; red = ((argb >> 16) & 0xFF) / ratio; green = ((argb >> 8) & 0xFF) / ratio; @@ -45,7 +45,7 @@ inline void fromDynamic(const folly::dynamic &value, SharedColor &result) { inline std::string toString(const SharedColor &value) { ColorComponents components = colorComponentsFromColor(value); - const float ratio = 256; + auto ratio = 256.f; return "rgba(" + folly::to(round(components.red * ratio)) + ", " + folly::to(round(components.green * ratio)) + ", " + diff --git a/ReactCommon/fabric/graphics/platform/ios/Color.cpp b/ReactCommon/fabric/graphics/platform/ios/Color.cpp index 0682a79382e428..64cb6f74989b27 100644 --- a/ReactCommon/fabric/graphics/platform/ios/Color.cpp +++ b/ReactCommon/fabric/graphics/platform/ios/Color.cpp @@ -18,7 +18,7 @@ SharedColor colorFromComponents(ColorComponents components) { components.alpha }; - CGColorRef color = CGColorCreate( + auto color = CGColorCreate( CGColorSpaceCreateDeviceRGB(), componentsArray ); @@ -32,7 +32,7 @@ ColorComponents colorComponentsFromColor(SharedColor color) { return ColorComponents {0, 0, 0, 0}; } - int numberOfComponents = CGColorGetNumberOfComponents(color.get()); + auto numberOfComponents = CGColorGetNumberOfComponents(color.get()); assert(numberOfComponents == 4); const CGFloat *components = CGColorGetComponents(color.get()); return ColorComponents {