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
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-06-28 16:08:55 +0000
+++ CMakeLists.txt 2013-07-10 21:26:38 +0000
@@ -8,10 +8,12 @@
8 set(CMAKE_BUILD_TYPE "Release")8 set(CMAKE_BUILD_TYPE "Release")
9endif()9endif()
1010
11set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -O0 -ggdb -g")11set(CMAKE_C_FLAGS "-Wall")
12set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -O0 -ggdb -g")12set(CMAKE_CXX_FLAGS "-Wall")
13set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3")13set(CMAKE_C_FLAGS_DEBUG "-O0 -ggdb -g")
14set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")14set(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb -g")
15set(CMAKE_C_FLAGS_RELEASE "-O3")
16set(CMAKE_CXX_FLAGS_RELEASE "-O3")
1517
16set(GDBUS_NAME powerd-dbus)18set(GDBUS_NAME powerd-dbus)
1719
1820
=== modified file 'src/backlight.c'
--- src/backlight.c 2013-06-28 19:53:24 +0000
+++ src/backlight.c 2013-07-10 21:26:38 +0000
@@ -31,6 +31,7 @@
31#include <unistd.h>31#include <unistd.h>
32#include <libudev.h>32#include <libudev.h>
33#include <glib.h>33#include <glib.h>
34#include <glib-unix.h>
3435
35#include "powerd-internal.h"36#include "powerd-internal.h"
36#include "log.h"37#include "log.h"
@@ -345,7 +346,7 @@
345static void bl_destroy(gpointer data)346static void bl_destroy(gpointer data)
346{347{
347 struct bl_device *bl = data;348 struct bl_device *bl = data;
348 free_backlight(data);349 free_backlight(bl);
349}350}
350351
351void powerd_backlight_deinit(void)352void powerd_backlight_deinit(void)
352353
=== modified file 'src/display-request.c'
--- src/display-request.c 2013-07-02 14:50:36 +0000
+++ src/display-request.c 2013-07-10 21:26:38 +0000
@@ -54,9 +54,11 @@
5454
55static void update_internal_state(void)55static void update_internal_state(void)
56{56{
57 struct powerd_display_request new_state = {0,};57 struct powerd_display_request new_state;
58 int i;58 int i;
5959
60 memset(&new_state, 0, sizeof(new_state));
61
60 /* Default to off if no request for display to be on */62 /* Default to off if no request for display to be on */
61 if (display_state_count.state[POWERD_DISPLAY_STATE_ON] > 0)63 if (display_state_count.state[POWERD_DISPLAY_STATE_ON] > 0)
62 new_state.state = POWERD_DISPLAY_STATE_ON;64 new_state.state = POWERD_DISPLAY_STATE_ON;
@@ -132,9 +134,6 @@
132static gboolean update_request(struct powerd_display_request *new_req)134static gboolean update_request(struct powerd_display_request *new_req)
133{135{
134 struct display_request_internal *ireq;136 struct display_request_internal *ireq;
135 gboolean found = FALSE;
136 unsigned int flags;
137 int i;
138137
139 ireq = g_hash_table_lookup(display_request_hash, new_req->cookie);138 ireq = g_hash_table_lookup(display_request_hash, new_req->cookie);
140 if (!ireq) {139 if (!ireq) {
@@ -279,11 +278,13 @@
279 GDBusMethodInvocation *invocation,278 GDBusMethodInvocation *invocation,
280 int state, int brightness, guint32 flags)279 int state, int brightness, guint32 flags)
281{280{
282 struct powerd_display_request req = {0,};281 struct powerd_display_request req;
283 const char *owner;282 const char *owner;
284 char ext_cookie[UUID_STR_LEN];283 char ext_cookie[UUID_STR_LEN];
285 int ret;284 int ret;
286285
286 memset(&req, 0, sizeof(req));
287
287 owner = g_dbus_method_invocation_get_sender(invocation);288 owner = g_dbus_method_invocation_get_sender(invocation);
288 powerd_debug("%s from %s: state %d brightness %d flags %#08x",289 powerd_debug("%s from %s: state %d brightness %d flags %#08x",
289 __func__, owner, state, brightness, flags);290 __func__, owner, state, brightness, flags);
@@ -312,10 +313,12 @@
312 const gchar *ext_cookie, int state,313 const gchar *ext_cookie, int state,
313 int brightness, guint32 flags)314 int brightness, guint32 flags)
314{315{
315 struct powerd_display_request req = {0,};316 struct powerd_display_request req;
316 uuid_t cookie;317 uuid_t cookie;
317 int ret;318 int ret;
318319
320 memset(&req, 0, sizeof(req));
321
319 powerd_debug("%s from %s: cookie: %s state %d brightness %d flags %#08x",322 powerd_debug("%s from %s: cookie: %s state %d brightness %d flags %#08x",
320 __func__, g_dbus_method_invocation_get_sender(invocation),323 __func__, g_dbus_method_invocation_get_sender(invocation),
321 ext_cookie, state, brightness, flags);324 ext_cookie, state, brightness, flags);
322325
=== modified file 'src/display.c'
--- src/display.c 2013-07-02 13:52:40 +0000
+++ src/display.c 2013-07-10 21:26:38 +0000
@@ -32,6 +32,8 @@
32#include <glib.h>32#include <glib.h>
33#include <glib-object.h>33#include <glib-object.h>
3434
35#include <hybris/surface_flinger/surface_flinger_compatibility_layer.h>
36
35#include "powerd.h"37#include "powerd.h"
36#include "powerd-internal.h"38#include "powerd-internal.h"
37#include "log.h"39#include "log.h"
3840
=== modified file 'src/log.c'
--- src/log.c 2013-06-10 19:41:44 +0000
+++ src/log.c 2013-07-10 21:26:38 +0000
@@ -39,7 +39,6 @@
39void powerd_log_init(void)39void powerd_log_init(void)
40{40{
41 char *debug_str;41 char *debug_str;
42 int debug_val;
4342
44 openlog("powerd", LOG_PID, LOG_DAEMON);43 openlog("powerd", LOG_PID, LOG_DAEMON);
4544
4645
=== modified file 'src/power-request.c'
--- src/power-request.c 2013-07-02 14:50:36 +0000
+++ src/power-request.c 2013-07-10 21:26:38 +0000
@@ -478,6 +478,8 @@
478 case STATE_TRANSITION_COMPLETE:478 case STATE_TRANSITION_COMPLETE:
479 cur_state_transition_state = process_state_complete(&delay);479 cur_state_transition_state = process_state_complete(&delay);
480 break;480 break;
481 default:
482 break;
481 }483 }
482 } while (delay == 0 &&484 } while (delay == 0 &&
483 cur_state_transition_state != STATE_TRANSITION_IDLE);485 cur_state_transition_state != STATE_TRANSITION_IDLE);
484486
=== modified file 'src/powerd-object.c'
--- src/powerd-object.c 2013-07-01 21:28:26 +0000
+++ src/powerd-object.c 2013-07-10 21:26:38 +0000
@@ -284,7 +284,6 @@
284powerd_dbus_name_watch_remove(const char *owner)284powerd_dbus_name_watch_remove(const char *owner)
285{285{
286 struct DbusNameWatch *dbnw = NULL;286 struct DbusNameWatch *dbnw = NULL;
287 char *hash_owner = NULL;
288287
289 if (strcmp(owner,"internal") == 0) {288 if (strcmp(owner,"internal") == 0) {
290 return;289 return;
291290
=== modified file 'src/powerd.cpp'
--- src/powerd.cpp 2013-07-02 13:52:40 +0000
+++ src/powerd.cpp 2013-07-10 21:26:38 +0000
@@ -69,9 +69,6 @@
69static int lasttime;69static int lasttime;
70struct tm *tm;70struct tm *tm;
7171
72static gint saved_brightness = 255;
73static gchar *brightness_path;
74
75/* The real default for this is set in the gschema file, but set 60 here72/* The real default for this is set in the gschema file, but set 60 here
76 * as a sanity check */73 * as a sanity check */
77static int activity_timeout = 60;74static int activity_timeout = 60;
@@ -135,12 +132,12 @@
135 g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);132 g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
136 }133 }
137134
135 return FALSE;
138}136}
139137
140gboolean activity_monitor(gpointer data)138gboolean activity_monitor(gpointer data)
141{139{
142 int new_state;140 int new_state;
143 gboolean ret = FALSE;
144141
145 g_mutex_lock(&activity_timer_mutex);142 g_mutex_lock(&activity_timer_mutex);
146143
@@ -212,7 +209,7 @@
212209
213int update_screen_state_worker(gpointer data)210int update_screen_state_worker(gpointer data)
214{211{
215 unsigned long new_state = (unsigned long)data;212 long new_state = (long)data;
216 int ret;213 int ret;
217214
218 if (new_state == activity_timer_screen_state)215 if (new_state == activity_timer_screen_state)
@@ -241,7 +238,7 @@
241238
242void update_screen_state(int new_state)239void update_screen_state(int new_state)
243{240{
244 unsigned long data = (unsigned long)new_state;241 long data = new_state;
245 if (new_state < SCREEN_STATE_OFF || new_state > SCREEN_STATE_BRIGHT)242 if (new_state < SCREEN_STATE_OFF || new_state > SCREEN_STATE_BRIGHT)
246 return;243 return;
247 powerd_run_mainloop_sync(update_screen_state_worker, (gpointer)data);244 powerd_run_mainloop_sync(update_screen_state_worker, (gpointer)data);
@@ -427,8 +424,6 @@
427424
428int main(int argc, char** argv)425int main(int argc, char** argv)
429{426{
430 int i, ret;
431
432 powerd_log_init();427 powerd_log_init();
433428
434 name_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, "com.canonical.powerd",429 name_id = g_bus_own_name(G_BUS_TYPE_SYSTEM, "com.canonical.powerd",
435430
=== modified file 'src/util.c'
--- src/util.c 2013-06-07 15:38:51 +0000
+++ src/util.c 2013-07-10 21:26:38 +0000
@@ -16,9 +16,12 @@
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */17 */
1818
19#include <string.h>
19#include <uuid/uuid.h>20#include <uuid/uuid.h>
20#include <glib.h>21#include <glib.h>
2122
23#include "powerd-internal.h"
24
22struct sync_work_data {25struct sync_work_data {
23 GCond cond;26 GCond cond;
24 GMutex mutex;27 GMutex mutex;

Subscribers

People subscribed via source and target branches