Merge lp:~jani/unity-2d/fix_oneiric_build into lp:unity-2d/3.0

Proposed by Jani Monoses
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 555
Merged at revision: 555
Proposed branch: lp:~jani/unity-2d/fix_oneiric_build
Merge into: lp:unity-2d/3.0
Diff against target: 31 lines (+7/-11)
1 file modified
libunity-2d-private/src/unity2dpanel.cpp (+7/-11)
To merge this branch: bzr merge lp:~jani/unity-2d/fix_oneiric_build
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
Review via email: mp+59739@code.launchpad.net

Description of the change

Fixes GCC 4.6 build error by explicitly assigning to array elements. It makes the code a little more cryptic but there was no documentation before either :)
Oneiric uses 4.6 by default.

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

That looks good to me. Not tested in Oneiric, but I’ll trust you that it fixes the FTBFS there, and it compiles and works fine in Natty too.

I have one question though: does the initialization to {} guarantees that the 12 values will always be initialized to 0 ?

Revision history for this message
Jani Monoses (jani) wrote :

In my tests with and what I read about gcc extensions yet, that is initialized to the default value (0). Gcc emits a memset call for these cases.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Great, thanks for the confirmation. Good to go then!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/unity2dpanel.cpp'
2--- libunity-2d-private/src/unity2dpanel.cpp 2011-02-20 23:58:30 +0000
3+++ libunity-2d-private/src/unity2dpanel.cpp 2011-05-03 07:38:33 +0000
4@@ -62,21 +62,17 @@
5 const QRect screen = desktop->screenGeometry(q);
6 const QRect available = desktop->availableGeometry(q);
7
8- ulong struts[12];
9+ ulong struts[12] = {};
10 switch (m_edge) {
11 case Unity2dPanel::LeftEdge:
12- struts = {
13- q->width(), 0, 0, 0,
14- available.top(), available.bottom(), 0, 0,
15- 0, 0, 0, 0
16- };
17+ struts[0] = q->width();
18+ struts[4] = available.top();
19+ struts[5] = available.bottom();
20 break;
21 case Unity2dPanel::TopEdge:
22- struts = {
23- 0, 0, q->height(), 0,
24- 0, 0, 0, 0,
25- screen.left(), screen.right(), 0, 0
26- };
27+ struts[2] = q->height();
28+ struts[8] = screen.left();
29+ struts[9] = screen.right();
30 break;
31 }
32

Subscribers

People subscribed via source and target branches