Code

mpdclient: update the "source" documentation
[ncmpc.git] / src / screen_outputs.c
index 5ec897dade076dfa2acbc01e6655fc797f2d7b25..ce8fdc60b9d2c615e3e05e683c3f571fca5e0175 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2010 The Music Player Daemon Project
+ * (c) 2004-2017 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
  *
  * This program is free software; you can redistribute it and/or modify
@@ -47,20 +47,17 @@ outputs_repaint(void)
 static bool
 toggle_output(struct mpdclient *c, unsigned int output_index)
 {
-       struct mpd_connection *connection;
-       struct mpd_output *output;
-
        assert(mpd_outputs != NULL);
 
        if (output_index >= mpd_outputs->len)
                return false;
 
-       connection = mpdclient_get_connection(c);
+       struct mpd_connection *connection = mpdclient_get_connection(c);
        if (connection == NULL)
                return false;
 
-       output = g_ptr_array_index(mpd_outputs, output_index);
-
+       struct mpd_output *output =
+               g_ptr_array_index(mpd_outputs, output_index);
        if (!mpd_output_get_enabled(output)) {
                if (!mpd_run_enable_output(connection,
                                           mpd_output_get_id(output))) {
@@ -114,18 +111,17 @@ clear_outputs_list(void)
 static void
 fill_outputs_list(struct mpdclient *c)
 {
-       struct mpd_connection *connection;
-       struct mpd_output *output;
-
        assert(mpd_outputs != NULL);
 
-       connection = mpdclient_get_connection(c);
+       struct mpd_connection *connection = mpdclient_get_connection(c);
        if (connection == NULL) {
                list_window_set_length(lw, 0);
                return;
        }
 
        mpd_send_outputs(connection);
+
+       struct mpd_output *output;
        while ((output = mpd_recv_output(connection)) != NULL) {
                g_ptr_array_add(mpd_outputs, output);
        }
@@ -178,7 +174,7 @@ outputs_title(gcc_unused char *str, gcc_unused size_t size)
 static void
 screen_outputs_paint_callback(WINDOW *w, unsigned i,
                              gcc_unused unsigned y, unsigned width,
-                             bool selected, gcc_unused void *data)
+                             bool selected, gcc_unused const void *data)
 {
        const struct mpd_output *output;