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

Proposed by Seth Forshee
Status: Needs review
Proposed branch: lp:~sforshee/powerd/fix-warnings
Merge into: lp:powerd
Diff against target: 44 lines (+6/-5)
3 files modified
src/display.c (+1/-1)
src/powerd-internal.h (+1/-1)
src/powerd-object.c (+4/-3)
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 Pending
Review via email: mp+188613@code.launchpad.net

Commit message

Fix build warnings

Description of the change

Fix build warnings

To post a comment you must log in.
lp:~sforshee/powerd/fix-warnings updated
98. By Seth Forshee

powerd-object: Fix tabs/space indentation in previous commit

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Matt Fischer (mfisch) wrote :

Looks good. Not sure I understand why the last change was needed but it works the same either way.

Revision history for this message
Seth Forshee (sforshee) wrote :

I don't understand why gcc complains about it, but that last change does eliminate a warning. I'm also pretty sure gcc wasn't complaining about it originally, and I don't know what changed to make it start.

Unmerged revisions

98. By Seth Forshee

powerd-object: Fix tabs/space indentation in previous commit

97. By Seth Forshee

powerd-object: Fix warning about format string

Something changed recently to cause gcc to start warning about
some code that it had no problem with previously:

 src/powerd-object.c: In function 'handle_ack_state_change':
 src/powerd-object.c:131:47: warning: format not a string literal and no format arguments [-Wformat-security]
                                                G_DBUS_ERROR_INVALID_ARGS, msg);
                                                ^

This is probably just gcc being pedantic. Change it to something
which is completely equivalent but does not generate warnings.

96. By Seth Forshee

display: Make power_mode argument to display_set_power_mode() const

This fixes a warning:

 powerd.cpp: In function 'gboolean {anonymous}::call_shutdown(gpointer)':
 powerd.cpp:127:40: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

The argument is read-only, so it really ought to be const anyway.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/display.c'
--- src/display.c 2013-09-25 21:29:09 +0000
+++ src/display.c 2013-10-01 14:32:46 +0000
@@ -107,7 +107,7 @@
107 return (flags & AB_ENABLED_MASK) == AB_ENABLED;107 return (flags & AB_ENABLED_MASK) == AB_ENABLED;
108}108}
109109
110void display_set_power_mode(int display, char *power_mode)110void display_set_power_mode(int display, const char *power_mode)
111{111{
112 GError *error = NULL;112 GError *error = NULL;
113 GDBusProxy *unity_proxy = NULL;113 GDBusProxy *unity_proxy = NULL;
114114
=== modified file 'src/powerd-internal.h'
--- src/powerd-internal.h 2013-09-24 13:15:40 +0000
+++ src/powerd-internal.h 2013-10-01 14:32:46 +0000
@@ -74,7 +74,7 @@
74/* Display functions */74/* Display functions */
75void powerd_brightness_set_value(gint value);75void powerd_brightness_set_value(gint value);
76gboolean powerd_display_enabled(void);76gboolean powerd_display_enabled(void);
77void display_set_power_mode(int display, char *powerd_mode);77void display_set_power_mode(int display, const char *powerd_mode);
78void powerd_set_display_state(struct powerd_display_request *req);78void powerd_set_display_state(struct powerd_display_request *req);
79int powerd_display_init(void);79int powerd_display_init(void);
80void powerd_proximity_event(gboolean near);80void powerd_proximity_event(gboolean near);
8181
=== modified file 'src/powerd-object.c'
--- src/powerd-object.c 2013-08-12 02:46:09 +0000
+++ src/powerd-object.c 2013-10-01 14:32:46 +0000
@@ -125,10 +125,11 @@
125 owner = g_dbus_method_invocation_get_sender(invocation);125 owner = g_dbus_method_invocation_get_sender(invocation);
126 ret = powerd_client_ack(owner, state);126 ret = powerd_client_ack(owner, state);
127 if (ret) {127 if (ret) {
128 const char *msg = (ret == -EINVAL) ? "Invalid state" :
129 "Client not registered";
130 g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,128 g_dbus_method_invocation_return_error(invocation, G_DBUS_ERROR,
131 G_DBUS_ERROR_INVALID_ARGS, msg);129 G_DBUS_ERROR_INVALID_ARGS,
130 ret == -EINVAL ?
131 "Invalid state" :
132 "Client not registered");
132 } else {133 } else {
133 g_dbus_method_invocation_return_value(invocation, NULL);134 g_dbus_method_invocation_return_value(invocation, NULL);
134 }135 }

Subscribers

People subscribed via source and target branches