From 4185a4439309e76145477b15f23ef64505140b22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20W=C3=B6hrl?= Date: Wed, 23 Aug 2017 02:40:04 -0700 Subject: [PATCH] Fix const declaration mismatch and double/float mix Summary: This PR fixes a declaration mismatch for `YGNodeCanUseCachedMeasurement` where the last argument is declared non `const` in `.h` and `const` in `.c`. Additionally it uses explicit `float` for fraction calculation do avoid usage of `double` assignment. Closes https://github.com/facebook/yoga/pull/607 Differential Revision: D5677931 Pulled By: emilsjolander fbshipit-source-id: 502da957089e4439ed956987ff8dec10bd033ba3 --- yoga/Yoga.c | 4 ++-- yoga/Yoga.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/yoga/Yoga.c b/yoga/Yoga.c index 5410895e..15ac4586 100644 --- a/yoga/Yoga.c +++ b/yoga/Yoga.c @@ -3171,12 +3171,12 @@ float YGRoundValueToPixelGrid(const float value, scaledValue = scaledValue - fractial + 1.0; } else if (forceCeil) { // Next we check if we need to use forced rounding - scaledValue = scaledValue - fractial + 1.0; + scaledValue = scaledValue - fractial + 1.0f; } else if (forceFloor) { scaledValue = scaledValue - fractial; } else { // Finally we just round the value - scaledValue = scaledValue - fractial + (fractial >= 0.5f ? 1.0 : 0); + scaledValue = scaledValue - fractial + (fractial >= 0.5f ? 1.0f : 0.0f); } return scaledValue / pointScaleFactor; } diff --git a/yoga/Yoga.h b/yoga/Yoga.h index c3d3260d..81bbe7b3 100644 --- a/yoga/Yoga.h +++ b/yoga/Yoga.h @@ -112,7 +112,7 @@ WIN_EXPORT bool YGNodeCanUseCachedMeasurement(const YGMeasureMode widthMode, const float lastComputedHeight, const float marginRow, const float marginColumn, - YGConfigRef config); + const YGConfigRef config); WIN_EXPORT void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode);