From 907bbbf9650d4737259f5229f47dfac7fb924106 Mon Sep 17 00:00:00 2001 From: Marcel Hollerbach Date: Sat, 17 Sep 2016 15:17:25 +0200 Subject: [PATCH] eo: fix callback cmp Summary: as told in _eina_stringshared_key_cmp in eina_hash.c: originally we want to do this: return key1 - key2; but since they are ptrs and an int can't store the different of 2 ptrs in either 32 or 64bit (signed hasn't got enough range for the diff of 2 32bit values regardless of their type... we'd need 33bits or 65bits) So changing this to the same logic. Reviewers: tasn, raster Subscribers: cedric, jpeg Differential Revision: https://phab.enlightenment.org/D4298 --- src/lib/eo/eo.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/eo/eo.c b/src/lib/eo/eo.c index 7aa36f4..a7dc3ce 100644 --- a/src/lib/eo/eo.c +++ b/src/lib/eo/eo.c @@ -2154,5 +2154,7 @@ efl_manual_free(Eo *obj_id) EAPI int efl_callbacks_cmp(const Efl_Callback_Array_Item *a, const Efl_Callback_Array_Item *b) { - return (const unsigned char *) a->desc - (const unsigned char *) b->desc; + if (a->desc == b->desc) return 0; + else if (a->desc > b->desc) return 1; + else return -1; } -- 2.7.4