summaryrefslogtreecommitdiff
path: root/src/lib/ecore
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2019-07-10 11:39:44 -0700
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-10 21:10:23 +0200
commitfce5645d804a8971dd27542c979dd27a7aa8bc1a (patch)
treecf8c8839c5f25e58cc051fcea80b63da3ce9d11d /src/lib/ecore
parent4e4210b0f349e08cf71a71c3e4a72f65cfd2535e (diff)
efl: use eina_streq for all property operation in model to avoid crash on NULL property name.
Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9266
Diffstat (limited to 'src/lib/ecore')
-rw-r--r--src/lib/ecore/efl_composite_model.c6
-rw-r--r--src/lib/ecore/efl_filter_model.c2
-rw-r--r--src/lib/ecore/efl_loop_model.c2
-rw-r--r--src/lib/ecore/efl_select_model.c12
4 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/ecore/efl_composite_model.c b/src/lib/ecore/efl_composite_model.c
index 1cad58ae4d..17883e8cb5 100644
--- a/src/lib/ecore/efl_composite_model.c
+++ b/src/lib/ecore/efl_composite_model.c
@@ -197,7 +197,7 @@ _efl_composite_model_efl_ui_view_model_set(Eo *obj EINA_UNUSED, Efl_Composite_Mo
197 properties = efl_model_properties_get(pd->source); 197 properties = efl_model_properties_get(pd->source);
198 EINA_ITERATOR_FOREACH(properties, property) 198 EINA_ITERATOR_FOREACH(properties, property)
199 { 199 {
200 if (!strcmp(property, EFL_COMPOSITE_MODEL_CHILD_INDEX)) 200 if (eina_streq(property, EFL_COMPOSITE_MODEL_CHILD_INDEX))
201 { 201 {
202 pd->need_index = EINA_FALSE; 202 pd->need_index = EINA_FALSE;
203 break; 203 break;
@@ -216,7 +216,7 @@ static Eina_Future *
216_efl_composite_model_efl_model_property_set(Eo *obj, Efl_Composite_Model_Data *pd, 216_efl_composite_model_efl_model_property_set(Eo *obj, Efl_Composite_Model_Data *pd,
217 const char *property, Eina_Value *value) 217 const char *property, Eina_Value *value)
218{ 218{
219 if (pd->need_index && !strcmp(property, EFL_COMPOSITE_MODEL_CHILD_INDEX)) 219 if (pd->need_index && eina_streq(property, EFL_COMPOSITE_MODEL_CHILD_INDEX))
220 { 220 {
221 if (pd->set_index || !pd->source) 221 if (pd->set_index || !pd->source)
222 return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY); 222 return efl_loop_future_rejected(obj, EFL_MODEL_ERROR_READ_ONLY);
@@ -233,7 +233,7 @@ _efl_composite_model_efl_model_property_get(const Eo *obj EINA_UNUSED, Efl_Compo
233 const char *property) 233 const char *property)
234{ 234{
235 Eina_Value *try; 235 Eina_Value *try;
236 if (pd->need_index && !strcmp(property, EFL_COMPOSITE_MODEL_CHILD_INDEX)) 236 if (pd->need_index && eina_streq(property, EFL_COMPOSITE_MODEL_CHILD_INDEX))
237 { 237 {
238 if (pd->set_index) 238 if (pd->set_index)
239 return eina_value_uint_new(pd->index); 239 return eina_value_uint_new(pd->index);
diff --git a/src/lib/ecore/efl_filter_model.c b/src/lib/ecore/efl_filter_model.c
index 9f2511cfa0..8a00d82141 100644
--- a/src/lib/ecore/efl_filter_model.c
+++ b/src/lib/ecore/efl_filter_model.c
@@ -551,7 +551,7 @@ static Eina_Value *
551_efl_filter_model_efl_model_property_get(const Eo *obj, Efl_Filter_Model_Data *pd, 551_efl_filter_model_efl_model_property_get(const Eo *obj, Efl_Filter_Model_Data *pd,
552 const char *property) 552 const char *property)
553{ 553{
554 if (pd->self && !strcmp(property, EFL_COMPOSITE_MODEL_CHILD_INDEX)) 554 if (pd->self && eina_streq(property, EFL_COMPOSITE_MODEL_CHILD_INDEX))
555 { 555 {
556 return eina_value_uint64_new(pd->self->mapped); 556 return eina_value_uint64_new(pd->self->mapped);
557 } 557 }
diff --git a/src/lib/ecore/efl_loop_model.c b/src/lib/ecore/efl_loop_model.c
index 11f64a7352..d3e52a63fb 100644
--- a/src/lib/ecore/efl_loop_model.c
+++ b/src/lib/ecore/efl_loop_model.c
@@ -40,7 +40,7 @@ _propagate_future(void *data, const Efl_Event *event)
40 Efl_Loop_Model_Watcher_Data *wd = data; 40 Efl_Loop_Model_Watcher_Data *wd = data;
41 41
42 EINA_ARRAY_ITER_NEXT(ev->changed_properties, i, property, it) 42 EINA_ARRAY_ITER_NEXT(ev->changed_properties, i, property, it)
43 if (property == wd->property || !strcmp(property, wd->property)) 43 if (property == wd->property || eina_streq(property, wd->property))
44 { 44 {
45 Eina_Value *v = efl_model_property_get(wd->obj, wd->property); 45 Eina_Value *v = efl_model_property_get(wd->obj, wd->property);
46 46
diff --git a/src/lib/ecore/efl_select_model.c b/src/lib/ecore/efl_select_model.c
index 1140fbf0f3..a8e267e816 100644
--- a/src/lib/ecore/efl_select_model.c
+++ b/src/lib/ecore/efl_select_model.c
@@ -258,7 +258,7 @@ _efl_select_model_efl_model_property_set(Eo *obj,
258{ 258{
259 Eina_Value vf = EINA_VALUE_EMPTY; 259 Eina_Value vf = EINA_VALUE_EMPTY;
260 260
261 if (!strcmp("single_selection", property)) 261 if (eina_streq("single_selection", property))
262 { 262 {
263 Eina_Bool single_selection = pd->single_selection; 263 Eina_Bool single_selection = pd->single_selection;
264 Eina_Bool changed; 264 Eina_Bool changed;
@@ -275,7 +275,7 @@ _efl_select_model_efl_model_property_set(Eo *obj,
275 return efl_loop_future_resolved(obj, vf); 275 return efl_loop_future_resolved(obj, vf);
276 } 276 }
277 277
278 if (!strcmp("child.selected", property)) 278 if (eina_streq("child.selected", property))
279 { 279 {
280 unsigned long l = 0; 280 unsigned long l = 0;
281 281
@@ -288,7 +288,7 @@ _efl_select_model_efl_model_property_set(Eo *obj,
288 .free = _clear_child); 288 .free = _clear_child);
289 } 289 }
290 290
291 if (pd->parent && !strcmp("self.selected", property)) 291 if (pd->parent && eina_streq("self.selected", property))
292 { 292 {
293 Eina_Bool prevflag = EINA_FALSE, newflag = EINA_FALSE; 293 Eina_Bool prevflag = EINA_FALSE, newflag = EINA_FALSE;
294 Eina_Bool single_selection = EINA_FALSE; 294 Eina_Bool single_selection = EINA_FALSE;
@@ -364,10 +364,10 @@ _efl_select_model_efl_model_property_set(Eo *obj,
364static Eina_Value * 364static Eina_Value *
365_efl_select_model_efl_model_property_get(const Eo *obj, Efl_Select_Model_Data *pd, const char *property) 365_efl_select_model_efl_model_property_get(const Eo *obj, Efl_Select_Model_Data *pd, const char *property)
366{ 366{
367 if (!strcmp("single_selection", property)) 367 if (eina_streq("single_selection", property))
368 return eina_value_bool_new(pd->single_selection); 368 return eina_value_bool_new(pd->single_selection);
369 // Last selected child 369 // Last selected child
370 if (!strcmp("child.selected", property)) 370 if (eina_streq("child.selected", property))
371 { 371 {
372 if (pd->none) 372 if (pd->none)
373 return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE); 373 return eina_value_error_new(EFL_MODEL_ERROR_INCORRECT_VALUE);
@@ -375,7 +375,7 @@ _efl_select_model_efl_model_property_get(const Eo *obj, Efl_Select_Model_Data *p
375 return eina_value_ulong_new(pd->last); 375 return eina_value_ulong_new(pd->last);
376 } 376 }
377 // Redirect to are we ourself selected 377 // Redirect to are we ourself selected
378 if (pd->parent && !strcmp("self.selected", property)) 378 if (pd->parent && eina_streq("self.selected", property))
379 { 379 {
380 return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected"); 380 return efl_model_property_get(efl_super(obj, EFL_SELECT_MODEL_CLASS), "selected");
381 } 381 }