Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: mkver via ffmpeg-devel <ffmpeg-devel@ffmpeg.org>
To: ffmpeg-devel@ffmpeg.org
Cc: mkver <code@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH] avcodec/get_bits: Avoid unused variable (PR #20843)
Date: Wed, 05 Nov 2025 13:37:32 -0000
Message-ID: <176234985277.25.11452940544196012286@2cb04c0e5124> (raw)

PR #20843 opened by mkver
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20843
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/20843.patch

Fixes lots of warnings from MSVC (which does not support av_unused).


>From 338c2c6d4ad206e2da061e7baf7c30f005f0f380 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Wed, 5 Nov 2025 14:36:31 +0100
Subject: [PATCH] avcodec/get_bits: Avoid unused variable

Fixes lots of warnings from MSVC (which does not support av_unused).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/get_bits.h | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/get_bits.h b/libavcodec/get_bits.h
index 85c87c65b1..a0c0f51276 100644
--- a/libavcodec/get_bits.h
+++ b/libavcodec/get_bits.h
@@ -166,18 +166,22 @@ static inline unsigned int show_bits(GetBitContext *s, int n);
 
 #define MIN_CACHE_BITS 25
 
+#define OPEN_READER_NOSIZE_NOCACHE(name, gb)    \
+    unsigned int name ## _index = (gb)->index
+
 #define OPEN_READER_NOSIZE(name, gb)            \
-    unsigned int name ## _index = (gb)->index;  \
-    av_unused unsigned int name ## _cache
+    OPEN_READER_NOSIZE_NOCACHE(name, gb);       \
+    unsigned int name ## _cache
 
 #if UNCHECKED_BITSTREAM_READER
 #define OPEN_READER(name, gb) OPEN_READER_NOSIZE(name, gb)
-
+#define OPEN_READER_SIZE(name, gb) ((void)0)
 #define BITS_AVAILABLE(name, gb) 1
 #else
+#define OPEN_READER_SIZE(name, gb) unsigned int name ## _size_plus8 = (gb)->size_in_bits_plus8
 #define OPEN_READER(name, gb)                   \
     OPEN_READER_NOSIZE(name, gb);               \
-    unsigned int name ## _size_plus8 = (gb)->size_in_bits_plus8
+    OPEN_READER_SIZE(name, gb)
 
 #define BITS_AVAILABLE(name, gb) name ## _index < name ## _size_plus8
 #endif
@@ -378,7 +382,8 @@ static inline unsigned int show_bits(GetBitContext *s, int n)
 
 static inline void skip_bits(GetBitContext *s, int n)
 {
-    OPEN_READER(re, s);
+    OPEN_READER_NOSIZE_NOCACHE(re, s);
+    OPEN_READER_SIZE(re, s);
     LAST_SKIP_BITS(re, s, n);
     CLOSE_READER(re, s);
 }
-- 
2.49.1

_______________________________________________
ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org
To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org

                 reply	other threads:[~2025-11-05 13:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176234985277.25.11452940544196012286@2cb04c0e5124 \
    --to=ffmpeg-devel@ffmpeg.org \
    --cc=code@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git