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.
This commit is contained in:
Jaroslav Kysela 2014-08-01 11:38:37 +02:00
parent d26ccbdbed
commit 09e59d2f83
7 changed files with 14 additions and 34 deletions

View file

@ -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;

View file

@ -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) {

View file

@ -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),

View file

@ -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),

View file

@ -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),

View file

@ -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 */

View file

@ -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) {