From 99497fbb55aabc192f01dc3b6e5757717ad186d3 Mon Sep 17 00:00:00 2001 From: Derek Dai Date: Mon, 27 Feb 2017 11:37:21 +0800 Subject: [PATCH] miracle-wfdctl: change session type from uint64_t to unsigned int --- src/ctl/ctl.h | 12 ++++++------ src/ctl/wfd-out-session.c | 4 ++-- src/ctl/wfd-session.c | 4 ++-- src/ctl/wfd-session.h | 2 +- src/ctl/wfdctl.c | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/ctl/ctl.h b/src/ctl/ctl.h index 3d5c709..b19574a 100644 --- a/src/ctl/ctl.h +++ b/src/ctl/ctl.h @@ -190,8 +190,8 @@ void wfd_session_free(struct wfd_session *s); uint64_t wfd_session_get_id(struct wfd_session *s); struct wfd_sink * wfd_out_session_get_sink(struct wfd_session *s); void wfd_session_free_p(struct wfd_session **s); -uint64_t * wfd_session_to_htable(struct wfd_session *s); -struct wfd_session * wfd_session_from_htable(uint64_t *e); +unsigned int * wfd_session_to_htable(struct wfd_session *s); +struct wfd_session * wfd_session_from_htable(unsigned int *e); /* wfd sink */ #define _wfd_sink_free_ _shl_cleanup_(wfd_sink_freep) @@ -249,7 +249,7 @@ struct ctl_wfd size_t n_sinks; struct shl_htable sessions; size_t n_sessions; - uint64_t id_pool; + unsigned int id_pool; sd_event_source *signal_sources[4]; }; @@ -260,12 +260,12 @@ int ctl_wfd_find_sink_by_label(struct ctl_wfd *wfd, struct wfd_sink **out); int ctl_wfd_add_session(struct ctl_wfd *wfd, struct wfd_session *s); int ctl_wfd_find_session_by_id(struct ctl_wfd *wfd, - uint64_t id, + unsigned int id, struct wfd_session **out); int ctl_wfd_remove_session_by_id(struct ctl_wfd *wfd, - uint64_t id, + unsigned int id, struct wfd_session **out); -uint64_t ctl_wfd_alloc_session_id(struct ctl_wfd *wfd); +unsigned int ctl_wfd_alloc_session_id(struct ctl_wfd *wfd); static inline struct sd_event * ctl_wfd_get_loop() { return ctl_wfd_get()->loop; diff --git a/src/ctl/wfd-out-session.c b/src/ctl/wfd-out-session.c index a21527a..a183c42 100644 --- a/src/ctl/wfd-out-session.c +++ b/src/ctl/wfd-out-session.c @@ -536,7 +536,7 @@ static int wfd_out_session_launch_gst(struct wfd_session *s, pid_t *out) return p; } else if(0 < p) { - log_info("gstreamer (%d) is launched for session %" PRId64, + log_info("gstreamer (%d) is launched for session %u", p, s->id); @@ -743,7 +743,7 @@ static int wfd_out_session_handle_setup_request(struct wfd_session *s, return r; } - r = asprintf(&sess, "%" PRIu64 ";timeout=30", s->id); + r = asprintf(&sess, "%X;timeout=30", s->id); if(0 > r) { return r; } diff --git a/src/ctl/wfd-session.c b/src/ctl/wfd-session.c index 9014b62..4027c59 100644 --- a/src/ctl/wfd-session.c +++ b/src/ctl/wfd-session.c @@ -235,12 +235,12 @@ enum wfd_session_dir wfd_session_get_dir(struct wfd_session *s) return s->dir; } -uint64_t * wfd_session_to_htable(struct wfd_session *s) +unsigned int * wfd_session_to_htable(struct wfd_session *s) { return &s->id; } -struct wfd_session * wfd_session_from_htable(uint64_t *e) +struct wfd_session * wfd_session_from_htable(unsigned int *e) { return shl_htable_entry(e, struct wfd_session, id); } diff --git a/src/ctl/wfd-session.h b/src/ctl/wfd-session.h index fce7c45..e95efb8 100644 --- a/src/ctl/wfd-session.h +++ b/src/ctl/wfd-session.h @@ -98,7 +98,7 @@ struct wfd_session enum rtsp_message_id last_request; const struct rtsp_dispatch_entry *rtsp_disp_tbl; - uint64_t id; + unsigned int id; struct rtsp *rtsp; uint16_t rtp_ports[2]; struct wfd_video_formats *vformats; diff --git a/src/ctl/wfdctl.c b/src/ctl/wfdctl.c index 76f6a7d..395471e 100644 --- a/src/ctl/wfdctl.c +++ b/src/ctl/wfdctl.c @@ -165,7 +165,7 @@ end: return r; } -uint64_t ctl_wfd_alloc_session_id(struct ctl_wfd *wfd) +unsigned int ctl_wfd_alloc_session_id(struct ctl_wfd *wfd) { return ++wfd->id_pool; } @@ -178,7 +178,7 @@ int ctl_wfd_add_session(struct ctl_wfd *wfd, struct wfd_session *s) assert(s && wfd_session_get_id(s)); assert(!ctl_wfd_find_session_by_id(wfd, wfd_session_get_id(s), NULL)); - r = shl_htable_insert_u64(&wfd->sessions, wfd_session_to_htable(s)); + r = shl_htable_insert_uint(&wfd->sessions, wfd_session_to_htable(s)); if(0 > r) { return r; } @@ -191,11 +191,11 @@ int ctl_wfd_add_session(struct ctl_wfd *wfd, struct wfd_session *s) } int ctl_wfd_find_session_by_id(struct ctl_wfd *wfd, - uint64_t id, + unsigned int id, struct wfd_session **out) { - uint64_t *entry; - int r = shl_htable_lookup_u64(&wfd->sessions, id, &entry); + unsigned int *entry; + int r = shl_htable_lookup_uint(&wfd->sessions, id, &entry); if(r && out) { *out = wfd_session_from_htable(entry); } @@ -204,12 +204,12 @@ int ctl_wfd_find_session_by_id(struct ctl_wfd *wfd, } int ctl_wfd_remove_session_by_id(struct ctl_wfd *wfd, - uint64_t id, + unsigned int id, struct wfd_session **out) { - uint64_t *entry; + unsigned int *entry; struct wfd_session *s; - int r = shl_htable_remove_u64(&wfd->sessions, id, &entry); + int r = shl_htable_remove_uint(&wfd->sessions, id, &entry); if(!r) { return 0; }