diff mbox series

[FFmpeg-devel] avformat/dvdvideodec: use correct format string for menu read error, fixes compiler warning

Message ID 20240312153147.2330821-1-marth64@proxyid.net
State New
Headers show
Series [FFmpeg-devel] avformat/dvdvideodec: use correct format string for menu read error, fixes compiler warning | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Marth64 March 12, 2024, 3:31 p.m. UTC
Signed-off-by: Marth64 <marth64@proxyid.net>
---
 libavformat/dvdvideodec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andreas Rheinhardt March 12, 2024, 3:42 p.m. UTC | #1
Marth64:
> Signed-off-by: Marth64 <marth64@proxyid.net>
> ---
>  libavformat/dvdvideodec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
> index a182f95097..0ae2110cd2 100644
> --- a/libavformat/dvdvideodec.c
> +++ b/libavformat/dvdvideodec.c
> @@ -423,7 +423,7 @@ static int dvdvideo_menu_next_ps_block(AVFormatContext *s, DVDVideoPlaybackState
>  
>      blocks_read = DVDReadBlocks(state->vob_file, state->sector_offset, 1, read_buf);
>      if (blocks_read != 1) {
> -        av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d blocks_read=%d\n",
> +        av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d blocks_read=%ld\n",
>                                  state->sector_offset, blocks_read);
>  
>          return AVERROR_INVALIDDATA;

blocks_read is ssize_t and therefore the correct specifier is "%zd", but
unfortunately that is not supported by all implementations (see
SIZE_SPECIFIER in lavu/internal.h). Just use an int64_t instead.

- Andreas
Marth64 March 12, 2024, 3:43 p.m. UTC | #2
v2 on the way
diff mbox series

Patch

diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c
index a182f95097..0ae2110cd2 100644
--- a/libavformat/dvdvideodec.c
+++ b/libavformat/dvdvideodec.c
@@ -423,7 +423,7 @@  static int dvdvideo_menu_next_ps_block(AVFormatContext *s, DVDVideoPlaybackState
 
     blocks_read = DVDReadBlocks(state->vob_file, state->sector_offset, 1, read_buf);
     if (blocks_read != 1) {
-        av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d blocks_read=%d\n",
+        av_log(s, AV_LOG_ERROR, "Unable to read VOB block: offset=%d blocks_read=%ld\n",
                                 state->sector_offset, blocks_read);
 
         return AVERROR_INVALIDDATA;