summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Franzke <benjaminfranzke@googlemail.com>2011-12-14 13:42:21 +0100
committerBenjamin Franzke <benjaminfranzke@googlemail.com>2011-12-14 13:42:21 +0100
commite723c1697c0ec3c0eecbf3797d6c16c69b3cf4ef (patch)
tree1fceedace50a32ad63745981b5182a760387ed44
parentb952910cafdf565b11bfc171a7028bff5206dbf5 (diff)
downloadpa-sink-ctl-e723c1697c0ec3c0eecbf3797d6c16c69b3cf4ef.tar.gz
pa-sink-ctl-e723c1697c0ec3c0eecbf3797d6c16c69b3cf4ef.tar.bz2
pa-sink-ctl-e723c1697c0ec3c0eecbf3797d6c16c69b3cf4ef.zip
Increase warning leaves, and fix new occured ones
-rw-r--r--configure.ac2
-rw-r--r--src/command.c19
-rw-r--r--src/command.h2
-rw-r--r--src/config.c7
-rw-r--r--src/interface.c5
-rw-r--r--src/pa-sink-ctl.c13
6 files changed, 24 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index 81eb2c8..1ef1992 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,7 @@ PKG_CHECK_MODULES(PULSE_MAINLOOP, [libpulse-mainloop-glib], [], AC_MSG_ERROR([li
PKG_CHECK_MODULES(GLIB, [glib-2.0], [], AC_MSG_ERROR([glib required]))
if test "x$GCC" = "xyes"; then
- GCC_CFLAGS="-Wall -pedantic -std=c99 -Wstrict-prototypes -Wmissing-prototypes -fvisibility=hidden"
+ GCC_CFLAGS="-Wall -pedantic -std=c99 -W -Wextra -pipe -Wno-long-long -Winline -Wvla -Wno-overlength-strings -Wunsafe-loop-optimizations -Wundef -Wformat=2 -Wlogical-op -Wsign-compare -Wformat-security -Wmissing-include-dirs -Wformat-nonliteral -Wold-style-definition -Wpointer-arith -Winit-self -Wdeclaration-after-statement -Wfloat-equal -Wmissing-prototypes -Wstrict-prototypes -Wredundant-decls -Wmissing-declarations -Wmissing-noreturn -Wshadow -Wendif-labels -Wcast-align -Wstrict-aliasing=2 -Wwrite-strings -Wno-unused-parameter -ffast-math -Wp,-D_FORTIFY_SOURCE=2 -fno-common -fdiagnostics-show-option -fvisibility=hidden"
fi
AC_SUBST(GCC_CFLAGS)
diff --git a/src/command.c b/src/command.c
index 6ba62b9..04fadf0 100644
--- a/src/command.c
+++ b/src/command.c
@@ -97,16 +97,15 @@ volume_change(struct context *ctx, gboolean volume_increment)
struct sink_info *sink;
struct sink_input_info *input;
guint32 index;
+ pa_cvolume volume;
+ pa_volume_t tmp_vol, inc;
+ pa_operation* (*volume_set) (pa_context*, guint32, const pa_cvolume *,
+ pa_context_success_cb_t, gpointer);
if (!ctx->context_ready)
return;
sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink);
- pa_cvolume volume;
- pa_volume_t tmp_vol;
- pa_operation* (*volume_set) (pa_context*, guint32, const pa_cvolume *,
- pa_context_success_cb_t, gpointer);
-
if (ctx->chooser_input >= 0) {
input = sink_get_nth_input(ctx, sink, ctx->chooser_input);
index = input->index;
@@ -124,7 +123,7 @@ volume_change(struct context *ctx, gboolean volume_increment)
}
pa_cvolume_set(&volume, volume.channels, tmp_vol);
- pa_volume_t inc = 2 * PA_VOLUME_NORM / 100;
+ inc = 2 * PA_VOLUME_NORM / 100;
if (volume_increment)
if (PA_VOLUME_NORM > tmp_vol &&
@@ -153,19 +152,19 @@ volume_up(struct context *ctx, int key)
}
static void
-mute(struct context *ctx, int key)
+do_mute(struct context *ctx, int key)
{
struct sink_info *sink;
struct sink_input_info *input;
guint32 index;
gint mute;
+ pa_operation* (*mute_set) (pa_context*, guint32, int,
+ pa_context_success_cb_t, void*);
if (!ctx->context_ready)
return;
sink = g_list_nth_data(ctx->sink_list, ctx->chooser_sink);
- pa_operation* (*mute_set) (pa_context*, guint32, int,
- pa_context_success_cb_t, void*);
if (ctx->chooser_input >= 0) {
input = sink_get_nth_input(ctx, sink, ctx->chooser_input);
@@ -237,7 +236,7 @@ struct command_cb_descriptor command_cbs[] = {
{ "down", down },
{ "volume-down", volume_down },
{ "volume-up", volume_up },
- { "mute", mute },
+ { "mute", do_mute },
{ "switch", switch_sink },
{ "quit", quit_cmd },
{ NULL, NULL }
diff --git a/src/command.h b/src/command.h
index 41bfd0d..461041b 100644
--- a/src/command.h
+++ b/src/command.h
@@ -24,7 +24,7 @@ struct context;
typedef void (*command_cb)(struct context *ctx, int key);
struct command_cb_descriptor {
- char *command;
+ const char *command;
command_cb cb;
};
diff --git a/src/config.c b/src/config.c
index 96fba47..41dad73 100644
--- a/src/config.c
+++ b/src/config.c
@@ -29,8 +29,7 @@ parse_priorities(struct config *cfg)
{
gchar **groups;
struct priority p;
- int i;
- gsize length;
+ gsize i, length;
GError *error = NULL;
groups = g_key_file_get_groups(cfg->keyfile, &length);
@@ -124,7 +123,7 @@ read_input_mappings(struct config *cfg)
return -1;
for (i = 0; command_cbs[i].command; ++i) {
- char *attrib = command_cbs[i].command;
+ const char *attrib = command_cbs[i].command;
error = NULL;
list = g_key_file_get_string_list(cfg->keyfile, "input",
@@ -160,7 +159,7 @@ config_init(struct config *cfg)
const gchar *home_dirs[] = { g_get_user_config_dir(), NULL };
const gchar * const * dirs_array[] = { home_dirs, g_get_system_config_dirs() };
GError *error;
- int i;
+ gsize i;
memset(cfg, 0, sizeof *cfg);
cfg->keyfile = g_key_file_new();
diff --git a/src/interface.c b/src/interface.c
index 4af03c0..57891b9 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -93,13 +93,14 @@ print_input_list(struct context *ctx, struct sink_info *sink,
{
struct sink_input_info *input;
gint offset = *poffset;
+ gboolean selected;
gint i = -1;
list_foreach(ctx->input_list, input) {
if (input->sink != sink->index)
continue;
- gboolean selected = (ctx->chooser_sink == sink_num &&
- ctx->chooser_input == ++i);
+ selected = (ctx->chooser_sink == sink_num &&
+ ctx->chooser_input == ++i);
if (selected)
wattron(ctx->menu_win, A_REVERSE);
diff --git a/src/pa-sink-ctl.c b/src/pa-sink-ctl.c
index ba59884..dbd6d19 100644
--- a/src/pa-sink-ctl.c
+++ b/src/pa-sink-ctl.c
@@ -75,7 +75,6 @@ static void
sink_info_cb(pa_context *c, const pa_sink_info *i,
gint is_last, gpointer userdata)
{
- g_assert(userdata != NULL);
struct context *ctx = userdata;
struct sink_info *sink;
GList *el;
@@ -118,7 +117,6 @@ static void
sink_input_info_cb(pa_context *c, const pa_sink_input_info *i,
gint is_last, gpointer userdata)
{
- g_assert(userdata != NULL);
struct context *ctx = userdata;
struct sink_input_info *sink_input;
GList *el;
@@ -263,10 +261,13 @@ context_state_callback(pa_context *c, gpointer userdata)
pa_operation_unref(op);
pa_context_set_subscribe_callback(c, subscribe_cb, ctx);
- pa_subscription_mask_t mask =
- PA_SUBSCRIPTION_MASK_SINK |
- PA_SUBSCRIPTION_MASK_SINK_INPUT;
- g_assert((ctx->op = pa_context_subscribe(c, mask, NULL, NULL)));
+ {
+ pa_subscription_mask_t mask =
+ PA_SUBSCRIPTION_MASK_SINK |
+ PA_SUBSCRIPTION_MASK_SINK_INPUT;
+ g_assert((ctx->op = pa_context_subscribe(c, mask,
+ NULL, NULL)));
+ }
ctx->context_ready = TRUE;
interface_set_status(ctx, "ready to process events.");
break;