diff options
author | Christian Soffke <christian.soffke@gmail.com> | 2024-12-05 00:07:12 +0100 |
---|---|---|
committer | Christian Soffke <christian.soffke@gmail.com> | 2024-12-07 11:07:44 -0500 |
commit | 87452d775e693818b50096d9692ee9d04549adfc (patch) | |
tree | 696f17bf70d61eeaf9f183b82fdcf5013484eff1 | |
parent | 93ecb97693d536daa7016a6134d2f374d40d88ee (diff) | |
download | rockbox-87452d775e.tar.gz rockbox-87452d775e.zip |
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
-rw-r--r-- | apps/plugins/mpegplayer/audio_thread.c | 13 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/disk_buf.c | 32 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_parser.c | 17 | ||||
-rw-r--r-- | apps/plugins/speedread.c | 9 | ||||
-rw-r--r-- | apps/plugins/text_viewer/tv_pager.c | 6 | ||||
-rw-r--r-- | lib/rbcodec/codecs/adx.c | 53 |
6 files changed, 70 insertions, 60 deletions
diff --git a/apps/plugins/mpegplayer/audio_thread.c b/apps/plugins/mpegplayer/audio_thread.c index 6f39425630..d1fdcfd4f3 100644 --- a/apps/plugins/mpegplayer/audio_thread.c +++ b/apps/plugins/mpegplayer/audio_thread.c @@ -231,13 +231,13 @@ static void init_mad(void) frame.sbsample = &sbsample; /* We do this so libmad doesn't try to call codec_calloc(). This needs to - * be called before mad_stream_init(), mad_frame_inti() and + * be called before mad_stream_init(), mad_frame_inti() and * mad_synth_init(). */ frame.overlap = &mad_frame_overlap; stream.main_data = &mad_main_data; /* Call mad initialization. Those will zero the arrays frame.overlap, - * frame.sbsample and frame.sbsample_prev. Therefore there is no need to + * frame.sbsample and frame.sbsample_prev. Therefore there is no need to * zero them here. */ mad_stream_init(&stream); mad_frame_init(&frame); @@ -270,7 +270,7 @@ static int audio_sync(struct audio_thread_data *td, time = INVALID_TIMESTAMP; str = &tmp_str; str->id = audio_str.id; - } + } str->hdr.pos = sd->sk.pos; str->hdr.limit = sd->sk.pos + sd->sk.len; @@ -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; } @@ -401,7 +402,7 @@ static void audio_thread_msg(struct audio_thread_data *td) td->state = TSTATE_EOS; reply = true; - break; + break; case STREAM_RESET: if (td->state == TSTATE_DATA) diff --git a/apps/plugins/mpegplayer/disk_buf.c b/apps/plugins/mpegplayer/disk_buf.c index 50c4222192..6bc4e092f2 100644 --- a/apps/plugins/mpegplayer/disk_buf.c +++ b/apps/plugins/mpegplayer/disk_buf.c @@ -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; } } @@ -307,7 +307,7 @@ static void disk_buf_on_reset(ssize_t pos) { if (--tag, --page < 0) page = disk_buf.pgcount - 1; - + if (disk_buf.cache[page] != tag) break; @@ -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); @@ -466,7 +466,7 @@ static void disk_buf_thread(void) disk_buf.state = TSTATE_EOS; disk_buf.status = STREAM_STOPPED; - while (1) + while (1) { if (disk_buf.state != TSTATE_EOS) { @@ -591,7 +591,7 @@ static ssize_t disk_buf_probe(off_t start, size_t length, void **p) rng.tag_start = tag; rng.tag_end = tag_end; rng.pg_start = page; - + result = rb->queue_send(disk_buf.q, DISK_BUF_CACHE_RANGE, (intptr_t)&rng); @@ -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); diff --git a/apps/plugins/mpegplayer/mpeg_parser.c b/apps/plugins/mpegplayer/mpeg_parser.c index cc57b0c43c..9438730c81 100644 --- a/apps/plugins/mpegplayer/mpeg_parser.c +++ b/apps/plugins/mpegplayer/mpeg_parser.c @@ -434,7 +434,7 @@ static off_t mpeg_parser_seek_PTS(uint32_t time, unsigned id) state = STATE2; /* Last scan was early */ sk.dir = SSCAN_REVERSE; - + DEBUGF(">> tl:%u t:%u ct:%u tr:%u\n pl:%ld pn:%ld pr:%ld\n", (unsigned)time_left, (unsigned)time, (unsigned)currpts, (unsigned)time_right, (long)pos_left, (long)pos_new, @@ -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; @@ -1094,7 +1095,7 @@ int parser_init_stream(void) * should succeed if it really is a video-only stream */ video_str.hdr.pos = 0; video_str.hdr.limit = 256*1024; - + if (parse_demux(&video_str, STREAM_PM_RANDOM_ACCESS) == STREAM_OK) { /* Found a video packet - assume program stream */ diff --git a/apps/plugins/speedread.c b/apps/plugins/speedread.c index 7a9ab61e7c..18075803f7 100644 --- a/apps/plugins/speedread.c +++ b/apps/plugins/speedread.c @@ -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); diff --git a/apps/plugins/text_viewer/tv_pager.c b/apps/plugins/text_viewer/tv_pager.c index 0e775f6d0d..628d67f959 100644 --- a/apps/plugins/text_viewer/tv_pager.c +++ b/apps/plugins/text_viewer/tv_pager.c @@ -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; } diff --git a/lib/rbcodec/codecs/adx.c b/lib/rbcodec/codecs/adx.c index e6e4c6fe5f..f748e3d4cd 100644 --- a/lib/rbcodec/codecs/adx.c +++ b/lib/rbcodec/codecs/adx.c @@ -81,12 +81,12 @@ enum codec_status codec_run(void) return CODEC_ERROR; } DEBUGF("ADX: after init\n"); - + /* init history */ ch1_1=ch1_2=ch2_1=ch2_2=0; codec_set_replaygain(ci->id3); - + /* Get header */ DEBUGF("ADX: request initial buffer\n"); ci->seek_buffer(0); @@ -98,10 +98,10 @@ enum codec_status codec_run(void) DEBUGF("ADX: read size = %lx\n",(unsigned long)n); /* Get file header for starting offset, channel count */ - + chanstart = ((buf[2] << 8) | buf[3]) + 4; channels = buf[7]; - + /* useful for seeking and reporting current playback position */ avgbytespersec = ci->id3->frequency * 18 * channels / 32; DEBUGF("avgbytespersec=%ld\n",(unsigned long)avgbytespersec); @@ -126,7 +126,7 @@ enum codec_status codec_run(void) const int64_t b = (M_SQRT2*big28)-big28; int64_t c; int64_t d; - + fp_sincos((unsigned long)phasemultiple,&z); a = (M_SQRT2*big28) - (z >> 3); @@ -147,7 +147,7 @@ enum codec_status codec_run(void) } /* Get loop data */ - + looping = 0; start_adr = 0; end_adr = 0; if (!memcmp(buf+0x10,"\x01\xF4\x03",3)) { /* Soul Calibur 2 style (type 03) */ @@ -196,7 +196,7 @@ enum codec_status codec_run(void) DEBUGF("ADX: error, couldn't determine ADX type\n"); return CODEC_ERROR; } - + /* is file using encryption */ if (buf[0x13]==0x08) { DEBUGF("ADX: error, encrypted ADX not supported\n"); @@ -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 */ @@ -226,7 +227,7 @@ enum codec_status codec_run(void) } else { DEBUGF("ADX CODEC_ERROR: more than 2 channels\n"); return CODEC_ERROR; - } + } endofstream = 0; loop_count = 0; @@ -234,13 +235,13 @@ enum codec_status codec_run(void) fade_frames = 1; /* The main decoder loop */ - + while (!endofstream) { long action = ci->get_command(¶m); if (action == CODEC_ACTION_HALT) break; - + /* do we need to loop? */ if (bufoff > end_adr-18*channels && looping) { DEBUGF("ADX: loop!\n"); @@ -266,7 +267,7 @@ enum codec_status codec_run(void) /* do we need to seek? */ if (action == CODEC_ACTION_SEEK_TIME) { uint32_t newpos; - + DEBUGF("ADX: seek to %ldms\n", (long)param); endofstream = 0; @@ -291,9 +292,9 @@ enum codec_status codec_run(void) } if (bufoff>ci->filesize-channels*18) break; /* End of stream */ - + sampleswritten=0; - + while ( /* Is there data left in the file? */ (bufoff <= ci->filesize-(18*channels)) && @@ -310,13 +311,13 @@ 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; } scale = ((buf[0] << 8) | (buf[1])) +1; - + for (i = 2; i < 18; i++) { d = (buf[i] >> 4) & 15; @@ -332,14 +333,14 @@ enum codec_status codec_run(void) if (d & 8) d -= 16; ch1_0 = d*scale + ((coef1*ch1_1 + coef2*ch1_2) >> 12); if (ch1_0 > 32767) ch1_0 = 32767; - else if (ch1_0 < -32768) ch1_0 = -32768; + else if (ch1_0 < -32768) ch1_0 = -32768; samples[sampleswritten] = ch1_0; sampleswritten+=channels; ch1_2 = ch1_1; ch1_1 = ch1_0; } bufoff+=18; ci->advance_buffer(18); - + if (channels == 2) { /* decode second channel */ int32_t scale; @@ -348,13 +349,13 @@ 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; } scale = ((buf[0] << 8)|(buf[1]))+1; - + sampleswritten-=63; for (i = 2; i < 18; i++) @@ -372,7 +373,7 @@ enum codec_status codec_run(void) if (d & 8) d -= 16; ch2_0 = d*scale + ((coef1*ch2_1 + coef2*ch2_2) >> 12); if (ch2_0 > 32767) ch2_0 = 32767; - else if (ch2_0 < -32768) ch2_0 = -32768; + else if (ch2_0 < -32768) ch2_0 = -32768; samples[sampleswritten] = ch2_0; sampleswritten+=2; ch2_2 = ch2_1; ch2_1 = ch2_0; @@ -394,7 +395,7 @@ enum codec_status codec_run(void) sampleswritten >>= 1; /* make samples/channel */ ci->pcmbuf_insert(samples, NULL, sampleswritten); - + ci->set_elapsed( ((end_adr-start_adr)*loop_count + bufoff-chanstart)* 1000LL/avgbytespersec); |