Merge lp:~charlesk/indicator-datetime/lp-1064375 into lp:indicator-datetime/12.10

Proposed by Charles Kerr
Status: Merged
Approved by: Lars Karlitski
Approved revision: 190
Merged at revision: 191
Proposed branch: lp:~charlesk/indicator-datetime/lp-1064375
Merge into: lp:indicator-datetime/12.10
Diff against target: 13 lines (+1/-1)
1 file modified
src/datetime-service.c (+1/-1)
To merge this branch: bzr merge lp:~charlesk/indicator-datetime/lp-1064375
Reviewer Review Type Date Requested Status
Lars Karlitski (community) Approve
PS Jenkins bot (community) continuous-integration Approve
jenkins (community) continuous-integration Approve
Review via email: mp+128769@code.launchpad.net

Commit message

fix off-by-one error in the appointments dbusmenuitem array

To post a comment you must log in.
Revision history for this message
jenkins (martin-mrazik+qa) wrote :
review: Approve (continuous-integration)
Revision history for this message
Lars Karlitski (larsu) wrote :

This solution looks like it will be a problem the next time someone uses `i` further down in that loop. I prefer moving `i++` down to the very end of the loop or putting the looping logic inside the for statement:

  for (l = sorted_comp_instances, i = 0; l; l = l->next, i++) {
    /* ... */
  }

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Charles Kerr (charlesk) wrote :

We can't put the increment in the loop logic because there are several "continue;" cases before that line is reached where we don't want to increment the index variable.

We could move the increment to the end of the loop, but since these are the only two lines that refer to i, does it really make sense to put 120 lines of code between them?

Revision history for this message
Lars Karlitski (larsu) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/datetime-service.c'
2--- src/datetime-service.c 2012-10-05 13:26:16 +0000
3+++ src/datetime-service.c 2012-10-09 17:08:40 +0000
4@@ -833,8 +833,8 @@
5 if (i >= MAX_APPOINTMENT_MENUITEMS)
6 continue;
7
8+ item = appointments[i];
9 i++;
10- item = appointments[i];
11
12 /* Remove the icon as we might not replace it on error */
13 dbusmenu_menuitem_property_remove(item, APPOINTMENT_MENUITEM_PROP_ICON);

Subscribers

People subscribed via source and target branches