From f150d5d7064a5004aa82359fe46f427c8db97c13 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 9 Apr 2014 20:11:12 +0200 Subject: [PATCH] tvhpoll - use data.ptr instead data.u64 in http_client.c and satip_frontend.c --- src/http/http_client.c | 12 ++++++------ src/input/mpegts/satip/satip_frontend.c | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/http/http_client.c b/src/http/http_client.c index 3cba6459..38741f62 100644 --- a/src/http/http_client.c +++ b/src/http/http_client.c @@ -112,9 +112,9 @@ http_curl_socket ( CURL *c, int fd, int a, void *u, void *s ) ev.events |= TVHPOLL_IN; if (a & CURL_POLL_OUT) ev.events |= TVHPOLL_OUT; - ev.data.fd = fd; - ev.data.u64 = (uint64_t)hc; - hc->hc_fd = fd; + ev.data.fd = fd; + ev.data.ptr = hc; + hc->hc_fd = fd; tvhpoll_add(http_poll, &ev, 1); } @@ -154,7 +154,7 @@ http_thread ( void *p ) if (tvheadend_running) tvherror("http_client", "tvhpoll_wait() error"); } else if (n > 0) { - if ((uint64_t)&http_pipe == ev.data.u64) { + if (&http_pipe == ev.data.ptr) { if (read(http_pipe.rd, &c, 1) == 1) { if (c == 'n') { pthread_mutex_lock(&http_lock); @@ -174,7 +174,7 @@ http_thread ( void *p ) } pthread_mutex_lock(&http_lock); TAILQ_FOREACH(hc, &http_clients, hc_link) - if ((uint64_t)hc == ev.data.u64) + if (hc == ev.data.ptr) break; if (hc && (ev.events & (TVHPOLL_IN | TVHPOLL_OUT))) curl_multi_socket_action(http_curlm, hc->hc_fd, 0, &run); @@ -261,7 +261,7 @@ http_client_init ( void ) http_poll = tvhpoll_create(10); ev.fd = http_pipe.rd; ev.events = TVHPOLL_IN; - ev.data.u64 = (uint64_t)&http_pipe; + ev.data.ptr = &http_pipe; tvhpoll_add(http_poll, &ev, 1); /* Setup thread */ diff --git a/src/input/mpegts/satip/satip_frontend.c b/src/input/mpegts/satip/satip_frontend.c index 987d4ac1..7d24de86 100644 --- a/src/input/mpegts/satip/satip_frontend.c +++ b/src/input/mpegts/satip/satip_frontend.c @@ -687,17 +687,17 @@ satip_frontend_input_thread ( void *aux ) memset(ev, 0, sizeof(ev)); ev[0].events = TVHPOLL_IN; ev[0].fd = lfe->sf_rtp->fd; - ev[0].data.u64 = (uint64_t)lfe->sf_rtp; + ev[0].data.ptr = lfe->sf_rtp; ev[1].events = TVHPOLL_IN; ev[1].fd = lfe->sf_rtcp->fd; - ev[1].data.u64 = (uint64_t)lfe->sf_rtcp; + ev[1].data.ptr = lfe->sf_rtcp; ev[2].events = TVHPOLL_IN; ev[2].fd = rtsp->fd; - ev[2].data.u64 = (uint64_t)rtsp; + ev[2].data.ptr = rtsp; evr = ev[2]; ev[3].events = TVHPOLL_IN; ev[3].fd = lfe->sf_dvr_pipe.rd; - ev[3].data.u64 = 0; + ev[3].data.ptr = NULL; tvhpoll_add(efd, ev, 4); /* Read */ @@ -736,7 +736,7 @@ satip_frontend_input_thread ( void *aux ) nfds = tvhpoll_wait(efd, ev, 1, ms); - if (nfds > 0 && ev[0].data.u64 == 0) { + if (nfds > 0 && ev[0].data.ptr == NULL) { c = read(lfe->sf_dvr_pipe.rd, tsb[0], 1); if (c == 1 && tsb[0][0] == 'c') { ms = 20; @@ -756,7 +756,7 @@ satip_frontend_input_thread ( void *aux ) if (nfds < 1) continue; - if (ev[0].data.u64 == (uint64_t)rtsp) { + if (ev[0].data.ptr == rtsp) { r = satip_rtsp_run(rtsp); if (r < 0) { tvhlog(LOG_ERR, "satip", "%s - RTSP error %d (%s) [%i-%i]", @@ -805,14 +805,14 @@ satip_frontend_input_thread ( void *aux ) rtsp->cmd == SATIP_RTSP_CMD_NONE) satip_rtsp_options(rtsp); - if (ev[0].data.u64 == (uint64_t)lfe->sf_rtcp) { + if (ev[0].data.ptr == lfe->sf_rtcp) { c = recv(lfe->sf_rtcp->fd, rtcp, sizeof(rtcp), MSG_DONTWAIT); if (c > 0) satip_frontend_decode_rtcp(lfe, buf, mmi, rtcp, c); continue; } - if (ev[0].data.u64 != (uint64_t)lfe->sf_rtp) + if (ev[0].data.ptr != lfe->sf_rtp) continue; tc = recvmmsg(lfe->sf_rtp->fd, msg, PKTS, MSG_DONTWAIT, NULL); @@ -866,13 +866,13 @@ satip_frontend_input_thread ( void *aux ) ev[0].events = TVHPOLL_IN; ev[0].fd = lfe->sf_rtp->fd; - ev[0].data.u64 = (uint64_t)lfe->sf_rtp; + ev[0].data.ptr = lfe->sf_rtp; ev[1].events = TVHPOLL_IN; ev[1].fd = lfe->sf_rtcp->fd; - ev[1].data.u64 = (uint64_t)lfe->sf_rtcp; + ev[1].data.ptr = lfe->sf_rtcp; ev[2].events = TVHPOLL_IN; ev[2].fd = lfe->sf_dvr_pipe.rd; - ev[2].data.u64 = 0; + ev[2].data.ptr = NULL; tvhpoll_rem(efd, ev, 3); if (rtsp->stream_id) {