On Thu, 23 Dec 2010 17:15:13 +0100, Mike Blumenkrantz <m...@zentific.com> wrote:
> On Thu, 23 Dec 2010 16:50:19 +0100 > "Kim Woelders" <k...@woelders.dk> wrote: > >> On Thu, 23 Dec 2010 01:36:53 +0100, Enlightenment SVN >> <no-re...@enlightenment.org> wrote: >> >> > Log: >> > make this more portable in case the number of states changes in the >> > future, also outdent and make function params more explicit >> > >> > Author: discomfitor >> > Date: 2010-12-22 16:36:53 -0800 (Wed, 22 Dec 2010) >> > New Revision: 55727 >> > Trac: http://trac.enlightenment.org/e/changeset/55727 >> > >> > Modified: >> > trunk/e/src/bin/e_hints.c >> > >> > Modified: trunk/e/src/bin/e_hints.c >> > =================================================================== >> > --- trunk/e/src/bin/e_hints.c 2010-12-23 00:28:49 UTC (rev 55726) >> > +++ trunk/e/src/bin/e_hints.c 2010-12-23 00:36:53 UTC (rev 55727) >> > @@ -1432,18 +1432,16 @@ >> > { >> > /* Remember to update the count if we add more states! */ >> > Ecore_X_Atom state[1]; >> > - int num; >> > + int num, i; >> > memset(state, 0, sizeof(state)); >> > - num = ecore_x_window_prop_card32_get(bd->client.win, >> > E_ATOM_WINDOW_STATE, state, 1); >> > - if (num) >> > + num = ecore_x_window_prop_card32_get(bd->client.win, >> > E_ATOM_WINDOW_STATE, state, sizeof(state)); >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> >> > + if (!num) return; >> > + >> > + for (i = 0; (i < num) && (i < sizeof(state)); i++) >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> >> > { >> > - int i; >> > - for (i = 0; i < num; i++) >> > - { >> > - if (state[i] == E_ATOM_WINDOW_STATE_CENTERED) >> > - bd->client.e.state.centered = 1; >> > - } >> > + if (state[i] == E_ATOM_WINDOW_STATE_CENTERED) >> > + bd->client.e.state.centered = 1; >> > } >> > } >> > >> Just happened to notice... >> The use of sizeof(state) is wrong in the marked lines - should probably >> be >> some #define or (sizeof(state)/sizeof(state[0])) or similar. > hmm since it's just passing the size of the array (1) isn't it fine? sizeof(state) = 4. >> The use in the second line is futhermore superfluous as >> ecore_x_window_prop_card32_get should never return num > the len >> parameter >> (fourth argument). > yes, it seems obvious, but it caused a warning in clang so I stuck this > in to > prevent future runs from picking it up. IMO adding code for that reason is wrong. Isn't there some way to shut clang up when it generates bogus warnings? /Kim ------------------------------------------------------------------------------ Learn how Oracle Real Application Clusters (RAC) One Node allows customers to consolidate database storage, standardize their database environment, and, should the need arise, upgrade to a full multi-node Oracle RAC database without downtime or disruption http://p.sf.net/sfu/oracle-sfdevnl _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel