diff options
author | Khem Raj <raj.khem@gmail.com> | 2019-11-12 11:12:26 -0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2019-11-13 07:15:16 -0800 |
commit | 2ba0c6e11402f7e7f123452baab9a5810d5970ac (patch) | |
tree | e03bf4986a9fa194690b30e38d9037af5a0bdebb | |
parent | cd0aff0e6018d49c08f081f22befc68de167ddbc (diff) | |
download | meta-openembedded-2ba0c6e11402f7e7f123452baab9a5810d5970ac.tar.gz |
tvheadend: Fix build with 64bit time_t
use intmax_t to print time_t, makes it portable across musl/glibc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r-- | meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-adjust-for-64bit-time_t.patch | 176 | ||||
-rw-r--r-- | meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb | 4 |
2 files changed, 179 insertions, 1 deletions
diff --git a/meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-adjust-for-64bit-time_t.patch b/meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-adjust-for-64bit-time_t.patch new file mode 100644 index 0000000000..59bd4ef08f --- /dev/null +++ b/meta-multimedia/recipes-dvb/tvheadend/tvheadend/0001-adjust-for-64bit-time_t.patch | |||
@@ -0,0 +1,176 @@ | |||
1 | From 81f29b028473a3d8ac0aaeb126fc0336a98bb077 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Tue, 12 Nov 2019 11:03:16 -0800 | ||
4 | Subject: [PATCH] adjust for 64bit time_t | ||
5 | |||
6 | Break assumption about time_t being of certain size, and use intmax_t to | ||
7 | print it where needed | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
11 | --- | ||
12 | src/cron.c | 4 ++-- | ||
13 | src/epggrab/module/psip.c | 2 +- | ||
14 | src/epggrab/otamux.c | 2 +- | ||
15 | src/parsers/parser_teletext.c | 2 +- | ||
16 | src/tvheadend.h | 6 +----- | ||
17 | src/webui/webui.c | 4 ++-- | ||
18 | 6 files changed, 8 insertions(+), 12 deletions(-) | ||
19 | |||
20 | --- a/src/cron.c | ||
21 | +++ b/src/cron.c | ||
22 | @@ -329,9 +329,9 @@ cron_next ( cron_t *c, const time_t now, | ||
23 | *ret = mktime(&tmp); | ||
24 | if (*ret <= now) { | ||
25 | #ifndef CRON_TEST | ||
26 | - tvherror(LS_CRON, "invalid time, now %"PRItime_t", result %"PRItime_t, now, *ret); | ||
27 | + tvherror(LS_CRON, "invalid time, now %"PRItime_t", result %"PRItime_t, (intmax_t)now, (intmax_t)*ret); | ||
28 | #else | ||
29 | - printf("ERROR: invalid time, now %"PRItime_t", result %"PRItime_t"\n", now, *ret); | ||
30 | + printf("ERROR: invalid time, now %"PRItime_t", result %"PRItime_t"\n", (intmax_t)now, (intmax_t)*ret); | ||
31 | #endif | ||
32 | *ret = now + 600; | ||
33 | } | ||
34 | --- a/src/epggrab/module/psip.c | ||
35 | +++ b/src/epggrab/module/psip.c | ||
36 | @@ -383,14 +383,14 @@ _psip_eit_callback_channel | ||
37 | |||
38 | tvhtrace(LS_PSIP, " %03d: [%s] eventid 0x%04x at %"PRItime_t", duration %d, title: '%s' (%d bytes)", | ||
39 | i, ch ? channel_get_name(ch, channel_blank_name) : "(null)", | ||
40 | - eventid, start, length, | ||
41 | + eventid, (intmax_t)start, length, | ||
42 | lang_str_get(title, NULL), titlelen); | ||
43 | |||
44 | save2 = changes2 = 0; | ||
45 | |||
46 | ebc = epg_broadcast_find_by_time(ch, mod, start, stop, 1, &save2, &changes2); | ||
47 | tvhtrace(LS_PSIP, " eid=%5d, start=%"PRItime_t", stop=%"PRItime_t", ebc=%p", | ||
48 | - eventid, start, stop, ebc); | ||
49 | + eventid, (intmax_t)start, (intmax_t)stop, ebc); | ||
50 | if (!ebc) goto next; | ||
51 | |||
52 | save2 |= epg_broadcast_set_dvb_eid(ebc, eventid, &changes2); | ||
53 | --- a/src/epggrab/otamux.c | ||
54 | +++ b/src/epggrab/otamux.c | ||
55 | @@ -719,7 +719,7 @@ epggrab_ota_start_cb ( void *p ); | ||
56 | static void | ||
57 | epggrab_ota_next_arm( time_t next ) | ||
58 | { | ||
59 | - tvhtrace(LS_EPGGRAB, "next ota start event in %li seconds", next - time(NULL)); | ||
60 | + tvhtrace(LS_EPGGRAB, "next ota start event in %jd seconds", (intmax_t)(next - time(NULL))); | ||
61 | gtimer_arm_absn(&epggrab_ota_start_timer, epggrab_ota_start_cb, NULL, next); | ||
62 | dbus_emit_signal_s64("/epggrab/ota", "next", next); | ||
63 | } | ||
64 | --- a/src/parsers/parser_teletext.c | ||
65 | +++ b/src/parsers/parser_teletext.c | ||
66 | @@ -625,7 +625,7 @@ tt_construct_unix_time(uint8_t *buf) | ||
67 | r[2] = mktime(&tm); | ||
68 | |||
69 | for(i = 0; i < 3; i++) | ||
70 | - v[i] = labs(r[i] - t); | ||
71 | + v[i] = (time_t)llabs((long long)(r[i] - t)); | ||
72 | |||
73 | if(v[0] < v[1] && v[0] < v[2]) | ||
74 | return r[0]; | ||
75 | --- a/src/tvheadend.h | ||
76 | +++ b/src/tvheadend.h | ||
77 | @@ -332,11 +332,7 @@ void tvh_qsort_r(void *base, size_t nmem | ||
78 | # endif /* ULONG_MAX */ | ||
79 | #endif /* __WORDSIZE */ | ||
80 | |||
81 | -#if __WORDSIZE == 32 && defined(PLATFORM_FREEBSD) | ||
82 | -#define PRItime_t "d" | ||
83 | -#else | ||
84 | -#define PRItime_t "ld" | ||
85 | -#endif | ||
86 | +#define PRItime_t "jd" | ||
87 | |||
88 | /* transcoding */ | ||
89 | #define TVH_NAME_LEN 32 | ||
90 | --- a/src/webui/webui.c | ||
91 | +++ b/src/webui/webui.c | ||
92 | @@ -886,9 +886,9 @@ http_dvr_list_playlist(http_connection_t | ||
93 | bandwidth = ((8*fsize) / (durration*1024.0)); | ||
94 | strftime(buf, sizeof(buf), "%FT%T%z", localtime_r(&(de->de_start), &tm)); | ||
95 | |||
96 | - htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL)); | ||
97 | + htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", (intmax_t)durration, lang_str_get(de->de_title, NULL)); | ||
98 | |||
99 | - htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", durration); | ||
100 | + htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", (intmax_t)durration); | ||
101 | uuid = idnode_uuid_as_str(&de->de_id, ubuf); | ||
102 | htsbuf_qprintf(hq, "#EXT-X-STREAM-INF:PROGRAM-ID=%s,BANDWIDTH=%d\n", uuid, bandwidth); | ||
103 | htsbuf_qprintf(hq, "#EXT-X-PROGRAM-DATE-TIME:%s\n", buf); | ||
104 | @@ -944,9 +944,9 @@ http_dvr_playlist(http_connection_t *hc, | ||
105 | strftime(buf, sizeof(buf), "%FT%T%z", localtime_r(&(de->de_start), &tm)); | ||
106 | |||
107 | htsbuf_append_str(hq, "#EXTM3U\n"); | ||
108 | - htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", durration, lang_str_get(de->de_title, NULL)); | ||
109 | + htsbuf_qprintf(hq, "#EXTINF:%"PRItime_t",%s\n", (intmax_t)durration, lang_str_get(de->de_title, NULL)); | ||
110 | |||
111 | - htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", durration); | ||
112 | + htsbuf_qprintf(hq, "#EXT-X-TARGETDURATION:%"PRItime_t"\n", (intmax_t)durration); | ||
113 | uuid = idnode_uuid_as_str(&de->de_id, ubuf); | ||
114 | htsbuf_qprintf(hq, "#EXT-X-STREAM-INF:PROGRAM-ID=%s,BANDWIDTH=%d\n", uuid, bandwidth); | ||
115 | htsbuf_qprintf(hq, "#EXT-X-PROGRAM-DATE-TIME:%s\n", buf); | ||
116 | --- a/src/dvr/dvr_rec.c | ||
117 | +++ b/src/dvr/dvr_rec.c | ||
118 | @@ -723,7 +723,7 @@ static const char * | ||
119 | dvr_sub_start(const char *id, const char *fmt, const void *aux, char *tmp, size_t tmplen) | ||
120 | { | ||
121 | char buf[16]; | ||
122 | - snprintf(buf, sizeof(buf), "%"PRItime_t, (time_t)dvr_entry_get_start_time((dvr_entry_t *)aux, 0)); | ||
123 | + snprintf(buf, sizeof(buf), "%"PRItime_t, (intmax_t)dvr_entry_get_start_time((dvr_entry_t *)aux, 0)); | ||
124 | return dvr_do_prefix(id, fmt, buf, tmp, tmplen); | ||
125 | } | ||
126 | |||
127 | @@ -747,7 +747,7 @@ static const char * | ||
128 | dvr_sub_stop(const char *id, const char *fmt, const void *aux, char *tmp, size_t tmplen) | ||
129 | { | ||
130 | char buf[16]; | ||
131 | - snprintf(buf, sizeof(buf), "%"PRItime_t, (time_t)dvr_entry_get_stop_time((dvr_entry_t *)aux)); | ||
132 | + snprintf(buf, sizeof(buf), "%"PRItime_t, (intmax_t)dvr_entry_get_stop_time((dvr_entry_t *)aux)); | ||
133 | return dvr_do_prefix(id, fmt, buf, tmp, tmplen); | ||
134 | } | ||
135 | |||
136 | --- a/src/epggrab/module.c | ||
137 | +++ b/src/epggrab/module.c | ||
138 | @@ -582,7 +582,7 @@ static void _epggrab_socket_handler ( ep | ||
139 | |||
140 | /* Process */ | ||
141 | if ( data ) { | ||
142 | - tvhinfo(mod->subsys, "%s: grab took %"PRItime_t" seconds", mod->id, tm2 - tm1); | ||
143 | + tvhinfo(mod->subsys, "%s: grab took %"PRItime_t" seconds", mod->id, (intmax_t)(tm2 - tm1)); | ||
144 | epggrab_module_parse(mod, data); | ||
145 | |||
146 | /* Failed */ | ||
147 | --- a/src/epggrab/module/opentv.c | ||
148 | +++ b/src/epggrab/module/opentv.c | ||
149 | @@ -486,7 +486,7 @@ opentv_parse_event_section_one | ||
150 | 1, &save, &changes); | ||
151 | tvhdebug(LS_OPENTV, "find by time start %"PRItime_t " stop " | ||
152 | "%"PRItime_t " eid %d = %p", | ||
153 | - ev.start, ev.stop, ev.eid, ebc); | ||
154 | + (intmax_t)ev.start, (intmax_t)ev.stop, ev.eid, ebc); | ||
155 | save |= epg_broadcast_set_dvb_eid(ebc, ev.eid, &changes); | ||
156 | } else { | ||
157 | ebc = epg_broadcast_find_by_eid(ch, ev.eid); | ||
158 | --- a/src/webui/simpleui.c | ||
159 | +++ b/src/webui/simpleui.c | ||
160 | @@ -556,12 +556,12 @@ page_status(http_connection_t *hc, | ||
161 | "<title>%s</title>\n", | ||
162 | a.tm_year + 1900, a.tm_mon + 1, a.tm_mday, | ||
163 | a.tm_hour, a.tm_min, | ||
164 | - de->de_start, | ||
165 | - (time_t)dvr_entry_get_extra_time_pre(de), | ||
166 | + (intmax_t)de->de_start, | ||
167 | + (intmax_t)dvr_entry_get_extra_time_pre(de), | ||
168 | b.tm_year+1900, b.tm_mon + 1, b.tm_mday, | ||
169 | b.tm_hour, b.tm_min, | ||
170 | - de->de_stop, | ||
171 | - (time_t)dvr_entry_get_extra_time_post(de), | ||
172 | + (intmax_t)de->de_stop, | ||
173 | + (intmax_t)dvr_entry_get_extra_time_post(de), | ||
174 | buf); | ||
175 | |||
176 | rstatus = val2str(de->de_sched_state, recstatustxt); | ||
diff --git a/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb b/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb index 5b3c469793..d7f749b647 100644 --- a/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb +++ b/meta-multimedia/recipes-dvb/tvheadend/tvheadend_git.bb | |||
@@ -8,7 +8,9 @@ DEPENDS = "avahi cmake-native dvb-apps libdvbcsa libpcre2 openssl uriparser zlib | |||
8 | LICENSE = "GPLv3+" | 8 | LICENSE = "GPLv3+" |
9 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=9cae5acac2e9ee2fc3aec01ac88ce5db" | 9 | LIC_FILES_CHKSUM = "file://LICENSE.md;md5=9cae5acac2e9ee2fc3aec01ac88ce5db" |
10 | 10 | ||
11 | SRC_URI = "git://github.com/tvheadend/tvheadend.git" | 11 | SRC_URI = "git://github.com/tvheadend/tvheadend.git \ |
12 | file://0001-adjust-for-64bit-time_t.patch \ | ||
13 | " | ||
12 | 14 | ||
13 | SRCREV = "fda89e85e0b6ae796d8a09e178d3937aa7869270" | 15 | SRCREV = "fda89e85e0b6ae796d8a09e178d3937aa7869270" |
14 | PV = "4.3+git${SRCPV}" | 16 | PV = "4.3+git${SRCPV}" |