]> code.delx.au - pulseaudio/blobdiff - src/pulse/glib-mainloop.c
volume: Increase PA_SW_VOLUME_SNPRINT_DB_MAX
[pulseaudio] / src / pulse / glib-mainloop.c
index 5b399aa2bba113334c64f41c3519d90139f53f9a..34f355673392839b359293cbc4ffba1e6fc6c80a 100644 (file)
@@ -1,5 +1,3 @@
-/* $Id$ */
-
 /***
   This file is part of PulseAudio.
 
@@ -7,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
 #include <config.h>
 #endif
 
-#include <assert.h>
-
 #include <pulse/xmalloc.h>
 #include <pulse/timeval.h>
 
-#include <pulsecore/idxset.h>
 #include <pulsecore/core-util.h>
 #include <pulsecore/log.h>
 #include <pulsecore/llist.h>
@@ -38,7 +33,7 @@
 #include <glib.h>
 #include "glib-mainloop.h"
 
-struct pa_io_event  {
+struct pa_io_event {
     pa_glib_mainloop *mainloop;
     int dead;
 
@@ -199,11 +194,11 @@ static void cleanup_defer_events(pa_glib_mainloop *g, int force) {
 }
 
 static gushort map_flags_to_glib(pa_io_event_flags_t flags) {
-    return
-        (flags & PA_IO_EVENT_INPUT ? G_IO_IN : 0) |
-        (flags & PA_IO_EVENT_OUTPUT ? G_IO_OUT : 0) |
-        (flags & PA_IO_EVENT_ERROR ? G_IO_ERR : 0) |
-        (flags & PA_IO_EVENT_HANGUP ? G_IO_HUP : 0);
+    return (gushort)
+        ((flags & PA_IO_EVENT_INPUT ? G_IO_IN : 0) |
+         (flags & PA_IO_EVENT_OUTPUT ? G_IO_OUT : 0) |
+         (flags & PA_IO_EVENT_ERROR ? G_IO_ERR : 0) |
+         (flags & PA_IO_EVENT_HANGUP ? G_IO_HUP : 0));
 }
 
 static pa_io_event_flags_t map_flags_from_glib(gushort flags) {
@@ -333,14 +328,16 @@ static void glib_time_restart(pa_time_event*e, const struct timeval *tv) {
     if ((e->enabled = !!tv))
         e->timeval = *tv;
 
+    if (e->mainloop->cached_next_time_event == e)
+        e->mainloop->cached_next_time_event = NULL;
+
     if (e->mainloop->cached_next_time_event && e->enabled) {
         g_assert(e->mainloop->cached_next_time_event->enabled);
 
         if (pa_timeval_cmp(tv, &e->mainloop->cached_next_time_event->timeval) < 0)
             e->mainloop->cached_next_time_event = e;
-    } else if (e->mainloop->cached_next_time_event == e)
-        e->mainloop->cached_next_time_event = NULL;
- }
+    }
+}
 
 static void glib_time_free(pa_time_event *e) {
     g_assert(e);
@@ -429,7 +426,7 @@ static void glib_defer_set_destroy(pa_defer_event *e, pa_defer_event_destroy_cb_
 
 /* quit() */
 
-static void glib_quit(pa_mainloop_api*a, PA_GCC_UNUSED int retval) {
+static void glib_quit(pa_mainloop_api*a, int retval) {
 
     g_warning("quit() ignored");
 
@@ -494,7 +491,7 @@ static gboolean prepare_func(GSource *source, gint *timeout) {
         t = find_next_time_event(g);
         g_assert(t);
 
-        g_source_get_current_time(source, &now);
+        g_get_current_time(&now);
         tvnow.tv_sec = now.tv_sec;
         tvnow.tv_usec = now.tv_usec;
 
@@ -525,7 +522,7 @@ static gboolean check_func(GSource *source) {
         t = find_next_time_event(g);
         g_assert(t);
 
-        g_source_get_current_time(source, &now);
+        g_get_current_time(&now);
         tvnow.tv_sec = now.tv_sec;
         tvnow.tv_usec = now.tv_usec;
 
@@ -540,7 +537,7 @@ static gboolean check_func(GSource *source) {
     return FALSE;
 }
 
-static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callback, PA_GCC_UNUSED gpointer userdata) {
+static gboolean dispatch_func(GSource *source, GSourceFunc callback, gpointer userdata) {
     pa_glib_mainloop *g = (pa_glib_mainloop*) source;
     pa_io_event *e;
 
@@ -570,7 +567,7 @@ static gboolean dispatch_func(GSource *source, PA_GCC_UNUSED GSourceFunc callbac
         t = find_next_time_event(g);
         g_assert(t);
 
-        g_source_get_current_time(source, &now);
+        g_get_current_time(&now);
         tvnow.tv_sec = now.tv_sec;
         tvnow.tv_usec = now.tv_usec;