From: tasn Date: Tue, 7 Feb 2012 13:17:13 +0000 (+0000) Subject: Eina Model: Fix wrong error checking in the method resolve functions. X-Git-Tag: 2.0_alpha~33^2~63 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe0c208054f8ccdcaaade92cd792abb37a818d9d;p=framework%2Fuifw%2Feina.git Eina Model: Fix wrong error checking in the method resolve functions. This enables resolving method foo... struct _My_Object_Type { Eina_Model_Type parent; void (*foo)(Eina_Model *, int); ... } git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@67732 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- diff --git a/src/lib/eina_model.c b/src/lib/eina_model.c index 0a72d4d..96d11a5 100644 --- a/src/lib/eina_model.c +++ b/src/lib/eina_model.c @@ -4678,7 +4678,7 @@ eina_model_method_resolve(const Eina_Model *model, unsigned int offset) const Eina_Model_Description *desc; EINA_MODEL_INSTANCE_CHECK_VAL(model, NULL); - EINA_SAFETY_ON_FALSE_RETURN_VAL(offset > sizeof(Eina_Model_Type), NULL); + EINA_SAFETY_ON_FALSE_RETURN_VAL(offset >= sizeof(Eina_Model_Type), NULL); EINA_SAFETY_ON_FALSE_RETURN_VAL(offset % sizeof(void *) == 0, NULL); desc = model->desc; @@ -4696,7 +4696,7 @@ eina_model_type_method_resolve(const Eina_Model_Type *type, const Eina_Model *mo const Eina_Model_Description *desc; EINA_MODEL_TYPE_INSTANCE_CHECK_VAL(type, model, NULL); - EINA_SAFETY_ON_FALSE_RETURN_VAL(offset > sizeof(Eina_Model_Type), NULL); + EINA_SAFETY_ON_FALSE_RETURN_VAL(offset >= sizeof(Eina_Model_Type), NULL); EINA_SAFETY_ON_FALSE_RETURN_VAL(offset % sizeof(void *) == 0, NULL); desc = model->desc; @@ -4833,7 +4833,7 @@ EAPI const void * eina_model_interface_method_resolve(const Eina_Model_Interface *iface, const Eina_Model *model, unsigned int offset) { EINA_MODEL_INTERFACE_IMPLEMENTED_CHECK_VAL(iface, model, NULL); - EINA_SAFETY_ON_FALSE_RETURN_VAL(offset > sizeof(Eina_Model_Interface), NULL); + EINA_SAFETY_ON_FALSE_RETURN_VAL(offset >= sizeof(Eina_Model_Interface), NULL); EINA_SAFETY_ON_FALSE_RETURN_VAL(offset % sizeof(void *) == 0, NULL); return _eina_model_interface_find_offset(iface, offset); }