mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	core: Replace assert()s with pa_assert()s
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
		
							parent
							
								
									59334021d3
								
							
						
					
					
						commit
						101092465d
					
				
					 7 changed files with 11 additions and 12 deletions
				
			
		| 
						 | 
					@ -1559,14 +1559,14 @@ uint32_t pa_echo_canceller_blocksize_power2(unsigned rate, unsigned ms) {
 | 
				
			||||||
    unsigned nframes = (rate * ms) / 1000;
 | 
					    unsigned nframes = (rate * ms) / 1000;
 | 
				
			||||||
    uint32_t y = 1 << ((8 * sizeof(uint32_t)) - 2);
 | 
					    uint32_t y = 1 << ((8 * sizeof(uint32_t)) - 2);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(rate >= 4000);
 | 
					    pa_assert(rate >= 4000);
 | 
				
			||||||
    assert(ms >= 1);
 | 
					    pa_assert(ms >= 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* nframes should be a power of 2, round down to nearest power of two */
 | 
					    /* nframes should be a power of 2, round down to nearest power of two */
 | 
				
			||||||
    while (y > nframes)
 | 
					    while (y > nframes)
 | 
				
			||||||
        y >>= 1;
 | 
					        y >>= 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(y >= 1);
 | 
					    pa_assert(y >= 1);
 | 
				
			||||||
    return y;
 | 
					    return y;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -240,7 +240,7 @@ static int get_session_list(struct userdata *u) {
 | 
				
			||||||
        if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
 | 
					        if ((at = dbus_message_iter_get_arg_type(&sub)) == DBUS_TYPE_INVALID)
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert(at == DBUS_TYPE_OBJECT_PATH);
 | 
					        pa_assert(at == DBUS_TYPE_OBJECT_PATH);
 | 
				
			||||||
        dbus_message_iter_get_basic(&sub, &id);
 | 
					        dbus_message_iter_get_basic(&sub, &id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        add_session(u, id);
 | 
					        add_session(u, id);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -495,7 +495,7 @@ static void sink_set_volume(pa_sink *s) {
 | 
				
			||||||
        AUDIO_INITINFO(&info);
 | 
					        AUDIO_INITINFO(&info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
 | 
					        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
 | 
				
			||||||
        assert(info.play.gain <= AUDIO_MAX_GAIN);
 | 
					        pa_assert(info.play.gain <= AUDIO_MAX_GAIN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
 | 
					        if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
 | 
				
			||||||
            if (errno == EINVAL)
 | 
					            if (errno == EINVAL)
 | 
				
			||||||
| 
						 | 
					@ -530,7 +530,7 @@ static void source_set_volume(pa_source *s) {
 | 
				
			||||||
        AUDIO_INITINFO(&info);
 | 
					        AUDIO_INITINFO(&info);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
 | 
					        info.play.gain = pa_cvolume_max(&s->real_volume) * AUDIO_MAX_GAIN / PA_VOLUME_NORM;
 | 
				
			||||||
        assert(info.play.gain <= AUDIO_MAX_GAIN);
 | 
					        pa_assert(info.play.gain <= AUDIO_MAX_GAIN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
 | 
					        if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) {
 | 
				
			||||||
            if (errno == EINVAL)
 | 
					            if (errno == EINVAL)
 | 
				
			||||||
| 
						 | 
					@ -817,7 +817,7 @@ finish:
 | 
				
			||||||
static void sig_callback(pa_mainloop_api *api, pa_signal_event*e, int sig, void *userdata) {
 | 
					static void sig_callback(pa_mainloop_api *api, pa_signal_event*e, int sig, void *userdata) {
 | 
				
			||||||
    struct userdata *u = userdata;
 | 
					    struct userdata *u = userdata;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(u);
 | 
					    pa_assert(u);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_log_debug("caught signal");
 | 
					    pa_log_debug("caught signal");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -111,7 +111,7 @@ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool pa_memchunk_isset(pa_memchunk *chunk) {
 | 
					bool pa_memchunk_isset(pa_memchunk *chunk) {
 | 
				
			||||||
    assert(chunk);
 | 
					    pa_assert(chunk);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return
 | 
					    return
 | 
				
			||||||
        chunk->memblock ||
 | 
					        chunk->memblock ||
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -41,7 +41,7 @@ static int set_block(int fd, int blocking) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int v;
 | 
					    int v;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    assert(fd >= 0);
 | 
					    pa_assert(fd >= 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((v = fcntl(fd, F_GETFL)) < 0)
 | 
					    if ((v = fcntl(fd, F_GETFL)) < 0)
 | 
				
			||||||
        return -1;
 | 
					        return -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,7 +88,7 @@ int main(int argc, char* argv[]) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (i = 0; i < THREADS_MAX; i++) {
 | 
					    for (i = 0; i < THREADS_MAX; i++) {
 | 
				
			||||||
        threads[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1));
 | 
					        threads[i] = pa_thread_new("test", thread_func, pa_sprintf_malloc("Thread #%i", i+1));
 | 
				
			||||||
        assert(threads[i]);
 | 
					        pa_assert(threads[i]);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_msleep(60000);
 | 
					    pa_msleep(60000);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -21,7 +21,6 @@
 | 
				
			||||||
#include <config.h>
 | 
					#include <config.h>
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <assert.h>
 | 
					 | 
				
			||||||
#include <unistd.h>
 | 
					#include <unistd.h>
 | 
				
			||||||
#include <sys/types.h>
 | 
					#include <sys/types.h>
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
| 
						 | 
					@ -56,7 +55,7 @@ int main(int argc, char *argv[]) {
 | 
				
			||||||
            c.index = c.length = 0;
 | 
					            c.index = c.length = 0;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert(c.index < pa_memblock_get_length(c.memblock));
 | 
					        pa_assert(c.index < pa_memblock_get_length(c.memblock));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        l = pa_memblock_get_length(c.memblock) - c.index;
 | 
					        l = pa_memblock_get_length(c.memblock) - c.index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue