On Thu, 3 Jun 2010, Carsten Haitzler (The Rasterman) wrote:
> On Wed, 2 Jun 2010 20:24:28 +0200 (CEST) Vincent Torri <vto...@univ-evry.fr> > said: > > all other callback adds use const void *data - and that's correct as it means > the add doesnt do anything to what data points to (doesn't modify) but the > callback itself that is passed this pointer gets void * as the callback can > modiy what it points to. but it breaks the 'const' chain. In that case, there is no interest of using any const pointers (for me).I like the C++ way of using const: if you pass a const pointer, at some point, you are sure that is it never modified later. Vincent > >> >> >> On Tue, 1 Jun 2010, Enlightenment SVN wrote: >> >>> Log: >>> * edje: fix constness warning. >>> >>> Author: cedric >>> Date: 2010-06-01 07:35:19 -0700 (Tue, 01 Jun 2010) >>> New Revision: 49372 >>> >>> Modified: >>> trunk/edje/src/lib/edje_util.c >>> >>> Modified: trunk/edje/src/lib/edje_util.c >>> =================================================================== >>> --- trunk/edje/src/lib/edje_util.c 2010-06-01 14:26:09 UTC (rev >>> 49371) +++ trunk/edje/src/lib/edje_util.c 2010-06-01 14:35:19 UTC >>> (rev 49372) @@ -2136,7 +2136,7 @@ >>> cb = calloc(1, sizeof(Edje_Text_Insert_Filter_Callback)); >>> cb->part = eina_stringshare_add(part); >>> cb->func = func; >>> - cb->data = data; >>> + cb->data = (void*) data; >> >> wouldn't it be better to change >> edje_object_text_insert_filter_callback_add() so that data is just a void >> * >> >> Indeed, if data is const void *, you alert the user that data will *not* >> be modified. But the callback says that it can modify it. >> >> Imho, what is currently done is not good >> >> Also, it's (void *) and not (void*) :p >> >> Vincent >> >>> ed->text_insert_filter_callbacks = >>> eina_list_append(ed->text_insert_filter_callbacks, cb); >>> } >>> @@ -2152,7 +2152,7 @@ >>> if ((!ed) || (!part)) return; >>> EINA_LIST_FOREACH(ed->text_insert_filter_callbacks, l, cb) >>> { >>> - if ((!strcmp(cb->part, part)) && (cb->func == func)) >>> + if ((!strcmp(cb->part, part)) && (cb->func == func) && (cb->data >>> == data)) { >>> ed->text_insert_filter_callbacks = >>> eina_list_remove_list(ed->text_insert_filter_callbacks, l); >>> >>> >>> ------------------------------------------------------------------------------ >>> >>> _______________________________________________ >>> enlightenment-svn mailing list >>> enlightenment-...@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn >>> >>> >> >> ------------------------------------------------------------------------------ >> ThinkGeek and WIRED's GeekDad team up for the Ultimate >> GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the >> lucky parental unit. See the prize list and enter to win: >> http://p.sf.net/sfu/thinkgeek-promo >> _______________________________________________ >> enlightenment-devel mailing list >> enlightenment-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel >> > > > -- > ------------- Codito, ergo sum - "I code, therefore I am" -------------- > The Rasterman (Carsten Haitzler) ras...@rasterman.com > > ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel