Breaking: size_t indices (#1366)
Summary: Pull Request resolved: https://github.com/facebook/yoga/pull/1366 X-link: https://github.com/facebook/react-native/pull/39371 Yoga's public API exposes indices most often as `uint32_t`, with exception of clone callbacks which are `int32_t`. Yoga internally represents these indices as `size_t` when dealing with the child vector, and this is the true index. This changes the API to consistently be `size_t`. This should not be breaking for most users, but will cause breaks where: 1. Users set a clone node callback (I think this should be rare. RN uses it, but only because it relies on a separate private API). 2. Callers of `YGNodeGetChildCount()` are assigning to an int with less width than `size_t` and have strong warnings enabled. 3. Using a newer Yoga binary with older source, since we are not preserving ABI compatibility (Yoga in general does not aim to be ABI stable between major versions, only ABI safe for a given set of sources). Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D49130914 fbshipit-source-id: 6a004c160c4c50f68047b108508fd437156f5fac
This commit is contained in:
committed by
Facebook GitHub Bot
parent
26f2b28eca
commit
776065d7c7
16
yoga/Yoga.h
16
yoga/Yoga.h
@@ -9,6 +9,7 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <yoga/YGEnums.h>
|
||||
@@ -47,7 +48,7 @@ typedef int (*YGLogger)(
|
||||
typedef YGNodeRef (*YGCloneNodeFunc)(
|
||||
YGNodeConstRef oldNode,
|
||||
YGNodeConstRef owner,
|
||||
int childIndex);
|
||||
size_t childIndex);
|
||||
|
||||
// YGNode
|
||||
WIN_EXPORT YGNodeRef YGNodeNew(void);
|
||||
@@ -63,23 +64,20 @@ WIN_EXPORT void YGNodeReset(YGNodeRef node);
|
||||
WIN_EXPORT void YGNodeInsertChild(
|
||||
YGNodeRef node,
|
||||
YGNodeRef child,
|
||||
uint32_t index);
|
||||
size_t index);
|
||||
|
||||
WIN_EXPORT void YGNodeSwapChild(
|
||||
YGNodeRef node,
|
||||
YGNodeRef child,
|
||||
uint32_t index);
|
||||
WIN_EXPORT void YGNodeSwapChild(YGNodeRef node, YGNodeRef child, size_t index);
|
||||
|
||||
WIN_EXPORT void YGNodeRemoveChild(YGNodeRef node, YGNodeRef child);
|
||||
WIN_EXPORT void YGNodeRemoveAllChildren(YGNodeRef node);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetChild(YGNodeRef node, uint32_t index);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetChild(YGNodeRef node, size_t index);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetOwner(YGNodeRef node);
|
||||
WIN_EXPORT YGNodeRef YGNodeGetParent(YGNodeRef node);
|
||||
WIN_EXPORT uint32_t YGNodeGetChildCount(YGNodeConstRef node);
|
||||
WIN_EXPORT size_t YGNodeGetChildCount(YGNodeConstRef node);
|
||||
WIN_EXPORT void YGNodeSetChildren(
|
||||
YGNodeRef owner,
|
||||
const YGNodeRef* children,
|
||||
uint32_t count);
|
||||
size_t count);
|
||||
|
||||
WIN_EXPORT void YGNodeSetIsReferenceBaseline(
|
||||
YGNodeRef node,
|
||||
|
Reference in New Issue
Block a user