Apply clang-format rules

Summary:
@public

Formats Yoga's source according to our clang-format configuration

Reviewed By: SidharthGuglani

Differential Revision: D13596650

fbshipit-source-id: c3722d4eafd63b7596a8b1e85c0197e9d2d6cb7d
This commit is contained in:
David Aurelio
2019-01-08 12:47:53 -08:00
committed by Facebook Github Bot
parent 5ee32fbefc
commit ab9d06abf5
16 changed files with 188 additions and 176 deletions

View File

@@ -15,7 +15,7 @@
#define NUM_REPETITIONS 1000
#define YGBENCHMARKS(BLOCK) \
int main(int argc, char const *argv[]) { \
int main(int argc, char const* argv[]) { \
clock_t __start; \
clock_t __endTimes[NUM_REPETITIONS]; \
{ BLOCK } \
@@ -25,14 +25,13 @@
#define YGBENCHMARK(NAME, BLOCK) \
__start = clock(); \
for (uint32_t __i = 0; __i < NUM_REPETITIONS; __i++) { \
{ BLOCK } \
__endTimes[__i] = clock(); \
{BLOCK} __endTimes[__i] = clock(); \
} \
__printBenchmarkResult(NAME, __start, __endTimes);
static int __compareDoubles(const void *a, const void *b) {
double arg1 = *(const double *) a;
double arg2 = *(const double *) b;
static int __compareDoubles(const void* a, const void* b) {
double arg1 = *(const double*) a;
double arg2 = *(const double*) b;
if (arg1 < arg2) {
return -1;
@@ -45,7 +44,10 @@ static int __compareDoubles(const void *a, const void *b) {
return 0;
}
static void __printBenchmarkResult(char *name, clock_t start, clock_t *endTimes) {
static void __printBenchmarkResult(
char* name,
clock_t start,
clock_t* endTimes) {
double timesInMs[NUM_REPETITIONS];
double mean = 0;
clock_t lastEnd = start;
@@ -69,12 +71,12 @@ static void __printBenchmarkResult(char *name, clock_t start, clock_t *endTimes)
printf("%s: median: %lf ms, stddev: %lf ms\n", name, median, stddev);
}
static YGSize _measure(YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
static YGSize _measure(
YGNodeRef node,
float width,
YGMeasureMode widthMode,
float height,
YGMeasureMode heightMode) {
return (YGSize){
.width = widthMode == YGMeasureModeUndefined ? 10 : width,
.height = heightMode == YGMeasureModeUndefined ? 10 : width,
@@ -82,7 +84,6 @@ static YGSize _measure(YGNodeRef node,
}
YGBENCHMARKS({
YGBENCHMARK("Stack with flex", {
const YGNodeRef root = YGNodeNew();
YGNodeStyleSetWidth(root, 100);
@@ -160,7 +161,8 @@ YGBENCHMARKS({
for (uint32_t iiii = 0; iiii < 10; iiii++) {
const YGNodeRef grandGrandGrandChild = YGNodeNew();
YGNodeStyleSetFlexDirection(grandGrandGrandChild, YGFlexDirectionRow);
YGNodeStyleSetFlexDirection(
grandGrandGrandChild, YGFlexDirectionRow);
YGNodeStyleSetFlexGrow(grandGrandGrandChild, 1);
YGNodeStyleSetWidth(grandGrandGrandChild, 10);
YGNodeStyleSetHeight(grandGrandGrandChild, 10);
@@ -173,5 +175,4 @@ YGBENCHMARKS({
YGNodeCalculateLayout(root, YGUndefined, YGUndefined, YGDirectionLTR);
YGNodeFreeRecursive(root);
});
});

View File

@@ -100,7 +100,7 @@ static void YGTransferLayoutOutputsRecursive(YGNodeRef root) {
const int PADDING = 2;
const int BORDER = 4;
int hasEdgeSetFlag = (int)obj->getFieldValue(edgeSetFlagField);
int hasEdgeSetFlag = (int) obj->getFieldValue(edgeSetFlagField);
obj->setFieldValue(widthField, YGNodeLayoutGetWidth(root));
obj->setFieldValue(heightField, YGNodeLayoutGetHeight(root));
@@ -180,8 +180,10 @@ static inline YGConfigRef _jlong2YGConfigRef(jlong addr) {
return reinterpret_cast<YGConfigRef>(static_cast<intptr_t>(addr));
}
static YGNodeRef
YGJNIOnNodeClonedFunc(YGNodeRef oldNode, YGNodeRef owner, int childIndex) {
static YGNodeRef YGJNIOnNodeClonedFunc(
YGNodeRef oldNode,
YGNodeRef owner,
int childIndex) {
auto config = oldNode->getConfig();
if (!config) {
return nullptr;
@@ -404,7 +406,7 @@ void jni_YGNodeMarkDirtyAndPropogateToDescendants(jlong nativePointer) {
}
jboolean jni_YGNodeIsDirty(jlong nativePointer) {
return (jboolean)_jlong2YGNodeRef(nativePointer)->isDirty();
return (jboolean) _jlong2YGNodeRef(nativePointer)->isDirty();
}
void jni_YGNodeSetHasMeasureFunc(jlong nativePointer, jboolean hasMeasureFunc) {
@@ -432,14 +434,14 @@ struct JYogaValue : public JavaClass<JYogaValue> {
}
};
#define YG_NODE_JNI_STYLE_PROP(javatype, type, name) \
javatype jni_YGNodeStyleGet##name(jlong nativePointer) { \
return (javatype)YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer)); \
} \
\
void jni_YGNodeStyleSet##name(jlong nativePointer, javatype value) { \
YGNodeStyleSet##name( \
_jlong2YGNodeRef(nativePointer), static_cast<type>(value)); \
#define YG_NODE_JNI_STYLE_PROP(javatype, type, name) \
javatype jni_YGNodeStyleGet##name(jlong nativePointer) { \
return (javatype) YGNodeStyleGet##name(_jlong2YGNodeRef(nativePointer)); \
} \
\
void jni_YGNodeStyleSet##name(jlong nativePointer, javatype value) { \
YGNodeStyleSet##name( \
_jlong2YGNodeRef(nativePointer), static_cast<type>(value)); \
}
#define YG_NODE_JNI_STYLE_UNIT_PROP(name) \
@@ -467,7 +469,7 @@ struct JYogaValue : public JavaClass<JYogaValue> {
#define YG_NODE_JNI_STYLE_EDGE_PROP(javatype, type, name) \
javatype jni_YGNodeStyleGet##name(jlong nativePointer, jint edge) { \
return (javatype)YGNodeStyleGet##name( \
return (javatype) YGNodeStyleGet##name( \
_jlong2YGNodeRef(nativePointer), static_cast<YGEdge>(edge)); \
} \
\

View File

@@ -42,7 +42,7 @@ namespace detail {
class CompactValue {
friend constexpr bool operator==(CompactValue, CompactValue) noexcept;
public:
public:
static constexpr auto LOWER_BOUND = 1.08420217e-19f;
static constexpr auto UPPER_BOUND_POINT = 36893485948395847680.0f;
static constexpr auto UPPER_BOUND_PERCENT = 18446742974197923840.0f;
@@ -137,7 +137,7 @@ class CompactValue {
return payload_.repr == AUTO_BITS;
}
private:
private:
union Payload {
float value;
uint32_t repr;

View File

@@ -6,8 +6,8 @@
*/
#include "YGEnums.h"
const char *YGAlignToString(const YGAlign value){
switch(value){
const char* YGAlignToString(const YGAlign value) {
switch (value) {
case YGAlignAuto:
return "auto";
case YGAlignFlexStart:
@@ -28,8 +28,8 @@ const char *YGAlignToString(const YGAlign value){
return "unknown";
}
const char *YGDimensionToString(const YGDimension value){
switch(value){
const char* YGDimensionToString(const YGDimension value) {
switch (value) {
case YGDimensionWidth:
return "width";
case YGDimensionHeight:
@@ -38,8 +38,8 @@ const char *YGDimensionToString(const YGDimension value){
return "unknown";
}
const char *YGDirectionToString(const YGDirection value){
switch(value){
const char* YGDirectionToString(const YGDirection value) {
switch (value) {
case YGDirectionInherit:
return "inherit";
case YGDirectionLTR:
@@ -50,8 +50,8 @@ const char *YGDirectionToString(const YGDirection value){
return "unknown";
}
const char *YGDisplayToString(const YGDisplay value){
switch(value){
const char* YGDisplayToString(const YGDisplay value) {
switch (value) {
case YGDisplayFlex:
return "flex";
case YGDisplayNone:
@@ -60,8 +60,8 @@ const char *YGDisplayToString(const YGDisplay value){
return "unknown";
}
const char *YGEdgeToString(const YGEdge value){
switch(value){
const char* YGEdgeToString(const YGEdge value) {
switch (value) {
case YGEdgeLeft:
return "left";
case YGEdgeTop:
@@ -84,16 +84,16 @@ const char *YGEdgeToString(const YGEdge value){
return "unknown";
}
const char *YGExperimentalFeatureToString(const YGExperimentalFeature value){
switch(value){
const char* YGExperimentalFeatureToString(const YGExperimentalFeature value) {
switch (value) {
case YGExperimentalFeatureWebFlexBasis:
return "web-flex-basis";
}
return "unknown";
}
const char *YGFlexDirectionToString(const YGFlexDirection value){
switch(value){
const char* YGFlexDirectionToString(const YGFlexDirection value) {
switch (value) {
case YGFlexDirectionColumn:
return "column";
case YGFlexDirectionColumnReverse:
@@ -106,8 +106,8 @@ const char *YGFlexDirectionToString(const YGFlexDirection value){
return "unknown";
}
const char *YGJustifyToString(const YGJustify value){
switch(value){
const char* YGJustifyToString(const YGJustify value) {
switch (value) {
case YGJustifyFlexStart:
return "flex-start";
case YGJustifyCenter:
@@ -124,8 +124,8 @@ const char *YGJustifyToString(const YGJustify value){
return "unknown";
}
const char *YGLogLevelToString(const YGLogLevel value){
switch(value){
const char* YGLogLevelToString(const YGLogLevel value) {
switch (value) {
case YGLogLevelError:
return "error";
case YGLogLevelWarn:
@@ -142,8 +142,8 @@ const char *YGLogLevelToString(const YGLogLevel value){
return "unknown";
}
const char *YGMeasureModeToString(const YGMeasureMode value){
switch(value){
const char* YGMeasureModeToString(const YGMeasureMode value) {
switch (value) {
case YGMeasureModeUndefined:
return "undefined";
case YGMeasureModeExactly:
@@ -154,8 +154,8 @@ const char *YGMeasureModeToString(const YGMeasureMode value){
return "unknown";
}
const char *YGNodeTypeToString(const YGNodeType value){
switch(value){
const char* YGNodeTypeToString(const YGNodeType value) {
switch (value) {
case YGNodeTypeDefault:
return "default";
case YGNodeTypeText:
@@ -164,8 +164,8 @@ const char *YGNodeTypeToString(const YGNodeType value){
return "unknown";
}
const char *YGOverflowToString(const YGOverflow value){
switch(value){
const char* YGOverflowToString(const YGOverflow value) {
switch (value) {
case YGOverflowVisible:
return "visible";
case YGOverflowHidden:
@@ -176,8 +176,8 @@ const char *YGOverflowToString(const YGOverflow value){
return "unknown";
}
const char *YGPositionTypeToString(const YGPositionType value){
switch(value){
const char* YGPositionTypeToString(const YGPositionType value) {
switch (value) {
case YGPositionTypeRelative:
return "relative";
case YGPositionTypeAbsolute:
@@ -186,8 +186,8 @@ const char *YGPositionTypeToString(const YGPositionType value){
return "unknown";
}
const char *YGPrintOptionsToString(const YGPrintOptions value){
switch(value){
const char* YGPrintOptionsToString(const YGPrintOptions value) {
switch (value) {
case YGPrintOptionsLayout:
return "layout";
case YGPrintOptionsStyle:
@@ -198,8 +198,8 @@ const char *YGPrintOptionsToString(const YGPrintOptions value){
return "unknown";
}
const char *YGUnitToString(const YGUnit value){
switch(value){
const char* YGUnitToString(const YGUnit value) {
switch (value) {
case YGUnitUndefined:
return "undefined";
case YGUnitPoint:
@@ -212,8 +212,8 @@ const char *YGUnitToString(const YGUnit value){
return "unknown";
}
const char *YGWrapToString(const YGWrap value){
switch(value){
const char* YGWrapToString(const YGWrap value) {
switch (value) {
case YGWrapNoWrap:
return "no-wrap";
case YGWrapWrap:

View File

@@ -11,68 +11,69 @@
YG_EXTERN_C_BEGIN
#define YGAlignCount 8
typedef YG_ENUM_BEGIN(YGAlign) {
YGAlignAuto,
YGAlignFlexStart,
YGAlignCenter,
YGAlignFlexEnd,
YGAlignStretch,
YGAlignBaseline,
YGAlignSpaceBetween,
YGAlignSpaceAround,
typedef YG_ENUM_BEGIN(YGAlign){
YGAlignAuto,
YGAlignFlexStart,
YGAlignCenter,
YGAlignFlexEnd,
YGAlignStretch,
YGAlignBaseline,
YGAlignSpaceBetween,
YGAlignSpaceAround,
} YG_ENUM_END(YGAlign);
WIN_EXPORT const char *YGAlignToString(const YGAlign value);
WIN_EXPORT const char* YGAlignToString(const YGAlign value);
#define YGDimensionCount 2
typedef YG_ENUM_BEGIN(YGDimension) {
YGDimensionWidth,
YGDimensionHeight,
typedef YG_ENUM_BEGIN(YGDimension){
YGDimensionWidth,
YGDimensionHeight,
} YG_ENUM_END(YGDimension);
WIN_EXPORT const char *YGDimensionToString(const YGDimension value);
WIN_EXPORT const char* YGDimensionToString(const YGDimension value);
#define YGDirectionCount 3
typedef YG_ENUM_BEGIN(YGDirection) {
YGDirectionInherit,
YGDirectionLTR,
YGDirectionRTL,
typedef YG_ENUM_BEGIN(YGDirection){
YGDirectionInherit,
YGDirectionLTR,
YGDirectionRTL,
} YG_ENUM_END(YGDirection);
WIN_EXPORT const char *YGDirectionToString(const YGDirection value);
WIN_EXPORT const char* YGDirectionToString(const YGDirection value);
#define YGDisplayCount 2
typedef YG_ENUM_BEGIN(YGDisplay) {
YGDisplayFlex,
YGDisplayNone,
typedef YG_ENUM_BEGIN(YGDisplay){
YGDisplayFlex,
YGDisplayNone,
} YG_ENUM_END(YGDisplay);
WIN_EXPORT const char *YGDisplayToString(const YGDisplay value);
WIN_EXPORT const char* YGDisplayToString(const YGDisplay value);
#define YGEdgeCount 9
typedef YG_ENUM_BEGIN(YGEdge) {
YGEdgeLeft,
YGEdgeTop,
YGEdgeRight,
YGEdgeBottom,
YGEdgeStart,
YGEdgeEnd,
YGEdgeHorizontal,
YGEdgeVertical,
YGEdgeAll,
typedef YG_ENUM_BEGIN(YGEdge){
YGEdgeLeft,
YGEdgeTop,
YGEdgeRight,
YGEdgeBottom,
YGEdgeStart,
YGEdgeEnd,
YGEdgeHorizontal,
YGEdgeVertical,
YGEdgeAll,
} YG_ENUM_END(YGEdge);
WIN_EXPORT const char *YGEdgeToString(const YGEdge value);
WIN_EXPORT const char* YGEdgeToString(const YGEdge value);
#define YGExperimentalFeatureCount 1
typedef YG_ENUM_BEGIN(YGExperimentalFeature) {
YGExperimentalFeatureWebFlexBasis,
typedef YG_ENUM_BEGIN(YGExperimentalFeature){
YGExperimentalFeatureWebFlexBasis,
} YG_ENUM_END(YGExperimentalFeature);
WIN_EXPORT const char *YGExperimentalFeatureToString(const YGExperimentalFeature value);
WIN_EXPORT const char* YGExperimentalFeatureToString(
const YGExperimentalFeature value);
#define YGFlexDirectionCount 4
typedef YG_ENUM_BEGIN(YGFlexDirection) {
YGFlexDirectionColumn,
YGFlexDirectionColumnReverse,
YGFlexDirectionRow,
YGFlexDirectionRowReverse,
typedef YG_ENUM_BEGIN(YGFlexDirection){
YGFlexDirectionColumn,
YGFlexDirectionColumnReverse,
YGFlexDirectionRow,
YGFlexDirectionRowReverse,
} YG_ENUM_END(YGFlexDirection);
WIN_EXPORT const char *YGFlexDirectionToString(const YGFlexDirection value);
WIN_EXPORT const char* YGFlexDirectionToString(const YGFlexDirection value);
#define YGJustifyCount 6
typedef YG_ENUM_BEGIN(YGJustify){
@@ -83,72 +84,72 @@ typedef YG_ENUM_BEGIN(YGJustify){
YGJustifySpaceAround,
YGJustifySpaceEvenly,
} YG_ENUM_END(YGJustify);
WIN_EXPORT const char *YGJustifyToString(const YGJustify value);
WIN_EXPORT const char* YGJustifyToString(const YGJustify value);
#define YGLogLevelCount 6
typedef YG_ENUM_BEGIN(YGLogLevel) {
YGLogLevelError,
YGLogLevelWarn,
YGLogLevelInfo,
YGLogLevelDebug,
YGLogLevelVerbose,
YGLogLevelFatal,
typedef YG_ENUM_BEGIN(YGLogLevel){
YGLogLevelError,
YGLogLevelWarn,
YGLogLevelInfo,
YGLogLevelDebug,
YGLogLevelVerbose,
YGLogLevelFatal,
} YG_ENUM_END(YGLogLevel);
WIN_EXPORT const char *YGLogLevelToString(const YGLogLevel value);
WIN_EXPORT const char* YGLogLevelToString(const YGLogLevel value);
#define YGMeasureModeCount 3
typedef YG_ENUM_BEGIN(YGMeasureMode) {
YGMeasureModeUndefined,
YGMeasureModeExactly,
YGMeasureModeAtMost,
typedef YG_ENUM_BEGIN(YGMeasureMode){
YGMeasureModeUndefined,
YGMeasureModeExactly,
YGMeasureModeAtMost,
} YG_ENUM_END(YGMeasureMode);
WIN_EXPORT const char *YGMeasureModeToString(const YGMeasureMode value);
WIN_EXPORT const char* YGMeasureModeToString(const YGMeasureMode value);
#define YGNodeTypeCount 2
typedef YG_ENUM_BEGIN(YGNodeType) {
YGNodeTypeDefault,
YGNodeTypeText,
typedef YG_ENUM_BEGIN(YGNodeType){
YGNodeTypeDefault,
YGNodeTypeText,
} YG_ENUM_END(YGNodeType);
WIN_EXPORT const char *YGNodeTypeToString(const YGNodeType value);
WIN_EXPORT const char* YGNodeTypeToString(const YGNodeType value);
#define YGOverflowCount 3
typedef YG_ENUM_BEGIN(YGOverflow) {
YGOverflowVisible,
YGOverflowHidden,
YGOverflowScroll,
typedef YG_ENUM_BEGIN(YGOverflow){
YGOverflowVisible,
YGOverflowHidden,
YGOverflowScroll,
} YG_ENUM_END(YGOverflow);
WIN_EXPORT const char *YGOverflowToString(const YGOverflow value);
WIN_EXPORT const char* YGOverflowToString(const YGOverflow value);
#define YGPositionTypeCount 2
typedef YG_ENUM_BEGIN(YGPositionType) {
YGPositionTypeRelative,
YGPositionTypeAbsolute,
typedef YG_ENUM_BEGIN(YGPositionType){
YGPositionTypeRelative,
YGPositionTypeAbsolute,
} YG_ENUM_END(YGPositionType);
WIN_EXPORT const char *YGPositionTypeToString(const YGPositionType value);
WIN_EXPORT const char* YGPositionTypeToString(const YGPositionType value);
#define YGPrintOptionsCount 3
typedef YG_ENUM_BEGIN(YGPrintOptions) {
YGPrintOptionsLayout = 1,
YGPrintOptionsStyle = 2,
YGPrintOptionsChildren = 4,
typedef YG_ENUM_BEGIN(YGPrintOptions){
YGPrintOptionsLayout = 1,
YGPrintOptionsStyle = 2,
YGPrintOptionsChildren = 4,
} YG_ENUM_END(YGPrintOptions);
WIN_EXPORT const char *YGPrintOptionsToString(const YGPrintOptions value);
WIN_EXPORT const char* YGPrintOptionsToString(const YGPrintOptions value);
#define YGUnitCount 4
typedef YG_ENUM_BEGIN(YGUnit) {
YGUnitUndefined,
YGUnitPoint,
YGUnitPercent,
YGUnitAuto,
typedef YG_ENUM_BEGIN(YGUnit){
YGUnitUndefined,
YGUnitPoint,
YGUnitPercent,
YGUnitAuto,
} YG_ENUM_END(YGUnit);
WIN_EXPORT const char *YGUnitToString(const YGUnit value);
WIN_EXPORT const char* YGUnitToString(const YGUnit value);
#define YGWrapCount 3
typedef YG_ENUM_BEGIN(YGWrap) {
YGWrapNoWrap,
YGWrapWrap,
YGWrapWrapReverse,
typedef YG_ENUM_BEGIN(YGWrap){
YGWrapNoWrap,
YGWrapWrap,
YGWrapWrapReverse,
} YG_ENUM_END(YGWrap);
WIN_EXPORT const char *YGWrapToString(const YGWrap value);
WIN_EXPORT const char* YGWrapToString(const YGWrap value);
YG_EXTERN_C_END

View File

@@ -11,10 +11,10 @@
#include "Yoga-internal.h"
struct YGFloatOptional {
private:
private:
float value_ = std::numeric_limits<float>::quiet_NaN();
public:
public:
explicit constexpr YGFloatOptional(float value) : value_(value) {}
constexpr YGFloatOptional() = default;

View File

@@ -28,7 +28,7 @@ struct YGLayout {
// Instead of recomputing the entire layout every single time, we
// cache some information to break early when nothing changed
uint32_t generationCount = 0;
YGDirection lastOwnerDirection = (YGDirection)-1;
YGDirection lastOwnerDirection = (YGDirection) -1;
uint32_t nextCachedMeasurementsIndex = 0;
std::array<YGCachedMeasurement, YG_MAX_CACHED_RESULT_COUNT>

View File

@@ -21,7 +21,7 @@
#endif
#ifdef WINARMDLL
#define WIN_STRUCT(type) type *
#define WIN_STRUCT(type) type*
#define WIN_STRUCT_REF(value) &value
#else
#define WIN_STRUCT(type) type
@@ -29,9 +29,9 @@
#endif
#ifdef NS_ENUM
// Cannot use NSInteger as NSInteger has a different size than int (which is the default type of a
// enum).
// Therefor when linking the Yoga C library into obj-c the header is a missmatch for the Yoga ABI.
// Cannot use NSInteger as NSInteger has a different size than int (which is the
// default type of a enum). Therefor when linking the Yoga C library into obj-c
// the header is a missmatch for the Yoga ABI.
#define YG_ENUM_BEGIN(name) NS_ENUM(int, name)
#define YG_ENUM_END(name)
#else

View File

@@ -113,7 +113,8 @@ void YGNode::setMeasureFunc(YGMeasureFunc measureFunc) {
YGAssertWithNode(
this,
children_.size() == 0,
"Cannot set measure function: Nodes with measure functions cannot have children.");
"Cannot set measure function: Nodes with measure functions cannot have "
"children.");
measure_ = measureFunc;
// TODO: t18095186 Move nodeType to opt-in function and mark appropriate
// places in Litho

View File

@@ -12,7 +12,7 @@
#include "Yoga-internal.h"
struct YGNode {
private:
private:
void* context_ = nullptr;
YGPrintFunc print_ = nullptr;
bool hasNewLayout_ : 1;
@@ -35,7 +35,7 @@ struct YGNode {
const YGFlexDirection axis,
const float axisSize) const;
public:
public:
YGNode()
: hasNewLayout_(true),
isReferenceBaseline_(false),

View File

@@ -63,15 +63,19 @@ static void appendNumberIfNotUndefined(
}
}
static void
appendNumberIfNotAuto(string& base, const string& key, const YGValue number) {
static void appendNumberIfNotAuto(
string& base,
const string& key,
const YGValue number) {
if (number.unit != YGUnitAuto) {
appendNumberIfNotUndefined(base, key, number);
}
}
static void
appendNumberIfNotZero(string& base, const string& str, const YGValue number) {
static void appendNumberIfNotZero(
string& base,
const string& str,
const YGValue number) {
if (number.unit == YGUnitAuto) {
base.append(str + ": auto; ");
} else if (!YGFloatsEqual(number.value, 0)) {

View File

@@ -18,10 +18,10 @@ constexpr YGValue kYGValueUndefined = {0, YGUnitUndefined};
constexpr YGValue kYGValueAuto = {0, YGUnitAuto};
struct YGStyle {
private:
private:
using CompactValue = facebook::yoga::detail::CompactValue;
public:
public:
using Dimensions = facebook::yoga::detail::Values<2>;
using Edges = facebook::yoga::detail::Values<YGEdgeCount>;

View File

@@ -15,7 +15,7 @@ YG_EXTERN_C_BEGIN
// Not defined in MSVC++
#ifndef NAN
static const uint32_t __nan = 0x7fc00000;
#define NAN (*(const float*)__nan)
#define NAN (*(const float*) __nan)
#endif
#define YGUndefined NAN

View File

@@ -55,8 +55,8 @@ struct YGCachedMeasurement {
YGCachedMeasurement()
: availableWidth(0),
availableHeight(0),
widthMeasureMode((YGMeasureMode)-1),
heightMeasureMode((YGMeasureMode)-1),
widthMeasureMode((YGMeasureMode) -1),
heightMeasureMode((YGMeasureMode) -1),
computedWidth(-1),
computedHeight(-1) {}
@@ -95,10 +95,10 @@ namespace detail {
template <size_t Size>
class Values {
private:
private:
std::array<CompactValue, Size> values_;
public:
public:
Values() = default;
explicit Values(const YGValue& defaultValue) noexcept {
values_.fill(defaultValue);

View File

@@ -74,7 +74,7 @@ static int YGAndroidLog(
return result;
}
#else
#define YG_UNUSED(x) (void)(x);
#define YG_UNUSED(x) (void) (x);
static int YGDefaultLog(
const YGConfigRef config,
@@ -921,7 +921,7 @@ float YGNodeStyleGetBorder(const YGNodeRef node, const YGEdge edge) {
return YGUndefined;
}
auto border = (YGValue)node->getStyle().border[edge];
auto border = (YGValue) node->getStyle().border[edge];
return border.value;
}
@@ -3745,8 +3745,8 @@ bool YGLayoutNodeInternal(
if (needToVisitNode) {
// Invalidate the cached results.
layout->nextCachedMeasurementsIndex = 0;
layout->cachedLayout.widthMeasureMode = (YGMeasureMode)-1;
layout->cachedLayout.heightMeasureMode = (YGMeasureMode)-1;
layout->cachedLayout.widthMeasureMode = (YGMeasureMode) -1;
layout->cachedLayout.heightMeasureMode = (YGMeasureMode) -1;
layout->cachedLayout.computedWidth = -1;
layout->cachedLayout.computedHeight = -1;
}

View File

@@ -358,8 +358,11 @@ WIN_EXPORT float YGNodeLayoutGetPadding(
const YGEdge edge);
WIN_EXPORT void YGConfigSetLogger(const YGConfigRef config, YGLogger logger);
WIN_EXPORT void
YGLog(const YGNodeRef node, YGLogLevel level, const char* message, ...);
WIN_EXPORT void YGLog(
const YGNodeRef node,
YGLogLevel level,
const char* message,
...);
WIN_EXPORT void YGLogWithConfig(
const YGConfigRef config,
YGLogLevel level,