From 38941ace4621013c5fe5101ac18b69acda562a28 Mon Sep 17 00:00:00 2001 From: Scott Goodson Date: Sun, 23 Apr 2017 15:17:05 -0700 Subject: [PATCH 1/2] [CGPointNull] Rename globally exported C function to avoid collisions. Some other frameworks also declare this. Let's try to minimize collisions without making the name too ugly. --- Source/Layout/ASLayout.h | 4 ++-- Source/Layout/ASLayout.mm | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Source/Layout/ASLayout.h b/Source/Layout/ASLayout.h index b592ddb13..43d0daa12 100644 --- a/Source/Layout/ASLayout.h +++ b/Source/Layout/ASLayout.h @@ -17,9 +17,9 @@ NS_ASSUME_NONNULL_BEGIN ASDISPLAYNODE_EXTERN_C_BEGIN -extern CGPoint const CGPointNull; +extern CGPoint const ASPointNull; // {NAN, NAN} -extern BOOL CGPointIsNull(CGPoint point); +extern BOOL ASPointIsNull(CGPoint point); /** * Safely calculates the layout of the given root layoutElement by guarding against nil nodes. diff --git a/Source/Layout/ASLayout.mm b/Source/Layout/ASLayout.mm index aaa569ee4..db3dba656 100644 --- a/Source/Layout/ASLayout.mm +++ b/Source/Layout/ASLayout.mm @@ -20,9 +20,9 @@ #import #import -CGPoint const CGPointNull = {NAN, NAN}; +CGPoint const ASPointNull = {NAN, NAN}; -extern BOOL CGPointIsNull(CGPoint point) +extern BOOL ASPointIsNull(CGPoint point) { return isnan(point.x) && isnan(point.y); } @@ -80,7 +80,7 @@ - (instancetype)initWithLayoutElement:(id)layoutElement if (self) { #if DEBUG for (ASLayout *sublayout in sublayouts) { - ASDisplayNodeAssert(CGPointIsNull(sublayout.position) == NO, @"Invalid position is not allowed in sublayout."); + ASDisplayNodeAssert(ASPointIsNull(sublayout.position) == NO, @"Invalid position is not allowed in sublayout."); } #endif @@ -97,7 +97,7 @@ - (instancetype)initWithLayoutElement:(id)layoutElement } _size = size; - if (CGPointIsNull(position) == NO) { + if (ASPointIsNull(position) == NO) { _position = CGPointMake(ASCeilPixelValue(position.x), ASCeilPixelValue(position.y)); } else { _position = position; From 2b269a23340dc7350e84bae359bf73dcdb582646 Mon Sep 17 00:00:00 2001 From: Michael Schneider Date: Wed, 26 Apr 2017 11:17:02 -0700 Subject: [PATCH 2/2] Fix build errors --- Source/Layout/ASLayout.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Layout/ASLayout.mm b/Source/Layout/ASLayout.mm index db3dba656..11b70d0c0 100644 --- a/Source/Layout/ASLayout.mm +++ b/Source/Layout/ASLayout.mm @@ -142,7 +142,7 @@ + (instancetype)layoutWithLayoutElement:(id)layoutElement { return [self layoutWithLayoutElement:layoutElement size:size - position:CGPointNull + position:ASPointNull sublayouts:sublayouts]; } @@ -150,7 +150,7 @@ + (instancetype)layoutWithLayoutElement:(id)layoutElement size: { return [self layoutWithLayoutElement:layoutElement size:size - position:CGPointNull + position:ASPointNull sublayouts:nil]; }