fix warnings on some systems / format specifier mismatch

Instead of %ld or %lx, use %jd or %jx
for off_t (after casting to intmax_t)

Change-Id: I4cd1831816820d2862b383ff8782e548b2fca294
This commit is contained in:
Christian Soffke 2024-12-05 00:07:12 +01:00
parent 93ecb97693
commit 87452d775e
6 changed files with 70 additions and 60 deletions

View file

@ -282,8 +282,9 @@ static int audio_sync(struct audio_thread_data *td,
{
if (audio_buffer(str, STREAM_PM_RANDOM_ACCESS) == STREAM_DATA_END)
{
DEBUGF("audio_sync:STR_DATA_END\n aqu:%ld swl:%ld swr:%ld\n",
(long)audio_queue.used, str->hdr.win_left, str->hdr.win_right);
DEBUGF("audio_sync:STR_DATA_END\n aqu:%ld swl:%jd swr:%jd\n",
(long)audio_queue.used, (intmax_t) str->hdr.win_left,
(intmax_t) str->hdr.win_right);
if (audio_queue.used <= MAD_BUFFER_GUARD)
goto sync_data_end;
}

View file

@ -79,10 +79,10 @@ static int disk_buf_on_data_notify(struct stream_hdr *sh)
{
/* It was - don't register */
DEBUGF("(was ready)\n"
" swl:%lu swr:%lu\n"
" dwl:%lu dwr:%lu\n",
sh->win_left, sh->win_right,
disk_buf.win_left, disk_buf.win_right);
" swl:%jd swr:%jd\n"
" dwl:%jd dwr:%jd\n",
(intmax_t) sh->win_left, (intmax_t) sh->win_right,
(intmax_t) disk_buf.win_left, (intmax_t) disk_buf.win_right);
/* Be sure it's not listed though if multiple requests were made */
list_remove_item(nf_list, sh);
return DISK_BUF_NOTIFY_OK;
@ -96,10 +96,10 @@ static int disk_buf_on_data_notify(struct stream_hdr *sh)
disk_buf.state = TSTATE_BUFFERING;
list_add_item(nf_list, sh);
DEBUGF("(registered)\n"
" swl:%lu swr:%lu\n"
" dwl:%lu dwr:%lu\n",
sh->win_left, sh->win_right,
disk_buf.win_left, disk_buf.win_right);
" swl:%jd swr:%jd\n"
" dwl:%jd dwr:%jd\n",
(intmax_t) sh->win_left, (intmax_t) sh->win_right,
(intmax_t) disk_buf.win_left, (intmax_t) disk_buf.win_right);
return DISK_BUF_NOTIFY_REGISTERED;
}
}
@ -347,8 +347,8 @@ static void disk_buf_on_reset(ssize_t pos)
disk_buf.tail = disk_buf.start + MAP_OFFSET_TO_BUFFER(anchor);
DEBUGF("disk buf reset\n"
" dwl:%ld dwr:%ld\n",
disk_buf.win_left, disk_buf.win_right);
" dwl:%jd dwr:%jd\n",
(intmax_t) disk_buf.win_left, (intmax_t) disk_buf.win_right);
/* Next read position is at right edge */
rb->lseek(disk_buf.in_file, disk_buf.win_right, SEEK_SET);
@ -786,12 +786,14 @@ ssize_t disk_buf_prepare_streaming(off_t pos, size_t len)
else if (pos > disk_buf.filesize)
pos = disk_buf.filesize;
DEBUGF("prepare streaming:\n pos:%ld len:%lu\n", pos, (unsigned long)len);
DEBUGF("prepare streaming:\n pos:%jd len:%lu\n",
(intmax_t) pos, (unsigned long)len);
pos = disk_buf_lseek(pos, SEEK_SET);
len = disk_buf_probe(pos, len, NULL);
DEBUGF(" probe done: pos:%ld len:%lu\n", pos, (unsigned long)len);
DEBUGF(" probe done: pos:%jd len:%lu\n",
(intmax_t) pos, (unsigned long)len);
len = disk_buf_send_msg(STREAM_RESET, pos);

View file

@ -495,7 +495,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id)
case STATE0:
/* Hardly likely except at very beginning - just do L->R scan
* to find something */
DEBUGF("!! no timestamp on first probe: %ld\n", sk.pos);
DEBUGF("!! no timestamp on first probe: %jd\n", (intmax_t) sk.pos);
case STATE2:
case STATE3:
/* Could just be missing timestamps because the interval is
@ -733,10 +733,10 @@ static int parse_demux(struct stream *str, enum stream_parse_mode type)
/* Problem? Meh...probably not but just a corrupted section.
* Try to resync the parser which will probably succeed. */
DEBUGF("packet start code prefix not found: 0x%02x\n"
" wl:%lu wr:%lu\n"
" wl:%jd wr:%jd\n"
" p:%p cp:%p cpe:%p\n"
" dbs:%p dbe:%p dbt:%p\n",
str->id, str->hdr.win_left, str->hdr.win_right,
str->id, (intmax_t) str->hdr.win_left, (intmax_t) str->hdr.win_right,
p, str->curr_packet, str->curr_packet_end,
disk_buf.start, disk_buf.end, disk_buf.tail);
str->state = SSTATE_SYNC;
@ -993,7 +993,7 @@ try_again:
if (mpeg_parser_scan_start_code(&sk, MPEG_START_GOP))
{
DEBUGF("GOP found at: %ld\n", sk.pos);
DEBUGF("GOP found at: %jd\n", (intmax_t) sk.pos);
unsigned id = mpeg_parser_scan_pes(&sk);
@ -1019,7 +1019,7 @@ try_again:
str_parser.parms.sd.sk.len = 1024*1024;
str_parser.parms.sd.sk.dir = SSCAN_FORWARD;
DEBUGF("thumb pos:%ld len:%ld\n", str_parser.parms.sd.sk.pos,
DEBUGF("thumb pos:%jd len:%ld\n", (intmax_t) str_parser.parms.sd.sk.pos,
(long)str_parser.parms.sd.sk.len);
result = str_send_msg(&video_str, STREAM_SYNC,
@ -1072,7 +1072,8 @@ void parser_prepare_streaming(void)
if (!stream_get_window(&sw))
sw.left = sw.right = disk_buf.filesize;
DEBUGF(" swl:%ld swr:%ld\n", sw.left, sw.right);
DEBUGF(" swl:%jd swr:%jd\n",
(intmax_t) sw.left, (intmax_t) sw.right);
if (sw.right > disk_buf.filesize - 4*MIN_BUFAHEAD)
sw.right = disk_buf.filesize - 4*MIN_BUFAHEAD;

View file

@ -393,7 +393,8 @@ static void save_bookmark(const char *fname, int wpm)
}
rb->close(bookmark_fd);
}
rb->fdprintf(tmp_fd, "%ld %d %d %s\n", line_offs, word_num, wpm, fname);
rb->fdprintf(tmp_fd, "%jd %d %d %s\n",
(intmax_t) line_offs, word_num, wpm, fname);
rb->close(tmp_fd);
rb->rename(BOOKMARK_FILE ".tmp", BOOKMARK_FILE);
}
@ -585,7 +586,8 @@ static int poll_input(int *wpm, long *clear, const char *fname, off_t file_size)
offs += 99 * SEEK_INTERVAL;
else if(offs >= 10 * SEEK_INTERVAL)
offs += 9 * SEEK_INTERVAL;
rb->splashf(0, "%ld/%ld bytes", offs + base_offs, file_size);
rb->splashf(0, "%jd/%jd bytes",
(intmax_t) (offs + base_offs), (intmax_t) file_size);
rb->sleep(HZ/20);
} while(get_useraction() == FFWD && offs + base_offs < file_size && offs + base_offs >= 0);
@ -614,7 +616,8 @@ static int poll_input(int *wpm, long *clear, const char *fname, off_t file_size)
offs -= 99 * SEEK_INTERVAL;
else if(offs <= -10 * SEEK_INTERVAL)
offs -= 9 * SEEK_INTERVAL;
rb->splashf(0, "%ld/%ld bytes", offs + base_offs, file_size);
rb->splashf(0, "%jd/%jd bytes",
(intmax_t) (offs + base_offs), (intmax_t) file_size);
rb->sleep(HZ/20);
} while(get_useraction() == FFWD && offs + base_offs < file_size && offs + base_offs >= 0);

View file

@ -218,7 +218,8 @@ void tv_convert_fpos(off_t fpos, struct tv_screen_pos *pos)
tv_seek_page(i, SEEK_SET);
while (tv_create_line_positions() && cur_pos.file_pos < fpos)
rb->splashf(0, "converting %ld%%...", 100 * cur_pos.file_pos / fpos); // XXX i18n
rb->splashf(0, "converting %jd%%...",
(intmax_t) (100 * cur_pos.file_pos / fpos)); // XXX i18n
if (i < max_page)
cur_pos.page--;
@ -239,7 +240,8 @@ static void tv_seek_to_bottom_line(void)
tv_seek_page(0, SEEK_END);
while (tv_create_line_positions())
rb->splashf(0, "loading %ld%%...", 100 * cur_pos.file_pos / total_size); // XXX i18n
rb->splashf(0, "loading %jd%%...",
(intmax_t) (100 * cur_pos.file_pos / total_size)); // XXX i18n
cur_pos.line = lines_per_page - 1;
}

View file

@ -204,13 +204,14 @@ enum codec_status codec_run(void)
}
if (looping) {
DEBUGF("ADX: looped, start: %lx end: %lx\n",start_adr,end_adr);
DEBUGF("ADX: looped, start: %jx end: %jx\n",
(intmax_t) start_adr, (intmax_t) end_adr);
} else {
DEBUGF("ADX: not looped\n");
}
/* advance to first frame */
DEBUGF("ADX: first frame at %lx\n",chanstart);
DEBUGF("ADX: first frame at %jx\n", (intmax_t) chanstart);
bufoff = chanstart;
/* get in position */
@ -310,8 +311,8 @@ enum codec_status codec_run(void)
buf = ci->request_buffer(&n, 18);
if (!buf || n!=18) {
DEBUGF("ADX: couldn't get buffer at %lx\n",
bufoff);
DEBUGF("ADX: couldn't get buffer at %jx\n",
(intmax_t) bufoff);
return CODEC_ERROR;
}
@ -348,8 +349,8 @@ enum codec_status codec_run(void)
buf = ci->request_buffer(&n, 18);
if (!buf || n!=18) {
DEBUGF("ADX: couldn't get buffer at %lx\n",
bufoff);
DEBUGF("ADX: couldn't get buffer at %jx\n",
(intmax_t) bufoff);
return CODEC_ERROR;
}