]> code.delx.au - pulseaudio/commitdiff
add a few missing casts
authorLennart Poettering <lennart@poettering.net>
Wed, 20 Aug 2008 00:33:06 +0000 (03:33 +0300)
committerLennart Poettering <lennart@poettering.net>
Wed, 20 Aug 2008 00:33:06 +0000 (03:33 +0300)
src/modules/module-combine.c
src/modules/module-oss.c
src/pulsecore/atomic.h
src/pulsecore/core-util.c
src/pulsecore/protocol-native.c
src/pulsecore/resampler.c
src/pulsecore/tagstruct.c

index 9fd12e30476376928886464666e8adb41b526bf4..d61d127a628976f3efa5b9929a790e40ca0032e7 100644 (file)
@@ -233,7 +233,7 @@ static void time_callback(pa_mainloop_api*a, pa_time_event* e, const struct time
     adjust_rates(u);
 
     pa_gettimeofday(&n);
-    n.tv_sec += u->adjust_time;
+    n.tv_sec += (time_t) u->adjust_time;
     u->sink->core->mainloop->time_restart(e, &n);
 }
 
@@ -1159,7 +1159,7 @@ int pa__init(pa_module*m) {
     if (u->adjust_time > 0) {
         struct timeval tv;
         pa_gettimeofday(&tv);
-        tv.tv_sec += u->adjust_time;
+        tv.tv_sec += (time_t) u->adjust_time;
         u->time_event = m->core->mainloop->time_new(m->core->mainloop, &tv, time_callback, u);
     }
 
index 3333eb833f60154d32eb0479e7f027c1b8d1663a..23a325499da569e1c15d8309f73b26d84e844b8d 100644 (file)
@@ -899,7 +899,7 @@ static void thread_func(void *userdata) {
                 ssize_t l;
                 pa_bool_t loop = FALSE, work_done = FALSE;
 
-                l = u->out_fragment_size;
+                l = (ssize_t) u->out_fragment_size;
 
                 if (u->use_getospace) {
                     audio_buf_info info;
@@ -920,14 +920,14 @@ static void thread_func(void *userdata) {
                 /* Round down to multiples of the fragment size,
                  * because OSS needs that (at least some versions
                  * do) */
-                l = (l/u->out_fragment_size) * u->out_fragment_size;
+                l = (l/(ssize_t) u->out_fragment_size) * (ssize_t) u->out_fragment_size;
 
                 /* Hmm, so poll() signalled us that we can read
                  * something, but GETOSPACE told us there was nothing?
                  * Hmm, make the best of it, try to read some data, to
                  * avoid spinning forever. */
                 if (l <= 0 && (revents & POLLOUT)) {
-                    l = u->out_fragment_size;
+                    l = (ssize_t) u->out_fragment_size;
                     loop = FALSE;
                 }
 
@@ -1010,7 +1010,7 @@ static void thread_func(void *userdata) {
                 pa_memchunk memchunk;
                 pa_bool_t loop = FALSE, work_done = FALSE;
 
-                l = u->in_fragment_size;
+                l = (ssize_t) u->in_fragment_size;
 
                 if (u->use_getispace) {
                     audio_buf_info info;
@@ -1024,10 +1024,10 @@ static void thread_func(void *userdata) {
                     }
                 }
 
-                l = (l/u->in_fragment_size) * u->in_fragment_size;
+                l = (l/(ssize_t) u->in_fragment_size) * (ssize_t) u->in_fragment_size;
 
                 if (l <= 0 && (revents & POLLIN)) {
-                    l = u->in_fragment_size;
+                    l = (ssize_t) u->in_fragment_size;
                     loop = FALSE;
                 }
 
index a91c4d56ab16004dfd3e584176fa99f6accc650e..072943abc67c0d453837e93d05a4f253aff709d4 100644 (file)
@@ -420,7 +420,7 @@ typedef struct pa_atomic {
     volatile AO_t value;
 } pa_atomic_t;
 
-#define PA_ATOMIC_INIT(v) { .value = (v) }
+#define PA_ATOMIC_INIT(v) { .value = (AO_t) (v) }
 
 static inline int pa_atomic_load(const pa_atomic_t *a) {
     return (int) AO_load_full((AO_t*) &a->value);
@@ -431,23 +431,23 @@ static inline void pa_atomic_store(pa_atomic_t *a, int i) {
 }
 
 static inline int pa_atomic_add(pa_atomic_t *a, int i) {
-    return AO_fetch_and_add_full(&a->value, (AO_t) i);
+    return (int) AO_fetch_and_add_full(&a->value, (AO_t) i);
 }
 
 static inline int pa_atomic_sub(pa_atomic_t *a, int i) {
-    return AO_fetch_and_add_full(&a->value, (AO_t) -i);
+    return (int) AO_fetch_and_add_full(&a->value, (AO_t) -i);
 }
 
 static inline int pa_atomic_inc(pa_atomic_t *a) {
-    return AO_fetch_and_add1_full(&a->value);
+    return (int) AO_fetch_and_add1_full(&a->value);
 }
 
 static inline int pa_atomic_dec(pa_atomic_t *a) {
-    return AO_fetch_and_sub1_full(&a->value);
+    return (int) AO_fetch_and_sub1_full(&a->value);
 }
 
 static inline int pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) {
-    return AO_compare_and_swap_full(&a->value, old_i, new_i);
+    return AO_compare_and_swap_full(&a->value, (unsigned long) old_i, (unsigned long) new_i);
 }
 
 typedef struct pa_atomic_ptr {
index 41a3104266970370f08775d3ff891362b9d030e8..89416d8b7464dd8698af89213f5aaed482854dad 100644 (file)
@@ -2041,7 +2041,7 @@ void *pa_will_need(const void *p, size_t l) {
         return (void*) p;
     }
 
-    bs = PA_PAGE_ALIGN(rlim.rlim_cur);
+    bs = PA_PAGE_ALIGN((size_t) rlim.rlim_cur);
 #else
     bs = PA_PAGE_SIZE*4;
 #endif
index d4694a059869d7d2de1112e2a0d1a1401b7db42d..1ee7a9719221790f52423b632c6a2c01a4e466b5 100644 (file)
@@ -1142,7 +1142,7 @@ static void handle_seek(playback_stream *s, int64_t indexw) {
 
             pa_log_debug("Requesting rewind due to end of underrun.");
             pa_sink_input_request_rewind(s->sink_input,
-                                         s->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : s->sink_input->thread_info.underrun_for,
+                                         (size_t) (s->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : s->sink_input->thread_info.underrun_for),
                                          FALSE, TRUE);
         }
 
index ee953652ca7290f0fa890cd42cf9c5697fc45df9..b20fc61fb6ea7b33f665824fb9dd49239565acc8 100644 (file)
@@ -1178,10 +1178,10 @@ static void libsamplerate_resample(pa_resampler *r, const pa_memchunk *input, un
     memset(&data, 0, sizeof(data));
 
     data.data_in = (float*) ((uint8_t*) pa_memblock_acquire(input->memblock) + input->index);
-    data.input_frames = in_n_frames;
+    data.input_frames = (long int) in_n_frames;
 
     data.data_out = (float*) ((uint8_t*) pa_memblock_acquire(output->memblock) + output->index);
-    data.output_frames = *out_n_frames;
+    data.output_frames = (long int) *out_n_frames;
 
     data.src_ratio = (double) r->o_ss.rate / r->i_ss.rate;
     data.end_of_input = 0;
index e5b228e9e92a0d7f5bb775cf50d2726c8377b166..62a30144d40ce3ec06529ff594b25d54f2650558 100644 (file)
@@ -435,9 +435,9 @@ int pa_tagstruct_get_timeval(pa_tagstruct*t, struct timeval *tv) {
         return -1;
 
     memcpy(&tv->tv_sec, t->data+t->rindex+1, 4);
-    tv->tv_sec = ntohl((uint32_t) tv->tv_sec);
+    tv->tv_sec = (time_t) ntohl((uint32_t) tv->tv_sec);
     memcpy(&tv->tv_usec, t->data+t->rindex+5, 4);
-    tv->tv_usec = ntohl((uint32_t) tv->tv_usec);
+    tv->tv_usec = (suseconds_t) ntohl((uint32_t) tv->tv_usec);
     t->rindex += 9;
     return 0;
 }