Merge lp:~sforshee/powerd/fix-warnings into lp:powerd

Proposed by Seth Forshee
Status: Merged
Approved by: Matt Fischer
Approved revision: no longer in the source branch.
Merged at revision: 64
Proposed branch: lp:~sforshee/powerd/fix-warnings
Merge into: lp:powerd
Diff against target: 219 lines (+27/-21)
9 files modified
CMakeLists.txt (+6/-4)
src/backlight.c (+2/-1)
src/display-request.c (+9/-6)
src/display.c (+2/-0)
src/log.c (+0/-1)
src/power-request.c (+2/-0)
src/powerd-object.c (+0/-1)
src/powerd.cpp (+3/-8)
src/util.c (+3/-0)
To merge this branch: bzr merge lp:~sforshee/powerd/fix-warnings
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Matt Fischer (community) Approve
Review via email: mp+172626@code.launchpad.net

Commit message

Enable -Wall for all files and fix resulting warnings

Description of the change

Enable -Wall for all files and fix resulting warnings

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~sforshee/powerd/fix-warnings updated
62. By PS Jenkins bot

Releasing 0.13+13.10.20130703-0ubuntu1 to ubuntu.

Approved by PS Jenkins bot.

63. By Matt Fischer

Cleanup upstart job by removing unneeded environment variables and have the job respawn if powerd dies unexpectedly. Simplify the sigterm handler, which also removes the duplicate calls to unown name which were causing warnings.
Finally, fix LP: #1195800 by simply exiting if we lose or never get our dbus name.
. Fixes: https://bugs.launchpad.net/bugs/1195800.

Approved by PS Jenkins bot, Seth Forshee.

Revision history for this message
Matt Fischer (mfisch) wrote :

Approve

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
lp:~sforshee/powerd/fix-warnings updated
64. By Seth Forshee

Enable -Wall for all files and fix resulting warnings.

Approved by PS Jenkins bot, Matthew Fischer.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-06-28 16:08:55 +0000
3+++ CMakeLists.txt 2013-07-10 21:26:38 +0000
4@@ -8,10 +8,12 @@
5 set(CMAKE_BUILD_TYPE "Release")
6 endif()
7
8-set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -O0 -ggdb -g")
9-set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -ggdb -g")
10-set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3")
11-set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
12+set(CMAKE_C_FLAGS "-Wall")
13+set(CMAKE_CXX_FLAGS "-Wall")
14+set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -g")
15+set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -g")
16+set(CMAKE_C_FLAGS_RELEASE "-O3")
17+set(CMAKE_CXX_FLAGS_RELEASE "-O3")
18
19 set(GDBUS_NAME powerd-dbus)
20
21
22=== modified file 'src/backlight.c'
23--- src/backlight.c 2013-06-28 19:53:24 +0000
24+++ src/backlight.c 2013-07-10 21:26:38 +0000
25@@ -31,6 +31,7 @@
26 #include <unistd.h>
27 #include <libudev.h>
28 #include <glib.h>
29+#include <glib-unix.h>
30
31 #include "powerd-internal.h"
32 #include "log.h"
33@@ -345,7 +346,7 @@
34 static void bl_destroy(gpointer data)
35 {
36 struct bl_device *bl = data;
37- free_backlight(data);
38+ free_backlight(bl);
39 }
40
41 void powerd_backlight_deinit(void)
42
43=== modified file 'src/display-request.c'
44--- src/display-request.c 2013-07-02 14:50:36 +0000
45+++ src/display-request.c 2013-07-10 21:26:38 +0000
46@@ -54,9 +54,11 @@
47
48 static void update_internal_state(void)
49 {
50- struct powerd_display_request new_state = {0,};
51+ struct powerd_display_request new_state;
52 int i;
53
54+ memset(&new_state, 0, sizeof(new_state));
55+
56 /* Default to off if no request for display to be on */
57 if (display_state_count.state[POWERD_DISPLAY_STATE_ON] > 0)
58 new_state.state = POWERD_DISPLAY_STATE_ON;
59@@ -132,9 +134,6 @@
60 static gboolean update_request(struct powerd_display_request *new_req)
61 {
62 struct display_request_internal *ireq;
63- gboolean found = FALSE;
64- unsigned int flags;
65- int i;
66
67 ireq = g_hash_table_lookup(display_request_hash, new_req->cookie);
68 if (!ireq) {
69@@ -279,11 +278,13 @@
70 GDBusMethodInvocation *invocation,
71 int state, int brightness, guint32 flags)
72 {
73- struct powerd_display_request req = {0,};
74+ struct powerd_display_request req;
75 const char *owner;
76 char ext_cookie[UUID_STR_LEN];
77 int ret;
78
79+ memset(&req, 0, sizeof(req));
80+
81 owner = g_dbus_method_invocation_get_sender(invocation);
82 powerd_debug("%s from %s: state %d brightness %d flags %#08x",
83 __func__, owner, state, brightness, flags);
84@@ -312,10 +313,12 @@
85 const gchar *ext_cookie, int state,
86 int brightness, guint32 flags)
87 {
88- struct powerd_display_request req = {0,};
89+ struct powerd_display_request req;
90 uuid_t cookie;
91 int ret;
92
93+ memset(&req, 0, sizeof(req));
94+
95 powerd_debug("%s from %s: cookie: %s state %d brightness %d flags %#08x",
96 __func__, g_dbus_method_invocation_get_sender(invocation),
97 ext_cookie, state, brightness, flags);
98
99=== modified file 'src/display.c'
100--- src/display.c 2013-07-02 13:52:40 +0000
101+++ src/display.c 2013-07-10 21:26:38 +0000
102@@ -32,6 +32,8 @@
103 #include <glib.h>
104 #include <glib-object.h>
105
106+#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
107+
108 #include "powerd.h"
109 #include "powerd-internal.h"
110 #include "log.h"
111
112=== modified file 'src/log.c'
113--- src/log.c 2013-06-10 19:41:44 +0000
114+++ src/log.c 2013-07-10 21:26:38 +0000
115@@ -39,7 +39,6 @@
116 void powerd_log_init(void)
117 {
118 char *debug_str;
119- int debug_val;
120
121 openlog("powerd", LOG_PID, LOG_DAEMON);
122
123
124=== modified file 'src/power-request.c'
125--- src/power-request.c 2013-07-02 14:50:36 +0000
126+++ src/power-request.c 2013-07-10 21:26:38 +0000
127@@ -478,6 +478,8 @@
128 case STATE_TRANSITION_COMPLETE:
129 cur_state_transition_state = process_state_complete(&delay);
130 break;
131+ default:
132+ break;
133 }
134 } while (delay == 0 &&
135 cur_state_transition_state != STATE_TRANSITION_IDLE);
136
137=== modified file 'src/powerd-object.c'
138--- src/powerd-object.c 2013-07-01 21:28:26 +0000
139+++ src/powerd-object.c 2013-07-10 21:26:38 +0000
140@@ -284,7 +284,6 @@
141 powerd_dbus_name_watch_remove(const char *owner)
142 {
143 struct DbusNameWatch *dbnw = NULL;
144- char *hash_owner = NULL;
145
146 if (strcmp(owner,"internal") == 0) {
147 return;
148
149=== modified file 'src/powerd.cpp'
150--- src/powerd.cpp 2013-07-02 13:52:40 +0000
151+++ src/powerd.cpp 2013-07-10 21:26:38 +0000
152@@ -69,9 +69,6 @@
153 static int lasttime;
154 struct tm *tm;
155
156-static gint saved_brightness = 255;
157-static gchar *brightness_path;
158-
159 /* The real default for this is set in the gschema file, but set 60 here
160 * as a sanity check */
161 static int activity_timeout = 60;
162@@ -135,12 +132,12 @@
163 g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
164 }
165
166+ return FALSE;
167 }
168
169 gboolean activity_monitor(gpointer data)
170 {
171 int new_state;
172- gboolean ret = FALSE;
173
174 g_mutex_lock(&activity_timer_mutex);
175
176@@ -212,7 +209,7 @@
177
178 int update_screen_state_worker(gpointer data)
179 {
180- unsigned long new_state = (unsigned long)data;
181+ long new_state = (long)data;
182 int ret;
183
184 if (new_state == activity_timer_screen_state)
185@@ -241,7 +238,7 @@
186
187 void update_screen_state(int new_state)
188 {
189- unsigned long data = (unsigned long)new_state;
190+ long data = new_state;
191 if (new_state < SCREEN_STATE_OFF || new_state > SCREEN_STATE_BRIGHT)
192 return;
193 powerd_run_mainloop_sync(update_screen_state_worker, (gpointer)data);
194@@ -427,8 +424,6 @@
195
196 int main(int argc, char** argv)
197 {
198- int i, ret;
199-
200 powerd_log_init();
201
202 name_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, "com.canonical.powerd",
203
204=== modified file 'src/util.c'
205--- src/util.c 2013-06-07 15:38:51 +0000
206+++ src/util.c 2013-07-10 21:26:38 +0000
207@@ -16,9 +16,12 @@
208 * along with this program. If not, see <http://www.gnu.org/licenses/>.
209 */
210
211+#include <string.h>
212 #include <uuid/uuid.h>
213 #include <glib.h>
214
215+#include "powerd-internal.h"
216+
217 struct sync_work_data {
218 GCond cond;
219 GMutex mutex;

Subscribers

People subscribed via source and target branches