Permalink
Browse files

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 facebook/yoga#607

Differential Revision: D5677931

Pulled By: emilsjolander

fbshipit-source-id: 502da957089e4439ed956987ff8dec10bd033ba3
  • Loading branch information...
woehrl01 authored and facebook-github-bot committed Aug 23, 2017
1 parent 9c2caaa commit 95faccb13c489b1f352726cc935392810952ee28
Showing with 3 additions and 3 deletions.
  1. +2 −2 ReactCommon/yoga/yoga/Yoga.c
  2. +1 −1 ReactCommon/yoga/yoga/Yoga.h
@@ -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;
}
@@ -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);

0 comments on commit 95faccb

Please sign in to comment.