[pulseaudio-commits] r1836 - in /branches/lennart: ./ src/pulsecore/

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Sun Sep 16 16:28:57 PDT 2007


Author: lennart
Date: Mon Sep 17 01:28:56 2007
New Revision: 1836

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1836&root=pulseaudio&view=rev
Log:
add proper boolean type pa_bool_t

Modified:
    branches/lennart/configure.ac
    branches/lennart/src/pulsecore/macro.h
    branches/lennart/src/pulsecore/sink-input.c
    branches/lennart/src/pulsecore/sink-input.h
    branches/lennart/src/pulsecore/sink.c
    branches/lennart/src/pulsecore/sink.h
    branches/lennart/src/pulsecore/source-output.c
    branches/lennart/src/pulsecore/source-output.h
    branches/lennart/src/pulsecore/source.c
    branches/lennart/src/pulsecore/source.h

Modified: branches/lennart/configure.ac
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/configure.ac?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/configure.ac (original)
+++ branches/lennart/configure.ac Mon Sep 17 01:28:56 2007
@@ -125,6 +125,18 @@
 rm -f conftest.o conftest
 if test $ret -eq 0 ; then
     AC_DEFINE([HAVE_TLS_BUILTIN], 1, [Have __thread().])
+    AC_MSG_RESULT([yes])
+else
+    AC_MSG_RESULT([no])
+fi
+
+AC_MSG_CHECKING([whether $CC knows _Bool])
+AC_LANG_CONFTEST([int main() { _Bool b; }])
+$CC conftest.c $CFLAGS -o conftest > /dev/null 2> /dev/null
+ret=$?
+rm -f conftest.o conftest
+if test $ret -eq 0 ; then
+    AC_DEFINE([HAVE_STD_BOOL], 1, [Have _Bool.])
     AC_MSG_RESULT([yes])
 else
     AC_MSG_RESULT([no])

Modified: branches/lennart/src/pulsecore/macro.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/macro.h?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/macro.h (original)
+++ branches/lennart/src/pulsecore/macro.h Mon Sep 17 01:28:56 2007
@@ -72,6 +72,21 @@
 #define MIN(a, b) ((a) < (b) ? (a) : (b))
 #endif
 
+/* This type is not intended to be used in exported APIs! Use classic "int" there! */
+#ifdef HAVE_STD_BOOL
+typedef _Bool pa_bool_t;
+#else
+typedef int pa_bool_t;
+#endif
+
+#ifndef FALSE
+#define FALSE ((pa_bool_t) 0)
+#endif
+
+#ifndef TRUE
+#define TRUE (!FALSE)
+#endif
+
 #ifdef __GNUC__
 #define PA_PRETTY_FUNCTION __PRETTY_FUNCTION__
 #else

Modified: branches/lennart/src/pulsecore/sink-input.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sink-input.c?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sink-input.c (original)
+++ branches/lennart/src/pulsecore/sink-input.c Mon Sep 17 01:28:56 2007
@@ -79,10 +79,10 @@
         data->sample_spec = *spec;
 }
 
-void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, int mute) {
+void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, pa_bool_t mute) {
     pa_assert(data);
 
-    data->muted_is_set = 1;
+    data->muted_is_set = TRUE;
     data->muted = !!mute;
 }
 
@@ -607,7 +607,7 @@
     return &i->volume;
 }
 
-void pa_sink_input_set_mute(pa_sink_input *i, int mute) {
+void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute) {
     pa_assert(i);
     pa_sink_input_assert_ref(i);
     pa_assert(PA_SINK_INPUT_LINKED(i->state));
@@ -628,7 +628,7 @@
     return !!i->muted;
 }
 
-void pa_sink_input_cork(pa_sink_input *i, int b) {
+void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b) {
     pa_sink_input_assert_ref(i);
     pa_assert(PA_SINK_INPUT_LINKED(i->state));
 

Modified: branches/lennart/src/pulsecore/sink-input.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sink-input.h?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sink-input.h (original)
+++ branches/lennart/src/pulsecore/sink-input.h Mon Sep 17 01:28:56 2007
@@ -46,7 +46,7 @@
     PA_SINK_INPUT_UNLINKED      /*< The stream is dead */
 } pa_sink_input_state_t;
 
-static inline int PA_SINK_INPUT_LINKED(pa_sink_input_state_t x) {
+static inline pa_bool_t PA_SINK_INPUT_LINKED(pa_sink_input_state_t x) {
     return x == PA_SINK_INPUT_DRAINED || x == PA_SINK_INPUT_RUNNING || x == PA_SINK_INPUT_CORKED;
 }
 
@@ -80,7 +80,7 @@
     pa_sink_input *sync_prev, *sync_next;
     
     pa_cvolume volume;
-    int muted;
+    pa_bool_t muted;
 
     /* Returns the chunk of audio data (but doesn't drop it
      * yet!). Returns -1 on failure. Called from IO thread context. If
@@ -139,7 +139,7 @@
         pa_sink_input *sync_prev, *sync_next;
         
         pa_cvolume volume;
-        int muted;
+        pa_bool_t muted;
     } thread_info;
 
     void *userdata;
@@ -165,14 +165,14 @@
     pa_sink *sink;
 
     pa_sample_spec sample_spec;
-    int sample_spec_is_set;
+    pa_bool_t sample_spec_is_set;
     pa_channel_map channel_map;
-    int channel_map_is_set;
+    pa_bool_t channel_map_is_set;
     
     pa_cvolume volume;
-    int volume_is_set;
-    int muted;
-    int muted_is_set;
+    pa_bool_t volume_is_set;
+    pa_bool_t muted;
+    pa_bool_t muted_is_set;
 
     pa_resample_method_t resample_method;
 
@@ -183,7 +183,7 @@
 void pa_sink_input_new_data_set_sample_spec(pa_sink_input_new_data *data, const pa_sample_spec *spec);
 void pa_sink_input_new_data_set_channel_map(pa_sink_input_new_data *data, const pa_channel_map *map);
 void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cvolume *volume);
-void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, int mute);
+void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, pa_bool_t mute);
 
 /* To be called by the implementing module only */
 
@@ -206,10 +206,10 @@
 
 void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume);
 const pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i);
-void pa_sink_input_set_mute(pa_sink_input *i, int mute);
+void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute);
 int pa_sink_input_get_mute(pa_sink_input *i);
 
-void pa_sink_input_cork(pa_sink_input *i, int b);
+void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b);
 
 int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate);
 

Modified: branches/lennart/src/pulsecore/sink.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sink.c?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sink.c (original)
+++ branches/lennart/src/pulsecore/sink.c Mon Sep 17 01:28:56 2007
@@ -105,8 +105,8 @@
     s->n_corked = 0;
 
     pa_cvolume_reset(&s->volume, spec->channels);
-    s->muted = 0;
-    s->refresh_volume = s->refresh_mute = 0;
+    s->muted = FALSE;
+    s->refresh_volume = s->refresh_mute = FALSE;
 
     s->get_latency = NULL;
     s->set_volume = NULL;
@@ -295,7 +295,7 @@
     return sink_set_state(s, pa_sink_used_by(s) ? PA_SINK_RUNNING : PA_SINK_IDLE);
 }
 
-int pa_sink_suspend(pa_sink *s, int suspend) {
+int pa_sink_suspend(pa_sink *s, pa_bool_t suspend) {
     pa_sink_assert_ref(s);
     pa_assert(PA_SINK_LINKED(s->state));
 
@@ -678,7 +678,7 @@
     return &s->volume;
 }
 
-void pa_sink_set_mute(pa_sink *s, int mute) {
+void pa_sink_set_mute(pa_sink *s, pa_bool_t mute) {
     int changed;
 
     pa_sink_assert_ref(s);
@@ -697,8 +697,8 @@
         pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
 }
 
-int pa_sink_get_mute(pa_sink *s) {
-    int old_muted;
+pa_bool_t pa_sink_get_mute(pa_sink *s) {
+    pa_bool_t old_muted;
 
     pa_sink_assert_ref(s);
     pa_assert(PA_SINK_LINKED(s->state));
@@ -927,7 +927,7 @@
             return 0;
 
         case PA_SINK_MESSAGE_GET_MUTE:
-            *((int*) userdata) = s->thread_info.soft_muted;
+            *((pa_bool_t*) userdata) = s->thread_info.soft_muted;
             return 0;
 
         case PA_SINK_MESSAGE_PING:
@@ -960,7 +960,7 @@
     return -1;
 }
 
-int pa_sink_suspend_all(pa_core *c, int suspend) {
+int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend) {
     pa_sink *sink;
     uint32_t idx;
     int ret = 0;

Modified: branches/lennart/src/pulsecore/sink.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/sink.h?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/sink.h (original)
+++ branches/lennart/src/pulsecore/sink.h Mon Sep 17 01:28:56 2007
@@ -52,11 +52,11 @@
     PA_SINK_UNLINKED
 } pa_sink_state_t;
 
-static inline int PA_SINK_OPENED(pa_sink_state_t x) {
+static inline pa_bool_t PA_SINK_OPENED(pa_sink_state_t x) {
     return x == PA_SINK_RUNNING || x == PA_SINK_IDLE;
 }
 
-static inline int PA_SINK_LINKED(pa_sink_state_t x) {
+static inline pa_bool_t PA_SINK_LINKED(pa_sink_state_t x) {
     return x == PA_SINK_RUNNING || x == PA_SINK_IDLE || x == PA_SINK_SUSPENDED;
 }
 
@@ -81,9 +81,9 @@
     pa_source *monitor_source;
 
     pa_cvolume volume;
-    int muted;
-    int refresh_volume;
-    int refresh_mute;
+    pa_bool_t muted;
+    pa_bool_t refresh_volume;
+    pa_bool_t refresh_mute;
 
     int (*set_state)(pa_sink *s, pa_sink_state_t state); /* may be NULL */
     int (*set_volume)(pa_sink *s);           /* dito */
@@ -101,7 +101,7 @@
         pa_sink_state_t state;
         pa_hashmap *inputs;
         pa_cvolume soft_volume;
-        int soft_muted;
+        pa_bool_t soft_muted;
     } thread_info;
 
     pa_memblock *silence;
@@ -154,8 +154,8 @@
 pa_usec_t pa_sink_get_latency(pa_sink *s);
 
 int pa_sink_update_status(pa_sink*s);
-int pa_sink_suspend(pa_sink *s, int suspend);
-int pa_sink_suspend_all(pa_core *c, int suspend);
+int pa_sink_suspend(pa_sink *s, pa_bool_t suspend);
+int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend);
 
 /* Sends a ping message to the sink thread, to make it wake up and
  * check for data to process even if there is no real message is
@@ -164,8 +164,8 @@
 
 void pa_sink_set_volume(pa_sink *sink, const pa_cvolume *volume);
 const pa_cvolume *pa_sink_get_volume(pa_sink *sink);
-void pa_sink_set_mute(pa_sink *sink, int mute);
-int pa_sink_get_mute(pa_sink *sink);
+void pa_sink_set_mute(pa_sink *sink, pa_bool_t mute);
+pa_bool_t pa_sink_get_mute(pa_sink *sink);
 
 unsigned pa_sink_linked_by(pa_sink *s); /* Number of connected streams */
 unsigned pa_sink_used_by(pa_sink *s); /* Number of connected streams which are not corked */

Modified: branches/lennart/src/pulsecore/source-output.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/source-output.c?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/source-output.c (original)
+++ branches/lennart/src/pulsecore/source-output.c Mon Sep 17 01:28:56 2007
@@ -306,7 +306,7 @@
     pa_memblock_unref(rchunk.memblock);
 }
 
-void pa_source_output_cork(pa_source_output *o, int b) {
+void pa_source_output_cork(pa_source_output *o, pa_bool_t b) {
     pa_source_output_assert_ref(o);
     pa_assert(PA_SOURCE_OUTPUT_LINKED(o->state));
 

Modified: branches/lennart/src/pulsecore/source-output.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/source-output.h?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/source-output.h (original)
+++ branches/lennart/src/pulsecore/source-output.h Mon Sep 17 01:28:56 2007
@@ -42,7 +42,7 @@
     PA_SOURCE_OUTPUT_UNLINKED
 } pa_source_output_state_t;
 
-static inline int PA_SOURCE_OUTPUT_LINKED(pa_source_output_state_t x) {
+static inline pa_bool_t PA_SOURCE_OUTPUT_LINKED(pa_source_output_state_t x) {
     return x == PA_SOURCE_OUTPUT_RUNNING || x == PA_SOURCE_OUTPUT_CORKED;
 }
 
@@ -126,9 +126,9 @@
     pa_source *source;
 
     pa_sample_spec sample_spec;
-    int sample_spec_is_set;
+    pa_bool_t sample_spec_is_set;
     pa_channel_map channel_map;
-    int channel_map_is_set;
+    pa_bool_t channel_map_is_set;
 
     pa_resample_method_t resample_method;
 } pa_source_output_new_data;
@@ -157,7 +157,7 @@
 
 pa_usec_t pa_source_output_get_latency(pa_source_output *i);
 
-void pa_source_output_cork(pa_source_output *i, int b);
+void pa_source_output_cork(pa_source_output *i, pa_bool_t b);
 
 int pa_source_output_set_rate(pa_source_output *o, uint32_t rate);
 

Modified: branches/lennart/src/pulsecore/source.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/source.c?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/source.c (original)
+++ branches/lennart/src/pulsecore/source.c Mon Sep 17 01:28:56 2007
@@ -97,8 +97,8 @@
     s->monitor_of = NULL;
 
     pa_cvolume_reset(&s->volume, spec->channels);
-    s->muted = 0;
-    s->refresh_volume = s->refresh_muted = 0;
+    s->muted = FALSE;
+    s->refresh_volume = s->refresh_muted = FALSE;
 
     s->get_latency = NULL;
     s->set_volume = NULL;
@@ -240,7 +240,7 @@
     return source_set_state(s, pa_source_used_by(s) ? PA_SOURCE_RUNNING : PA_SOURCE_IDLE);
 }
 
-int pa_source_suspend(pa_source *s, int suspend) {
+int pa_source_suspend(pa_source *s, pa_bool_t suspend) {
     pa_source_assert_ref(s);
     pa_assert(PA_SOURCE_LINKED(s->state));
 
@@ -348,7 +348,7 @@
     return &s->volume;
 }
 
-void pa_source_set_mute(pa_source *s, int mute) {
+void pa_source_set_mute(pa_source *s, pa_bool_t mute) {
     int changed;
 
     pa_source_assert_ref(s);
@@ -367,8 +367,8 @@
         pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index);
 }
 
-int pa_source_get_mute(pa_source *s) {
-    int old_muted;
+pa_bool_t pa_source_get_mute(pa_source *s) {
+    pa_bool_t old_muted;
 
     pa_source_assert_ref(s);
     pa_assert(PA_SOURCE_LINKED(s->state));
@@ -487,7 +487,7 @@
             return 0;
 
         case PA_SOURCE_MESSAGE_GET_MUTE:
-            *((int*) userdata) = s->thread_info.soft_muted;
+            *((pa_bool_t*) userdata) = s->thread_info.soft_muted;
             return 0;
 
         case PA_SOURCE_MESSAGE_PING:
@@ -519,7 +519,7 @@
     return -1;
 }
 
-int pa_source_suspend_all(pa_core *c, int suspend) {
+int pa_source_suspend_all(pa_core *c, pa_bool_t suspend) {
     uint32_t idx;
     pa_source *source;
     int ret = 0;

Modified: branches/lennart/src/pulsecore/source.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/source.h?rev=1836&root=pulseaudio&r1=1835&r2=1836&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/source.h (original)
+++ branches/lennart/src/pulsecore/source.h Mon Sep 17 01:28:56 2007
@@ -54,11 +54,11 @@
     PA_SOURCE_UNLINKED
 } pa_source_state_t;
 
-static inline int PA_SOURCE_OPENED(pa_source_state_t x) {
+static inline pa_bool_t PA_SOURCE_OPENED(pa_source_state_t x) {
     return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE;
 }
 
-static inline int PA_SOURCE_LINKED(pa_source_state_t x) {
+static inline pa_bool_t PA_SOURCE_LINKED(pa_source_state_t x) {
     return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE || x == PA_SOURCE_SUSPENDED;
 }
 
@@ -83,9 +83,9 @@
     pa_sink *monitor_of;                     /* may be NULL */
 
     pa_cvolume volume;
-    int muted;
-    int refresh_volume;
-    int refresh_muted;
+    pa_bool_t muted;
+    pa_bool_t refresh_volume;
+    pa_bool_t refresh_muted;
 
     int (*set_state)(pa_source*source, pa_source_state_t state); /* may be NULL */
     int (*set_volume)(pa_source *s);         /* dito */
@@ -103,7 +103,7 @@
         pa_source_state_t state;
         pa_hashmap *outputs;
         pa_cvolume soft_volume;
-        int soft_muted;
+        pa_bool_t soft_muted;
     } thread_info;
 
     void *userdata;
@@ -153,15 +153,15 @@
 pa_usec_t pa_source_get_latency(pa_source *s);
 
 int pa_source_update_status(pa_source*s);
-int pa_source_suspend(pa_source *s, int suspend);
-int pa_source_suspend_all(pa_core *c, int suspend);
+int pa_source_suspend(pa_source *s, pa_bool_t suspend);
+int pa_source_suspend_all(pa_core *c, pa_bool_t suspend);
 
 void pa_source_ping(pa_source *s);
 
 void pa_source_set_volume(pa_source *source, const pa_cvolume *volume);
 const pa_cvolume *pa_source_get_volume(pa_source *source);
-void pa_source_set_mute(pa_source *source, int mute);
-int pa_source_get_mute(pa_source *source);
+void pa_source_set_mute(pa_source *source, pa_bool_t mute);
+pa_bool_t pa_source_get_mute(pa_source *source);
 
 unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */
 unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */




More information about the pulseaudio-commits mailing list