summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2020-09-01 14:10:21 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2020-09-01 14:12:31 +0200
commitf9ade56cf8de4f040572f368da644f2a83bdee92 (patch)
treeb220f91a8f2cacea96b93a70a48225320ac85fb7
parent9fb91f4a9fafcee5390c23440d337e0040466764 (diff)
efl_ui_focus_manager_calc: fix CID
coverity was complaining that the DIRECTION ACCESS macro might access over a negative direction. However, complement of a 2D direction is always a 2D direction. But coverity cannot detect that.
-rw-r--r--src/lib/elementary/efl_ui_focus_manager_calc.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib/elementary/efl_ui_focus_manager_calc.c b/src/lib/elementary/efl_ui_focus_manager_calc.c
index 7fb80c38c2..5b7589d95f 100644
--- a/src/lib/elementary/efl_ui_focus_manager_calc.c
+++ b/src/lib/elementary/efl_ui_focus_manager_calc.c
@@ -160,20 +160,25 @@ _manager_in_chain_set(Eo *obj, Efl_Ui_Focus_Manager_Calc_Data *pd)
160 efl_class_name_get(pd->root->focusable), root); 160 efl_class_name_get(pd->root->focusable), root);
161} 161}
162 162
163
163static void 164static void
164border_onedirection_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List *list) 165border_onedirection_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List *list)
165{ 166{
166 Node *partner; 167 Node *partner;
167 Eina_List *lnode; 168 Eina_List *lnode;
168 Border *border; 169 Border *border;
170 Efl_Ui_Focus_Direction complement;
169 171
170 EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(direction)); 172 EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(direction));
173 complement = efl_ui_focus_util_direction_complement(direction);
174 //this is basically a nop. The complement of 2D will *always* be 2D
175 EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(complement));
171 176
172 border = &DIRECTION_ACCESS(node, direction); 177 border = &DIRECTION_ACCESS(node, direction);
173 178
174 EINA_LIST_FREE(border->one_direction, partner) 179 EINA_LIST_FREE(border->one_direction, partner)
175 { 180 {
176 Border *b = &DIRECTION_ACCESS(partner, efl_ui_focus_util_direction_complement(direction)); 181 Border *b = &DIRECTION_ACCESS(partner, complement);
177 b->cleanup_nodes = eina_list_remove(b->cleanup_nodes, node); 182 b->cleanup_nodes = eina_list_remove(b->cleanup_nodes, node);
178 } 183 }
179 184
@@ -181,7 +186,7 @@ border_onedirection_set(Node *node, Efl_Ui_Focus_Direction direction, Eina_List
181 186
182 EINA_LIST_FOREACH(border->one_direction, lnode, partner) 187 EINA_LIST_FOREACH(border->one_direction, lnode, partner)
183 { 188 {
184 Border *comp_border = &DIRECTION_ACCESS(partner,efl_ui_focus_util_direction_complement(direction)); 189 Border *comp_border = &DIRECTION_ACCESS(partner, complement);
185 190
186 comp_border->cleanup_nodes = eina_list_append(comp_border->cleanup_nodes, node); 191 comp_border->cleanup_nodes = eina_list_append(comp_border->cleanup_nodes, node);
187 } 192 }
@@ -192,14 +197,18 @@ border_onedirection_cleanup(Node *node, Efl_Ui_Focus_Direction direction)
192{ 197{
193 Node *partner; 198 Node *partner;
194 Border *border; 199 Border *border;
200 Efl_Ui_Focus_Direction complement;
195 201
196 EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(direction)); 202 EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(direction));
203 complement = efl_ui_focus_util_direction_complement(direction);
204 //this is basically a nop. The complement of 2D will *always* be 2D
205 EINA_SAFETY_ON_FALSE_RETURN(DIRECTION_IS_2D(complement));
197 206
198 border = &DIRECTION_ACCESS(node, direction); 207 border = &DIRECTION_ACCESS(node, direction);
199 208
200 EINA_LIST_FREE(border->cleanup_nodes, partner) 209 EINA_LIST_FREE(border->cleanup_nodes, partner)
201 { 210 {
202 Border *b = &DIRECTION_ACCESS(partner, efl_ui_focus_util_direction_complement(direction)); 211 Border *b = &DIRECTION_ACCESS(partner, complement);
203 b->one_direction = eina_list_remove(b->one_direction, node); 212 b->one_direction = eina_list_remove(b->one_direction, node);
204 } 213 }
205} 214}