From 34dd4a20f2e976b260e8aa3f3128e55ec80bb85b Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 5 Aug 2008 23:56:25 +0200 Subject: fix shutdown when --disallow-module-loading=1 is passed --- src/modules/module-tunnel.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'src/modules/module-tunnel.c') diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index af27ce74..79ce1dd2 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -231,7 +231,7 @@ static void command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t pa_assert(u->pdispatch == pd); pa_log_warn("Stream killed"); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } /* Called from main context */ @@ -262,7 +262,7 @@ static void command_suspended(pa_pdispatch *pd, uint32_t command, uint32_t tag pa_tagstruct_get_boolean(t, &suspended) < 0 || !pa_tagstruct_eof(t)) { pa_log("Invalid packet"); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); return; } @@ -652,7 +652,7 @@ static void command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, p return; fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } #endif @@ -765,7 +765,7 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } /* Called from main context */ @@ -902,7 +902,7 @@ static void server_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa return; fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } #ifdef TUNNEL_SINK @@ -979,7 +979,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t return; fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); pa_proplist_free(pl); } @@ -1066,7 +1066,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag return; fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); pa_proplist_free(pl); } @@ -1142,7 +1142,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa return; fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); pa_proplist_free(pl); } @@ -1204,7 +1204,7 @@ static void command_subscribe_event(pa_pdispatch *pd, uint32_t command, uint32 if (pa_tagstruct_getu32(t, &e) < 0 || pa_tagstruct_getu32(t, &idx) < 0) { pa_log("Invalid protocol reply"); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); return; } @@ -1344,7 +1344,7 @@ parse_error: pa_log("Invalid reply. (Create stream)"); fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } @@ -1502,7 +1502,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t return; fail: - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } /* Called from main context */ @@ -1513,7 +1513,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) { pa_assert(u); pa_log_warn("Stream died."); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); } /* Called from main context */ @@ -1526,7 +1526,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_c if (pa_pdispatch_run(u->pdispatch, packet, creds, u) < 0) { pa_log("Invalid packet"); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); return; } } @@ -1542,7 +1542,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o if (channel != u->channel) { pa_log("Recieved memory block on bad channel."); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); return; } @@ -1568,7 +1568,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata if (!io) { pa_log("Connection failed: %s", pa_cstrerror(errno)); - pa_module_unload_request(u->module); + pa_module_unload_request(u->module, TRUE); return; } -- cgit From b7026bf248948a6a30386ddbcc137f48f369a51e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 19 Aug 2008 22:39:54 +0200 Subject: add a few more gcc warning flags and fix quite a few problems found by doing so --- src/modules/module-tunnel.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/modules/module-tunnel.c') diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index 79ce1dd2..de3c7274 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -178,7 +178,7 @@ struct userdata { #ifdef TUNNEL_SINK char *sink_name; pa_sink *sink; - int32_t requested_bytes; + size_t requested_bytes; #else char *source_name; pa_source *source; @@ -389,7 +389,7 @@ static void send_data(struct userdata *u) { u->requested_bytes -= memchunk.length; - u->counter += memchunk.length; + u->counter += (int64_t) memchunk.length; } } @@ -417,7 +417,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case PA_SINK_MESSAGE_GET_LATENCY: { pa_usec_t yl, yr, *usec = data; - yl = pa_bytes_to_usec(u->counter, &u->sink->sample_spec); + yl = pa_bytes_to_usec((uint64_t) u->counter, &u->sink->sample_spec); yr = pa_smoother_get(u->smoother, pa_rtclock_usec()); *usec = yl > yr ? yl - yr : 0; @@ -444,10 +444,10 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case SINK_MESSAGE_UPDATE_LATENCY: { pa_usec_t y; - y = pa_bytes_to_usec(u->counter, &u->sink->sample_spec); + y = pa_bytes_to_usec((uint64_t) u->counter, &u->sink->sample_spec); if (y > (pa_usec_t) offset || offset < 0) - y -= offset; + y -= (pa_usec_t) offset; else y = 0; @@ -465,7 +465,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse pa_pstream_send_memblock(u->pstream, u->channel, 0, PA_SEEK_RELATIVE, chunk); - u->counter_delta += chunk->length; + u->counter_delta += (int64_t) chunk->length; return 0; } @@ -520,7 +520,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off case PA_SOURCE_MESSAGE_GET_LATENCY: { pa_usec_t yr, yl, *usec = data; - yl = pa_bytes_to_usec(u->counter, &PA_SINK(o)->sample_spec); + yl = pa_bytes_to_usec((uint64_t) u->counter, &PA_SINK(o)->sample_spec); yr = pa_smoother_get(u->smoother, pa_rtclock_usec()); *usec = yr > yl ? yr - yl : 0; @@ -532,7 +532,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) pa_source_post(u->source, chunk); - u->counter += chunk->length; + u->counter += (int64_t) chunk->length; return 0; @@ -544,10 +544,10 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off case SOURCE_MESSAGE_UPDATE_LATENCY: { pa_usec_t y; - y = pa_bytes_to_usec(u->counter, &u->source->sample_spec); + y = pa_bytes_to_usec((uint64_t) u->counter, &u->source->sample_spec); if (offset >= 0 || y > (pa_usec_t) -offset) - y += offset; + y += (pa_usec_t) offset; else y = 0; @@ -736,9 +736,9 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint /* Add the length of our server-side buffer */ if (write_index >= read_index) - delay += (int64_t) pa_bytes_to_usec(write_index-read_index, ss); + delay += (int64_t) pa_bytes_to_usec((uint64_t) (write_index-read_index), ss); else - delay -= (int64_t) pa_bytes_to_usec(read_index-write_index, ss); + delay -= (int64_t) pa_bytes_to_usec((uint64_t) (read_index-write_index), ss); /* Our measurements are already out of date, hence correct by the * * transport latency */ @@ -750,9 +750,9 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint /* Now correct by what we have have read/written since we requested the update */ #ifdef TUNNEL_SINK - delay += (int64_t) pa_bytes_to_usec(u->counter_delta, ss); + delay += (int64_t) pa_bytes_to_usec((uint64_t) u->counter_delta, ss); #else - delay -= (int64_t) pa_bytes_to_usec(u->counter_delta, ss); + delay -= (int64_t) pa_bytes_to_usec((uint64_t) u->counter_delta, ss); #endif #ifdef TUNNEL_SINK @@ -1425,11 +1425,11 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t u->maxlength = 4*1024*1024; #ifdef TUNNEL_SINK - u->tlength = pa_usec_to_bytes(PA_USEC_PER_MSEC * DEFAULT_TLENGTH_MSEC, &u->sink->sample_spec); - u->minreq = pa_usec_to_bytes(PA_USEC_PER_MSEC * DEFAULT_MINREQ_MSEC, &u->sink->sample_spec); + u->tlength = (uint32_t) pa_usec_to_bytes(PA_USEC_PER_MSEC * DEFAULT_TLENGTH_MSEC, &u->sink->sample_spec); + u->minreq = (uint32_t) pa_usec_to_bytes(PA_USEC_PER_MSEC * DEFAULT_MINREQ_MSEC, &u->sink->sample_spec); u->prebuf = u->tlength; #else - u->fragsize = pa_usec_to_bytes(PA_USEC_PER_MSEC * DEFAULT_FRAGSIZE_MSEC, &u->source->sample_spec); + u->fragsize = (uint32_t) pa_usec_to_bytes(PA_USEC_PER_MSEC * DEFAULT_FRAGSIZE_MSEC, &u->source->sample_spec); #endif #ifdef TUNNEL_SINK @@ -1548,7 +1548,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o pa_asyncmsgq_send(u->source->asyncmsgq, PA_MSGOBJECT(u->source), SOURCE_MESSAGE_POST, PA_UINT_TO_PTR(seek), offset, chunk); - u->counter_delta += chunk->length; + u->counter_delta += (int64_t) chunk->length; } #endif -- cgit