Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breaking: size_t indices #1366

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/YGBenchmark.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static void __printBenchmarkResult(
}

static YGSize _measure(
YGNodeRef node,
YGNodeConstRef node,
float width,
YGMeasureMode widthMode,
float height,
Expand Down
14 changes: 7 additions & 7 deletions java/jni/YGJNIVanilla.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace facebook::yoga;
using namespace facebook::yoga::vanillajni;

static inline ScopedLocalRef<jobject> YGNodeJobject(
YGNodeRef node,
YGNodeConstRef node,
void* layoutContext) {
return reinterpret_cast<PtrJNodeMapVanilla*>(layoutContext)->ref(node);
}
Expand Down Expand Up @@ -138,8 +138,8 @@ static jlong jni_YGNodeNewWithConfigJNI(
}

static int YGJNILogFunc(
const YGConfigRef config,
const YGNodeRef /*node*/,
const YGConfigConstRef config,
const YGNodeConstRef /*node*/,
YGLogLevel level,
void* /*layoutContext*/,
const char* format,
Expand Down Expand Up @@ -362,7 +362,7 @@ static void YGTransferLayoutOutputsRecursive(

YGNodeSetHasNewLayout(root, false);

for (uint32_t i = 0; i < YGNodeGetChildCount(root); i++) {
for (size_t i = 0; i < YGNodeGetChildCount(root); i++) {
YGTransferLayoutOutputsRecursive(
env, thiz, YGNodeGetChild(root, i), layoutContext);
}
Expand Down Expand Up @@ -639,7 +639,7 @@ static void jni_YGNodeStyleSetBorderJNI(
yogaNodeRef, static_cast<YGEdge>(edge), static_cast<float>(border));
}

static void YGTransferLayoutDirection(YGNodeRef node, jobject javaNode) {
static void YGTransferLayoutDirection(YGNodeConstRef node, jobject javaNode) {
// Don't change this field name without changing the name of the field in
// Database.java
JNIEnv* env = getCurrentEnv();
Expand All @@ -655,7 +655,7 @@ static void YGTransferLayoutDirection(YGNodeRef node, jobject javaNode) {
}

static YGSize YGJNIMeasureFunc(
YGNodeRef node,
YGNodeConstRef node,
float width,
YGMeasureMode widthMode,
float height,
Expand Down Expand Up @@ -700,7 +700,7 @@ static void jni_YGNodeSetHasMeasureFuncJNI(
}

static float YGJNIBaselineFunc(
YGNodeRef node,
YGNodeConstRef node,
float width,
float height,
void* layoutContext) {
Expand Down
4 changes: 2 additions & 2 deletions javascript/src/Node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "./Config.h"

static YGSize globalMeasureFunc(
YGNodeRef nodeRef,
YGNodeConstRef nodeRef,
float width,
YGMeasureMode widthMode,
float height,
Expand All @@ -29,7 +29,7 @@ static YGSize globalMeasureFunc(
return ygSize;
}

static void globalDirtiedFunc(YGNodeRef nodeRef) {
static void globalDirtiedFunc(YGNodeConstRef nodeRef) {
Node const& node = *reinterpret_cast<Node const*>(YGNodeGetContext(nodeRef));

node.callDirtiedFunc();
Expand Down
5 changes: 3 additions & 2 deletions tests/EventsTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ TEST_F(EventTest, layout_events_has_max_measure_cache) {
TEST_F(EventTest, measure_functions_get_wrapped) {
auto root = YGNodeNew();
YGNodeSetMeasureFunc(
root, [](YGNodeRef, float, YGMeasureMode, float, YGMeasureMode) {
root, [](YGNodeConstRef, float, YGMeasureMode, float, YGMeasureMode) {
return YGSize{};
});

Expand All @@ -267,7 +267,8 @@ TEST_F(EventTest, baseline_functions_get_wrapped) {
auto child = YGNodeNew();
YGNodeInsertChild(root, child, 0);

YGNodeSetBaselineFunc(child, [](YGNodeRef, float, float) { return 0.0f; });
YGNodeSetBaselineFunc(
child, [](YGNodeConstRef, float, float) { return 0.0f; });
YGNodeStyleSetFlexDirection(root, YGFlexDirectionRow);
YGNodeStyleSetAlignItems(root, YGAlignBaseline);

Expand Down
6 changes: 3 additions & 3 deletions tests/YGAlignBaselineTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#include <yoga/Yoga.h>

static float _baselineFunc(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
const float /*width*/,
const float height) {
return height / 2;
}

static YGSize _measure1(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
float /*width*/,
YGMeasureMode /*widthMode*/,
float /*height*/,
Expand All @@ -25,7 +25,7 @@ static YGSize _measure1(
}

static YGSize _measure2(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
float /*width*/,
YGMeasureMode /*widthMode*/,
float /*height*/,
Expand Down
2 changes: 1 addition & 1 deletion tests/YGAspectRatioTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yoga/Yoga.h>

static YGSize _measure(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
float width,
YGMeasureMode widthMode,
float height,
Expand Down
2 changes: 1 addition & 1 deletion tests/YGBaselineFuncTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yoga/Yoga.h>

static float _baseline(
YGNodeRef node,
YGNodeConstRef node,
const float /*width*/,
const float /*height*/) {
float* baseline = (float*) YGNodeGetContext(node);
Expand Down
17 changes: 10 additions & 7 deletions tests/generated/YGConfigTest.cpp → tests/YGConfigTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* LICENSE file in the root directory of this source tree.
*/

// @Generated by gentest/gentest.rb from gentest/fixtures/YGDisplayTest.html

#include <gtest/gtest.h>
#include <yoga/Yoga.h>
#include <yoga/config/Config.h>
Expand All @@ -23,8 +21,12 @@ struct ConfigCloningTest : public ::testing::Test {
void TearDown() override;

static yoga::Node clonedNode;
static YGNodeRef cloneNode(YGNodeRef, YGNodeRef, int) { return &clonedNode; }
static YGNodeRef doNotClone(YGNodeRef, YGNodeRef, int) { return nullptr; }
static YGNodeRef cloneNode(YGNodeConstRef, YGNodeConstRef, size_t) {
return &clonedNode;
}
static YGNodeRef doNotClone(YGNodeConstRef, YGNodeConstRef, size_t) {
return nullptr;
}
};

TEST_F(ConfigCloningTest, uses_values_provided_by_cloning_callback) {
Expand All @@ -49,9 +51,10 @@ TEST_F(
}

TEST_F(ConfigCloningTest, can_clone_with_context) {
config->setCloneNodeCallback([](YGNodeRef, YGNodeRef, int, void* context) {
return (YGNodeRef) context;
});
config->setCloneNodeCallback(
[](YGNodeConstRef, YGNodeConstRef, size_t, void* context) {
return (YGNodeRef) context;
});

yoga::Node node{}, owner{}, clone{};
ASSERT_EQ(config->cloneNode(&node, &owner, 0, &clone), &clone);
Expand Down
2 changes: 1 addition & 1 deletion tests/YGDirtiedTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

using namespace facebook;

static void _dirtied(YGNodeRef node) {
static void _dirtied(YGNodeConstRef node) {
int* dirtiedCount = (int*) YGNodeGetContext(node);
(*dirtiedCount)++;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/YGDirtyMarkingTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ TEST(YogaTest, dirty_propagation_changing_benign_config) {
YGConfigRef newConfig = YGConfigNew();
YGConfigSetLogger(
newConfig,
[](const YGConfigRef, const YGNodeRef, YGLogLevel, const char*, va_list) {
[](YGConfigConstRef, YGNodeConstRef, YGLogLevel, const char*, va_list) {
return 0;
});
YGNodeSetConfig(root_child0, newConfig);
Expand Down
4 changes: 2 additions & 2 deletions tests/YGLoggerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
namespace {
char writeBuffer[4096];
int _unmanagedLogger(
const YGConfigRef /*config*/,
const YGNodeRef /*node*/,
const YGConfigConstRef /*config*/,
const YGNodeConstRef /*node*/,
YGLogLevel /*level*/,
const char* format,
va_list args) {
Expand Down
6 changes: 3 additions & 3 deletions tests/YGMeasureCacheTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yoga/Yoga.h>

static YGSize _measureMax(
YGNodeRef node,
YGNodeConstRef node,
float width,
YGMeasureMode widthMode,
float height,
Expand All @@ -24,7 +24,7 @@ static YGSize _measureMax(
}

static YGSize _measureMin(
YGNodeRef node,
YGNodeConstRef node,
float width,
YGMeasureMode widthMode,
float height,
Expand All @@ -44,7 +44,7 @@ static YGSize _measureMin(
}

static YGSize _measure_84_49(
YGNodeRef node,
YGNodeConstRef node,
float /*width*/,
YGMeasureMode /*widthMode*/,
float /*height*/,
Expand Down
2 changes: 1 addition & 1 deletion tests/YGMeasureModeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct _MeasureConstraintList {
};

static YGSize _measure(
YGNodeRef node,
YGNodeConstRef node,
float width,
YGMeasureMode widthMode,
float height,
Expand Down
10 changes: 5 additions & 5 deletions tests/YGMeasureTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <yoga/Yoga.h>

static YGSize _measure(
YGNodeRef node,
YGNodeConstRef node,
float /*width*/,
YGMeasureMode /*widthMode*/,
float /*height*/,
Expand All @@ -23,7 +23,7 @@ static YGSize _measure(
}

static YGSize _simulate_wrapping_text(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
float width,
YGMeasureMode widthMode,
float /*height*/,
Expand All @@ -36,7 +36,7 @@ static YGSize _simulate_wrapping_text(
}

static YGSize _measure_assert_negative(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
float width,
YGMeasureMode /*widthMode*/,
float height,
Expand Down Expand Up @@ -640,7 +640,7 @@ TEST(YogaTest, cant_call_negative_measure_horizontal) {
}

static YGSize _measure_90_10(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
float /*width*/,
YGMeasureMode /*widthMode*/,
float /*height*/,
Expand All @@ -650,7 +650,7 @@ static YGSize _measure_90_10(
}

static YGSize _measure_100_100(
YGNodeRef /*node*/,
YGNodeConstRef /*node*/,
float /*width*/,
YGMeasureMode /*widthMode*/,
float /*height*/,
Expand Down
Loading
Loading