From 09e59d2f834072c33cc5c897da5ee152b8284100 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Fri, 1 Aug 2014 11:38:37 +0200 Subject: [PATCH] Remove PRIsize_t, PRIssize_t and PRIoff_t The reason is that size_t and ssize_t are covered by %zu and %zd format specifiers. The offset can be printed using %jd format with the (intmax_t) type conversion. --- src/descrambler/cwc.c | 2 +- src/input/mpegts/tsfile/tsfile_input.c | 4 ++-- src/parsers/parsers.c | 2 +- src/timeshift.c | 4 ++-- src/timeshift/timeshift_reader.c | 6 +++--- src/tvheadend.h | 25 ++----------------------- src/webui/webui.c | 5 +++-- 7 files changed, 14 insertions(+), 34 deletions(-) diff --git a/src/descrambler/cwc.c b/src/descrambler/cwc.c index af9f64c4..a47caf2a 100755 --- a/src/descrambler/cwc.c +++ b/src/descrambler/cwc.c @@ -486,7 +486,7 @@ cwc_send_msg(cwc_t *cwc, const uint8_t *msg, size_t len, int sid, int enq, uint1 return -1; } - tvhtrace("cwc", "sending message sid %d len %"PRIsize_t" enq %d", sid, len, enq); + tvhtrace("cwc", "sending message sid %d len %zu enq %d", sid, len, enq); tvhlog_hexdump("cwc", buf, len); buf[0] = (len - 2) >> 8; diff --git a/src/input/mpegts/tsfile/tsfile_input.c b/src/input/mpegts/tsfile/tsfile_input.c index d5e7da84..bced0a2a 100644 --- a/src/input/mpegts/tsfile/tsfile_input.c +++ b/src/input/mpegts/tsfile/tsfile_input.c @@ -87,8 +87,8 @@ tsfile_input_thread ( void *aux ) /* Check for extra (incomplete) packet at end */ rem = st.st_size % 188; len = 0; - tvhtrace("tsfile", "adapter %d file size %"PRIoff_t " rem %"PRIsize_t, - mi->mi_instance, st.st_size, rem); + tvhtrace("tsfile", "adapter %d file size %jd rem %zu", + mi->mi_instance, (intmax_t)st.st_size, rem); /* Process input */ while (1) { diff --git a/src/parsers/parsers.c b/src/parsers/parsers.c index 277438d2..a930a7ca 100644 --- a/src/parsers/parsers.c +++ b/src/parsers/parsers.c @@ -1384,7 +1384,7 @@ parser_deliver(service_t *t, elementary_stream_t *st, th_pkt_t *pkt, int error) tvhtrace("parser", "pkt stream %2d %-12s type %c dts %10"PRId64" pts %10"PRId64 - " dur %10d len %10"PRIsize_t, + " dur %10d len %10zu", st->es_index, streaming_component_type2txt(st->es_type), pkt_frametype_to_char(pkt->pkt_frametype), diff --git a/src/timeshift.c b/src/timeshift.c index ad16c83f..c96d80f6 100644 --- a/src/timeshift.c +++ b/src/timeshift.c @@ -140,7 +140,7 @@ static void timeshift_input if (sm->sm_type == SMT_PACKET) { tvhtrace("timeshift", "ts %d pkt in - stream %d type %c pts %10"PRId64 - " dts %10"PRId64" dur %10d len %"PRIsize_t, + " dts %10"PRId64" dur %10d len %zu", ts->id, pkt->pkt_componentindex, pkt_frametype_to_char(pkt->pkt_frametype), @@ -178,7 +178,7 @@ static void timeshift_input if (sm->sm_type == SMT_PACKET) { tvhtrace("timeshift", "ts %d pkt buf - stream %d type %c pts %10"PRId64 - " dts %10"PRId64" dur %10d len %"PRIsize_t, + " dts %10"PRId64" dur %10d len %zu", ts->id, pkt->pkt_componentindex, pkt_frametype_to_char(pkt->pkt_frametype), diff --git a/src/timeshift/timeshift_reader.c b/src/timeshift/timeshift_reader.c index eaa0788c..a73d2df7 100644 --- a/src/timeshift/timeshift_reader.c +++ b/src/timeshift/timeshift_reader.c @@ -325,7 +325,7 @@ static int _timeshift_read ts->id, (*cur_file)->path); *fd = open((*cur_file)->path, O_RDONLY); } - tvhtrace("timeshift", "ts %d seek to %"PRIoff_t, ts->id, *cur_off); + tvhtrace("timeshift", "ts %d seek to %jd", ts->id, (intmax_t)*cur_off); lseek(*fd, *cur_off, SEEK_SET); /* Read msg */ @@ -336,7 +336,7 @@ static int _timeshift_read tvhlog(LOG_ERR, "timeshift", "ts %d could not read buffer", ts->id); return -1; } - tvhtrace("timeshift", "ts %d read msg %p (%"PRIssize_t")", + tvhtrace("timeshift", "ts %d read msg %p (%zd)", ts->id, *sm, r); /* Incomplete */ @@ -736,7 +736,7 @@ void *timeshift_reader ( void *p ) th_pkt_t *pkt = sm->sm_data; tvhtrace("timeshift", "ts %d pkt out - stream %d type %c pts %10"PRId64 - " dts %10"PRId64 " dur %10d len %"PRIsize_t" time %"PRId64, + " dts %10"PRId64 " dur %10d len %zu time %"PRId64, ts->id, pkt->pkt_componentindex, pkt_frametype_to_char(pkt->pkt_frametype), diff --git a/src/tvheadend.h b/src/tvheadend.h index 7d62a0e7..2aee1fa6 100644 --- a/src/tvheadend.h +++ b/src/tvheadend.h @@ -702,31 +702,10 @@ void tvh_qsort_r(void *base, size_t nmemb, size_t size, int (*compar)(const void # endif /* ULONG_MAX */ #endif /* __WORDSIZE */ -# if __WORDSIZE == 64 -#define PRIsword_t PRId64 -#define PRIuword_t PRIu64 -#else -#define PRIsword_t PRId32 -#define PRIuword_t PRIu32 -#endif -#define PRIslongword_t "ld" -#define PRIulongword_t "lu" -#if defined(PLATFORM_DARWIN) -#define PRIsize_t PRIulongword_t -#define PRIssize_t PRIslongword_t -#else -#define PRIsize_t PRIuword_t -#define PRIssize_t PRIsword_t -#endif #if __WORDSIZE == 32 && defined(PLATFORM_FREEBSD) -#define PRItime_t PRIsword_t +#define PRItime_t "d" #else -#define PRItime_t PRIslongword_t -#endif -#if _FILE_OFFSET_BITS == 64 -#define PRIoff_t PRId64 -#else -#define PRIoff_t PRIslongword_t +#define PRItime_t "ld" #endif #endif /* TV_HEAD_H */ diff --git a/src/webui/webui.c b/src/webui/webui.c index 91b3ec42..8e3f38d8 100644 --- a/src/webui/webui.c +++ b/src/webui/webui.c @@ -1060,7 +1060,8 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque) char *fname; char range_buf[255]; char disposition[256]; - off_t content_len, file_start, file_end, chunk; + off_t content_len, chunk; + intmax_t file_start, file_end; #if defined(PLATFORM_LINUX) ssize_t r; #elif defined(PLATFORM_FREEBSD) || defined(PLATFORM_DARWIN) @@ -1099,7 +1100,7 @@ page_dvrfile(http_connection_t *hc, const char *remain, void *opaque) range = http_arg_get(&hc->hc_args, "Range"); if(range != NULL) - sscanf(range, "bytes=%"PRId64"-%"PRId64"", &file_start, &file_end); + sscanf(range, "bytes=%jd-%jd", &file_start, &file_end); //Sanity checks if(file_start < 0 || file_start >= st.st_size) {