From c6b0c050710376d3cf99b7c083a7c47f1a0516c9 Mon Sep 17 00:00:00 2001 From: dooglus Date: Thu, 10 Jan 2008 13:43:43 +0000 Subject: [PATCH] Made all the assert() lines which check the valuenode sub-parameter index range the same. git-svn-id: http://svn.voria.com/code@1302 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/valuenode_atan2.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_composite.cpp | 17 +++++++-------- synfig-core/trunk/src/synfig/valuenode_cos.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_duplicate.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_dynamiclist.cpp | 6 +++++- synfig-core/trunk/src/synfig/valuenode_exp.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_gradientrotate.cpp | 12 +++++++---- synfig-core/trunk/src/synfig/valuenode_integer.cpp | 12 +++++++---- synfig-core/trunk/src/synfig/valuenode_linear.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_radialcomposite.cpp | 14 ++++++------ synfig-core/trunk/src/synfig/valuenode_range.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_reciprocal.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_reference.cpp | 25 ++++++++++++++++------ .../trunk/src/synfig/valuenode_repeat_gradient.cpp | 4 ++++ synfig-core/trunk/src/synfig/valuenode_scale.cpp | 13 +++++------ .../trunk/src/synfig/valuenode_segcalctangent.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_segcalcvertex.cpp | 12 +++++++---- synfig-core/trunk/src/synfig/valuenode_sine.cpp | 12 +++++++---- synfig-core/trunk/src/synfig/valuenode_stripes.cpp | 4 ++++ .../trunk/src/synfig/valuenode_subtract.cpp | 12 +++++++---- synfig-core/trunk/src/synfig/valuenode_switch.cpp | 4 ++++ .../trunk/src/synfig/valuenode_timedswap.cpp | 12 +++++++---- .../trunk/src/synfig/valuenode_timeloop.cpp | 12 +++++++---- synfig-core/trunk/src/synfig/valuenode_twotone.cpp | 12 +++++++---- 24 files changed, 186 insertions(+), 93 deletions(-) diff --git a/synfig-core/trunk/src/synfig/valuenode_atan2.cpp b/synfig-core/trunk/src/synfig/valuenode_atan2.cpp index b4d2b56..4425539 100644 --- a/synfig-core/trunk/src/synfig/valuenode_atan2.cpp +++ b/synfig-core/trunk/src/synfig/valuenode_atan2.cpp @@ -112,7 +112,8 @@ ValueNode_Atan2::check_type(ValueBase::Type type) bool ValueNode_Atan2::set_link_vfunc(int i,ValueNode::Handle x) { - assert(i==0 || i==1); + assert(i>=0 && i=0 && i=0 && i=0 && i=0); - assert(i<6); + assert(i>=0 && iget_type()==ValueBase(Real()).get_type() || PlaceholderValueNode::Handle::cast_dynamic(x)) { components[i]=x; @@ -205,7 +203,6 @@ ValueNode_Composite::set_link_vfunc(int i,ValueNode::Handle x) break; case ValueBase::TYPE_COLOR: - assert(i<4); if(x->get_type()==ValueBase(Real()).get_type() || PlaceholderValueNode::Handle::cast_dynamic(x)) { components[i]=x; @@ -214,7 +211,6 @@ ValueNode_Composite::set_link_vfunc(int i,ValueNode::Handle x) break; case ValueBase::TYPE_SEGMENT: - assert(i<4); if(x->get_type()==ValueBase(Point()).get_type() || PlaceholderValueNode::Handle::cast_dynamic(x)) { components[i]=x; @@ -223,7 +219,6 @@ ValueNode_Composite::set_link_vfunc(int i,ValueNode::Handle x) break; case ValueBase::TYPE_BLINEPOINT: - assert(i<6); if((i==0 || i==4 || i==5) && x->get_type()==ValueBase(Point()).get_type()) { components[i]=x; @@ -250,14 +245,16 @@ ValueNode_Composite::set_link_vfunc(int i,ValueNode::Handle x) ValueNode::LooseHandle ValueNode_Composite::get_link_vfunc(int i)const { - assert(i>=0 && i<6); + assert(i>=0 && i=0 && i<6); + assert(i>=0 && i=0 && i<5); + assert(i>=0 && i=0 && i=0 && i=0 && i=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i=0); + if((unsigned)i>=list.size()) return false; if(x->get_type()!=container_type) @@ -633,6 +634,7 @@ ValueNode::LooseHandle ValueNode_DynamicList::get_link_vfunc(int i)const { assert(i>=0); + if((unsigned)i>=list.size()) return 0; return list[i].value_node; @@ -647,7 +649,8 @@ ValueNode_DynamicList::link_count()const String ValueNode_DynamicList::link_local_name(int i)const { - assert(i>=0 && (unsigned)i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<2); + assert(i>=0 && i=0 && i<2); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i=0 && i=0 && i=0 && i=0 && i=0); - assert(i<6); + assert(i>=0 && iget_type()!=ValueBase::TYPE_REAL) return false; if(i==1 && x->get_type()!=ValueBase::TYPE_ANGLE) @@ -163,7 +161,6 @@ ValueNode_RadialComposite::set_link_vfunc(int i,ValueNode::Handle x) break; case ValueBase::TYPE_COLOR: - assert(i<4); if((i==0 || i==1 || i==3) && x->get_type()!=ValueBase::TYPE_REAL) return false; if((i==2) && x->get_type()!=ValueBase::TYPE_ANGLE) @@ -182,14 +179,16 @@ ValueNode_RadialComposite::set_link_vfunc(int i,ValueNode::Handle x) ValueNode::LooseHandle ValueNode_RadialComposite::get_link_vfunc(int i)const { - assert(i>=0 && i<6); + assert(i>=0 && i=0 && i<6); + assert(i>=0 && i=0 && i<5); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i=0 && iget_type()!=get_type() && !PlaceholderValueNode::Handle::cast_dynamic(x)) return false; link_=x; @@ -91,7 +92,8 @@ ValueNode_Reference::set_link_vfunc(int i,ValueNode::Handle x) ValueNode::LooseHandle ValueNode_Reference::get_link_vfunc(int i)const { - assert(i==0); + assert(i>=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i -#include #include "color.h" #include "vector.h" #include "time.h" @@ -193,8 +192,7 @@ synfig::ValueNode_Scale::operator()(Time t)const bool ValueNode_Scale::set_link_vfunc(int i,ValueNode::Handle x) { - if(!(i==0 || i==1)) - return false; + assert(i>=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i=0 && i=0 && i=0 && i=0 && i<4); + assert(i>=0 && i=0 && i<4); + assert(i>=0 && i=0 && i<4); + assert(i>=0 && i=0 && i<4); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i= 0 && i < link_count()); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<3); + assert(i>=0 && i=0 && i<2); + assert(i>=0 && i=0 && i<2); + assert(i>=0 && i