gui: Only check STDIN for readability if curses is active.
[paraslash.git] / audiod.c
index 552577d..cd43f24 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -569,7 +569,7 @@ static void close_stat_pipe(void)
        stat_pipe = -1;
        kill_all_decoders();
        for (i = 0; i < RINGBUFFER_SIZE; i++)
-               ringbuffer_add(stat_item_ringbuf, para_strdup(NULL));
+               free(ringbuffer_add(stat_item_ringbuf, para_strdup(NULL)));
        dump_empty_status();
        length_seconds = 0;
        offset_seconds = 0;
@@ -577,9 +577,8 @@ static void close_stat_pipe(void)
        playing = 0;
        msg = make_message("%s:no connection to para_server\n",
                status_item_list[SI_STATUS_BAR]);
-       ringbuffer_add(stat_item_ringbuf, msg);
+       free(ringbuffer_add(stat_item_ringbuf, msg));
        stat_client_write(msg);
-       free(msg);
 }
 
 static void __noreturn clean_exit(int status, const char *msg)
@@ -806,7 +805,7 @@ static void check_stat_line(char *line)
 
        if (!line)
                return;
-       ringbuffer_add(stat_item_ringbuf, line);
+       free(ringbuffer_add(stat_item_ringbuf, para_strdup(line)));
        stat_client_write(line);
        itemnum = stat_line_valid(line);
        if (itemnum < 0)
@@ -987,16 +986,16 @@ static int write_audio_data(int slot_num)
                buf = &rn->buf;
                len = &rn->loaded;
        }
-       PARA_DEBUG_LOG("writing %p (%d bytes)\n", *buf, *len);
+       PARA_DEBUG_LOG("writing %p (%zd bytes)\n", *buf, *len);
        rv = write(s->write_fd, *buf, *len);
-       PARA_DEBUG_LOG("wrote %d/%d\n", rv, *len);
+       PARA_DEBUG_LOG("wrote %d/%zd\n", rv, *len);
        if (rv < 0) {
                PARA_WARNING_LOG("write error in slot %d (fd %d): %s\n",
                        slot_num, s->write_fd, strerror(errno));
                *len = 0;
                s->fci->error = E_WRITE_AUDIO_DATA;
        } else if (rv != *len) {
-               PARA_DEBUG_LOG("partial %s write (%i/%i) for slot %d\n",
+               PARA_DEBUG_LOG("partial %s write (%i/%zd) for slot %d\n",
                        audio_formats[s->format], rv, *len, slot_num);
                *len -= rv;
                memmove(*buf, *buf + rv, *len);
@@ -1545,7 +1544,7 @@ repeat:
                } else {
                        status_buf[ret + sbo] = '\0';
                        sbo = for_each_line(status_buf, ret + sbo,
-                               &check_stat_line, 0);
+                               &check_stat_line);
                }
        }
        slot_io(&wfds);